Skip to main content

second_reformulated_zagreb

Function second_reformulated_zagreb 

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

Compute the second reformulated Zagreb index.

EM₂(G) = Σ_{e~f, e<f} ε(e) · ε(f)

The sum is over all pairs of adjacent edges (sharing a vertex). For each vertex v, every pair of edges incident to v contributes one term. Self-loops are excluded.

§Examples

use rust_igraph::{Graph, second_reformulated_zagreb};

// Path 0-1-2: edges e₁=(0,1) ε=1, e₂=(1,2) ε=1
// Only pair sharing vertex 1: ε·ε = 1 → EM₂ = 1
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert_eq!(second_reformulated_zagreb(&g).unwrap(), 1);