Skip to main content

first_ev_degree_zagreb

Function first_ev_degree_zagreb 

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

Compute the first ev-degree Zagreb index.

M₁^{ev}(G) = Σ_{e=(u,v)} [d(u)+d(v)-2]²

Self-loops contribute 0.

§Examples

use rust_igraph::{Graph, first_ev_degree_zagreb};

// K_3: 3 edges, each d_ev = 2+2-2 = 2, M₁ev = 3×4 = 12
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(first_ev_degree_zagreb(&g).unwrap(), 12);