Skip to main content

estrada_index

Function estrada_index 

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

Compute the Estrada index of a graph.

EE(G) = Σ_i exp(λ_i) where {λ_i} are the adjacency eigenvalues.

For an empty graph (no vertices) returns 0.0. For an edgeless graph on n vertices returns n (since all eigenvalues are zero).

§Examples

use rust_igraph::{Graph, estrada_index};

// K_3: eigenvalues {2, -1, -1} → EE = e² + 2·e⁻¹
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let ee = estrada_index(&g).unwrap();
let expected = (2.0_f64).exp() + 2.0 * (-1.0_f64).exp();
assert!((ee - expected).abs() < 0.01);