pub fn harmonic_centrality(graph: &Graph) -> IgraphResult<Vec<f64>>Expand description
Per-vertex harmonic centrality.
result[v] = (1/(n-1)) * sum_{u != v, reachable} 1/d(v, u). The
inverse distance to unreachable vertices is taken as 0, so harmonic
centrality is well-defined on disconnected graphs (unlike closeness).
For graphs with vcount < 2 returns an empty / single-zero vector
(the normalization factor n - 1 is 0 in that case; we report 0
rather than NaN to match python-igraph 0.11.x).
Counterpart of
igraph_harmonic_centrality(_, _, vss_all(), IGRAPH_OUT, NULL, /*normalized=*/true).
ยงExamples
use rust_igraph::{Graph, harmonic_centrality};
// Path 0-1-2: vertex 1 (centre) has harmonic 1.0; ends 0.75.
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let h = harmonic_centrality(&g).unwrap();
assert_eq!(h, vec![0.75, 1.0, 0.75]);