Skip to main content

second_multiplicative_zagreb

Function second_multiplicative_zagreb 

Source
pub fn second_multiplicative_zagreb(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the second multiplicative Zagreb index.

Π₂(G) = Π_{(u,v)∈E} d(u) · d(v)

The product of degree products over all edges. Self-loops are skipped. Returns 1.0 if there are no (non-loop) edges.

§Examples

use rust_igraph::{Graph, second_multiplicative_zagreb};

// K_3: 3 edges, each (2·2)=4 → Π₂ = 4³ = 64
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((second_multiplicative_zagreb(&g).unwrap() - 64.0).abs() < 1e-10);