Skip to main content

second_hyper_zagreb

Function second_hyper_zagreb 

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

Compute the second hyper-Zagreb index.

HM₂(G) = Σ_{(u,v)∈E} (d(u) · d(v))²

Self-loops are skipped.

§Examples

use rust_igraph::{Graph, second_hyper_zagreb};

// K_3: each edge (2·2)²=16, 3 edges → 48
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(second_hyper_zagreb(&g).unwrap(), 48);