pub fn harary_index(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the Harary index of a graph.
H(G) = Σ_{u<v} 1 / d(u, v)
Disconnected pairs (infinite distance) are skipped. Returns 0.0 for graphs with fewer than 2 vertices.
§Examples
use rust_igraph::{Graph, harary_index};
// Path 0-1-2: d(0,1)=1, d(0,2)=2, d(1,2)=1
// H = 1/1 + 1/2 + 1/1 = 2.5
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert!((harary_index(&g).unwrap() - 2.5).abs() < 1e-10);