Skip to main content

degree_core_ratio

Function degree_core_ratio 

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

Compute the core ratio (fraction of vertices with degree ≥ d̄).

Returns the fraction of vertices whose degree is at least the mean degree. Returns 0.0 for empty graphs. For regular graphs this is always 1.0.

§Examples

use rust_igraph::{Graph, degree_core_ratio};

// K_3: all degree 2, mean = 2 → all qualify → 1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((degree_core_ratio(&g).unwrap() - 1.0).abs() < 1e-10);