Skip to main content

walk_regularity

Function walk_regularity 

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

Compute the walk regularity index of the graph.

WR = 1 - CV(d) where CV = σ/μ is the coefficient of variation of the degree sequence.

Equals 1.0 for regular graphs (all degrees equal) and decreases toward 0 for highly irregular graphs. Returns 1.0 for graphs with fewer than 2 vertices or no edges.

§Examples

use rust_igraph::{Graph, walk_regularity};

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