Skip to main content

arithmetic_geometric_index

Function arithmetic_geometric_index 

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

Compute the arithmetic-geometric index.

AG(G) = Σ_{(u,v)∈E} (d(u)+d(v)) / (2√(d(u)·d(v)))

Self-loops and edges with a degree-0 endpoint are skipped.

§Examples

use rust_igraph::{Graph, arithmetic_geometric_index};

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