Skip to main content

albertson_coindex

Function albertson_coindex 

Source
pub fn albertson_coindex(graph: &Graph) -> IgraphResult<u64>
Expand description

Compute the Albertson coindex.

\bar{Alb}(G) = Σ_{u<v, (u,v)∉E} |d(u)-d(v)|

§Examples

use rust_igraph::{Graph, albertson_coindex};

// K_3: no non-adjacent pairs → 0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(albertson_coindex(&g).unwrap(), 0);

// Star S_5: 6 leaf pairs, |1-1|=0 → 0
let s = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert_eq!(albertson_coindex(&s).unwrap(), 0);