Skip to main content

first_reformulated_zagreb

Function first_reformulated_zagreb 

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

Compute the first reformulated Zagreb index.

EM₁(G) = Σ_{e∈E} ε(e)² where ε(e) = d(u) + d(v) - 2.

Self-loops are skipped.

§Examples

use rust_igraph::{Graph, first_reformulated_zagreb};

// K_3: each edge has ε = 2+2-2 = 2, EM₁ = 3·4 = 12
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(first_reformulated_zagreb(&g).unwrap(), 12);