aryagraph.algorithms.centrality.closeness_centrality#
- aryagraph.algorithms.centrality.closeness_centrality(g: Any, weight: str | Callable[[Hashable, Hashable, dict], float] | None = None, wf_improved: bool = True) NodeMap[source]#
Closeness
(r - 1) / Σ d(u, v)over thernodes that reach v.For directed graphs the incoming distance is used, as in networkx. With wf_improved (Wasserman–Faust) the score is further scaled by
(r - 1) / (n - 1)so nodes in small components are not overrated. weight is read as an edge length (Dijkstra). ComplexityO(n·m).