GraphUtilities`
GraphUtilities`

# ClosenessCentrality

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

ClosenessCentrality[g]

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 True whether edge weight is to be used in calculating distance Normalize False whether to normalize the output

# Examples

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:
{"ft_lang_label":"__label__en","ft_lang_prob":0.68050224,"math_prob":0.724455,"size":1775,"snap":"2023-40-2023-50","text_gpt3_token_len":417,"char_repetition_ratio":0.23376623,"word_repetition_ratio":0.08163265,"special_character_ratio":0.17915493,"punctuation_ratio":0.16544117,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9687314,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-12-10T18:09:18Z\",\"WARC-Record-ID\":\"<urn:uuid:6e0c90e2-24b6-44da-81ee-b6caa215ca56>\",\"Content-Length\":\"90050\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b345e9c4-ec31-4993-9488-be0093da7df5>\",\"WARC-Concurrent-To\":\"<urn:uuid:9a3b5237-d7a3-45cf-80ea-4db42d700a64>\",\"WARC-IP-Address\":\"140.177.9.163\",\"WARC-Target-URI\":\"https://reference.wolfram.com/language/GraphUtilities/ref/ClosenessCentrality.html\",\"WARC-Payload-Digest\":\"sha1:4YIAAUA4N33HSMNVRDQOVOGGJ4PPZ3PA\",\"WARC-Block-Digest\":\"sha1:ANPOXMFDO3DWTSA5XJJMWADN3LDEAO5Y\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679102612.80_warc_CC-MAIN-20231210155147-20231210185147-00116.warc.gz\"}"}