Skip to main content

bertz_complexity_index

Function bertz_complexity_index 

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

Compute the Bertz complexity index.

B(G) = Σ_{(u,v)∈E} C(d(u)+d(v)-2, 2)

where C(n,2) = n·(n-1)/2. Self-loops are skipped. Edges where d(u)+d(v) < 4 contribute 0.

§Examples

use rust_igraph::{Graph, bertz_complexity_index};

// K_3: each edge d(u)+d(v)-2=2, C(2,2)=1, 3 edges → 3
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(bertz_complexity_index(&g).unwrap(), 3);