Skip to main content

degree_iqr

Function degree_iqr 

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

Compute the interquartile range (IQR) of the degree sequence.

IQR(G) = Q₃ - Q₁

Uses linear interpolation for quartiles. Returns 0.0 for graphs with fewer than 2 vertices.

§Examples

use rust_igraph::{Graph, degree_iqr};

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