pub fn neighbor_degree_disparity(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the average neighbor degree ratio.
Mean of knn(v) / degree(v) over all vertices with degree >= 1,
where knn(v) is the average degree of v’s neighbors. This
measures the tendency for high-degree vertices to connect to
other high-degree vertices. Returns 0.0 for graphs with no
edges.
§Examples
use rust_igraph::{Graph, neighbor_degree_disparity};
// K_3: each vertex has degree 2, neighbors have degree 2 → knn/d = 1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((neighbor_degree_disparity(&g).unwrap() - 1.0).abs() < 1e-10);