Skip to main content

exponential_first_zagreb

Function exponential_first_zagreb 

Source
pub fn exponential_first_zagreb(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the exponential first Zagreb index.

eM₁(G) = Σ_v e^{d(v)²}

For each vertex, the contribution is e raised to the square of its degree. Isolated vertices contribute e^0 = 1.

§Examples

use rust_igraph::{Graph, exponential_first_zagreb};

// K_3: 3 vertices with d=2 → 3·e^4
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((exponential_first_zagreb(&g).unwrap() - 3.0 * 4.0_f64.exp()).abs() < 1e-10);