Skip to main content

core_density

Function core_density 

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

Compute the core density.

Edge density of the subgraph induced by vertices in the maximum k-core. For a complete graph this is 1.0. Returns 0.0 for empty graphs or when the max-core has fewer than 2 vertices.

ยงExamples

use rust_igraph::{Graph, core_density};

// K_4: max core = all 4 vertices, density = 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_density(&g).unwrap() - 1.0).abs() < 1e-10);