networkx 2.8.2 Pypi GitHub Homepage
Other Docs
Other ParametersParametersReturnsBackRef
closeness_vitality(G, node=None, weight=None, wiener_index=None)

The closeness vitality of a node, defined in Section 3.6.2 of [1], is the change in the sum of distances between all node pairs when excluding that node.

Other Parameters

wiener_index : number

If you have already computed the Wiener index of the graph G, you can provide that value here. Otherwise, it will be computed for you.

Parameters

G : NetworkX graph

A strongly-connected graph.

weight : string

The name of the edge attribute used as weight. This is passed directly to the ~networkx.wiener_index function.

node : object

If specified, only the closeness vitality for this node will be returned. Otherwise, a dictionary mapping each node to its closeness vitality will be returned.

Returns

dictionary or float

If :None:None:`node` is None, this function returns a dictionary with nodes as keys and closeness vitality as the value. Otherwise, it returns only the closeness vitality for the specified :None:None:`node`.

The closeness vitality of a node may be negative infinity if removing that node would disconnect the graph.

Returns the closeness vitality for nodes in the graph.

See Also

closeness_centrality

Examples

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

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.vitality.closeness_vitality

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/vitality.py#11
type: <class 'function'>
Commit: