As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System. »


finds the closeness centrality.

Details and Options

  • ClosenessCentrality functionality is now available in the built-in Wolfram Language function ClosenessCentrality.
  • To use ClosenessCentrality, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
  • The closeness centrality of a vertex u is defined as the inverse of the sum of the distance from u to all other vertices. The closeness centrality of a vertex in a disconnected graph is based on the closeness centrality of the component where this vertex belongs.
  • The following options can be given:
  • Weighted Truewhether edge weight is to be used in calculating distance
    NormalizeFalsewhether to normalize the output


open allclose all

Basic Examples  (2)

This defines a small graph:

Compute the closeness centrality:

This function has been superseded by ClosenessCentrality in the Wolfram System:

Scope  (1)

This defines a disconnected graph and finds the closeness centrality:

Options  (1)

Weighted  (1)

This defines a graph with edge weights:

By default, edge weights are taken into account:

This gives the closeness centrality if edge weights are assumed to be 1.:

Applications  (1)

A plot of a grid graph with vertices of high centrality in red:

Properties & Relations  (1)

The centrality of a vertex that cannot reach all other vertices in its component is zero:

The centrality of a disconnected graph is calculated by treating each component separately:

Wolfram Research (2007), ClosenessCentrality, Wolfram Language function,


Wolfram Research (2007), ClosenessCentrality, Wolfram Language function,


Wolfram Language. 2007. "ClosenessCentrality." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2007). ClosenessCentrality. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_closenesscentrality, author="Wolfram Research", title="{ClosenessCentrality}", year="2007", howpublished="\url{}", note=[Accessed: 24-July-2024 ]}


@online{reference.wolfram_2024_closenesscentrality, organization={Wolfram Research}, title={ClosenessCentrality}, year={2007}, url={}, note=[Accessed: 24-July-2024 ]}