Skip to main content

core_persistence

Function core_persistence 

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

Average coreness divided by the degeneracy (maximum coreness).

Returns a value in [0, 1]. A value of 1 means every vertex has the same coreness (e.g. a complete graph). A value near 0 means most vertices are in low-order cores while the degeneracy is high.

Returns 0.0 for graphs where the degeneracy is 0 (edgeless graphs).

§Examples

use rust_igraph::{Graph, core_persistence};

// K3: all coreness = 2, degeneracy = 2 → persistence = 1.0
let g = Graph::from_edges(&[(0, 1), (1, 2), (0, 2)], false, Some(3)).unwrap();
assert!((core_persistence(&g).unwrap() - 1.0).abs() < 1e-10);