Skip to main content

irb_index

Function irb_index 

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

Compute the root-difference irregularity index.

IRB(G) = Σ_{(u,v)∈E} (√d(u) - √d(v))²

This is always non-negative and equals 0 for regular graphs. Self-loops are skipped.

§Examples

use rust_igraph::{Graph, irb_index};

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