Skip to main content

exponential_ga

Function exponential_ga 

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

Compute the exponential geometric-arithmetic index.

EGA(G) = Σ_{(u,v)∈E} exp(2√(du·dv) / (du+dv))

Edges with du+dv == 0 are skipped. Self-loops are skipped.

§Examples

use rust_igraph::{Graph, exponential_ga};

// K_3: 3 edges, d=(2,2), each exp(2·2/4) = exp(1) = e → 3e
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let expected = 3.0 * 1.0_f64.exp();
assert!((exponential_ga(&g).unwrap() - expected).abs() < 1e-10);