Skip to main content

first_leap_zagreb

Function first_leap_zagreb 

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

Compute the first leap Zagreb index.

LM₁(G) = Σ_v d₂(v)² where d₂(v) is the number of vertices at distance exactly 2 from v.

§Examples

use rust_igraph::{Graph, first_leap_zagreb};

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