Skip to content

ClosenessCentrality ​

How close a vertex of a Graph is, on average, to every other vertex it can reach.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageClosenessCentrality✓
ClosenessCentrality(g)every vertex's closeness centrality, in VertexList(g) order.
ClosenessCentrality(g, v)just v's closeness centrality.
Typed signatures
TypePackageApplies
(value, any?) -> list<number> | numbercombinatoricsalways

Domain: Collections

Details
  • Defined as (r - 1) / (sum of distances from v to those r - 1 vertices), where r is the number of vertices reachable from v INCLUDING v itself -- restricting to the reachable set rather than treating a disconnected graph as an error. 0 for a vertex with nothing reachable.
  • Distances respect edge direction, same as GraphDistance (out-distances from v). Kernel-unverified against a live Wolfram session -- see the PR notes for the exact formula chosen.

Examples

Basic #
live ↗
InClosenessCentrality(StarGraph(5),1)\mathrm{ClosenessCentrality}(\mathrm{StarGraph}(5), 1)Out11
Applications #
live ↗
InReverse(SortBy([VertexList(g),ClosenessCentrality(g)]T,Last))\mathrm{Reverse}(\mathrm{SortBy}(\bigl\lbrack\mathrm{VertexList}(g), \mathrm{ClosenessCentrality}(g)\bigr\rbrack^T, \mathrm{Last}))Out[ClosenessCentrality(g),VertexList(g)]\bigl\lbrack\mathrm{ClosenessCentrality}(g), \mathrm{VertexList}(g)\bigr\rbrack
About
Examples2
Checked againstWolfram Language 1 agree1 unevaluated
CrosswalkWolfram Language

See also: EigenvectorCentrality, GraphDistance