Skip to main content

neighbor_connectivity_ratio

Function neighbor_connectivity_ratio 

Source
pub fn neighbor_connectivity_ratio(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the neighbor connectivity ratio.

For each vertex v with degree ≥ 1, computes min_neighbor_degree / max_neighbor_degree. Averages over all qualifying vertices. Values near 1 indicate homogeneous neighbor degrees; values near 0 indicate high disparity. Returns 0.0 for edgeless graphs.

§Examples

use rust_igraph::{Graph, neighbor_connectivity_ratio};

// K_3: all neighbor degrees = 2 → min/max = 1.0 per vertex
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((neighbor_connectivity_ratio(&g).unwrap() - 1.0).abs() < 1e-10);