Skip to main content

albertson_index

Function albertson_index 

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

Compute the Albertson index (edge irregularity).

ALB(G) = Σ_{(u,v)∈E} |d_u − d_v|

Self-loops contribute 0 (both endpoints have the same vertex). For regular graphs the result is 0.

§Examples

use rust_igraph::{Graph, albertson_index};

// Star S_4 (center degree 4, leaves degree 1): |4-1| × 4 = 12
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((albertson_index(&g).unwrap() - 12.0).abs() < 1e-10);