pub fn bell_index(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the Bell index (degree population variance).
B(G) = (1/n) Σ_v (d(v) - d̄)²
where d̄ = 2m/n is the average degree. Equals 0 for regular graphs.
Returns 0.0 for graphs with fewer than 1 vertex.
This is the population variance of the degree sequence, as defined
by Bell (1992). It differs from degree_variance only if the latter
uses sample variance (n-1 denominator); our degree_variance already
uses population variance, so they are equivalent. This function is
provided for nomenclature completeness in chemical graph theory.
§Examples
use rust_igraph::{Graph, bell_index};
// K_3: d=(2,2,2), d̄=2, B=0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(bell_index(&g).unwrap().abs() < 1e-10);