NetworkX

Previous topic

closeness_vitality

Next topic

Functions

closeness_vitality

closeness_vitality(G, v=None, weight=None)[source]

Compute closeness vitality for nodes.

Closeness vitality at a node is the change in the sum of distances between all node pairs when excluding a that node.

Parameters :

G : graph

A networkx graph

v : node, optional

Return only the value for node v.

weight : None or string, optional

If None, edge weights are ignored. Otherwise holds the name of the edge attribute used as weight.

Returns :

nodes : dictionary

Dictionary with nodes as keys and closeness vitality as the value.

See also

closeness_centrality

Examples

>>> G=nx.cycle_graph(3)
>>> nx.closeness_vitality(G)
{0: 4.0, 1: 4.0, 2: 4.0}