pub fn reduced_first_zagreb(graph: &Graph) -> IgraphResult<u64>Expand description
Compute the reduced first Zagreb index.
M₁_red(G) = Σ_v (d(v)-1)²
For isolated vertices (degree 0), the term is (-1)² = 1, but
conventionally these are treated as having reduced degree 0, so
we skip vertices with degree 0.
§Examples
use rust_igraph::{Graph, reduced_first_zagreb};
// K_3: d=(2,2,2), each (2-1)²=1 → 3
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(reduced_first_zagreb(&g).unwrap(), 3);
// Path 0-1-2: d=(1,2,1), (0)²+(1)²+(0)²=1
let p = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert_eq!(reduced_first_zagreb(&p).unwrap(), 1);