Skip to main content

core_ratio

Function core_ratio 

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

Compute the core ratio.

Fraction of vertices that belong to the maximum k-core (the densest cohesive substructure). Higher values indicate a large dense core. Returns 0.0 for empty graphs.

§Examples

use rust_igraph::{Graph, core_ratio};

// K_4: all vertices have coreness 3 → ratio = 1.0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!((core_ratio(&g).unwrap() - 1.0).abs() < 1e-10);