Skip to main content

geometric_arithmetic_index

Function geometric_arithmetic_index 

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

Compute the geometric-arithmetic index.

GA(G) = Σ_{(u,v)∈E} 2√(d_u · d_v) / (d_u + d_v)

For each edge, this is the ratio of the geometric mean to the arithmetic mean of the endpoint degrees.

§Examples

use rust_igraph::{Graph, geometric_arithmetic_index};

// K_3: all degrees 2 → each term = 2√4/4 = 1
// GA = 3
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((geometric_arithmetic_index(&g).unwrap() - 3.0).abs() < 1e-10);