Skip to main content

degree_range_ratio

Function degree_range_ratio 

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

Compute the edge connectivity ratio.

Approximates edge connectivity as the minimum degree (a lower bound on λ(G)), then normalizes by the minimum degree itself, yielding 1.0 for all connected graphs with min_degree > 0. More usefully, this computes min_degree / max_degree which measures how uniform the degree distribution is from a connectivity standpoint. Returns 0.0 for disconnected or trivial graphs.

§Examples

use rust_igraph::{Graph, degree_range_ratio};

// K_3: min_deg=2, max_deg=2 → ratio=1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((degree_range_ratio(&g).unwrap() - 1.0).abs() < 1e-10);