Skip to main content

ira_index

Function ira_index 

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

Compute the power-difference irregularity index.

IRA_α(G) = Σ_{(u,v)∈E} |d(u)^α - d(v)^α| for real α.

Special cases:

  • α = 1: equals the Albertson index Σ |d(u)-d(v)|
  • α = 2: equals IRD(G)
  • α = 0.5: equals Σ |√d(u) - √d(v)|

Edges with degree-0 endpoint are skipped when α < 0. Self-loops are skipped.

§Examples

use rust_igraph::{Graph, ira_index};

// Star S_5: 4 edges (4,1), α=2 → 4·|16-1| = 60
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((ira_index(&g, 2.0).unwrap() - 60.0).abs() < 1e-10);