pub fn first_hyper_zagreb_coindex(graph: &Graph) -> IgraphResult<u64>Expand description
Compute the first hyper-Zagreb coindex.
\bar{HM₁}(G) = Σ_{u<v, (u,v)∉E} [d(u)+d(v)]²
Uses the identity: \bar{HM₁} = 4m²·(n-1) + (n-1)·Σd² - HM₁(G)
where HM₁ is the first hyper-Zagreb index (sum of (du+dv)² over edges),
m is edge count, and Σd² = M₁ (first Zagreb index).
Derivation: Σ_all(du+dv)² = Σ_all(du²+2du·dv+dv²)
= (n-1)Σd² + 2·(Σd)² - 2·Σd²
but simpler: just compute directly for correctness.
§Examples
use rust_igraph::{Graph, first_hyper_zagreb_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!(first_hyper_zagreb_coindex(&g).unwrap(), 0);
// Path 0-1-2: non-adj (0,2), (1+1)² = 4
let p = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert_eq!(first_hyper_zagreb_coindex(&p).unwrap(), 4);