Skip to main content

second_leap_zagreb

Function second_leap_zagreb 

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

Compute the second leap Zagreb index.

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

Self-loops are skipped.

§Examples

use rust_igraph::{Graph, second_leap_zagreb};

// Path 0-1-2: d₂=[1,0,1]
// edges: (0,1):1×0=0, (1,2):0×1=0 → LM₂=0
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert_eq!(second_leap_zagreb(&g).unwrap(), 0);