ó žÃÒYc@sAdZddlmZddlZdgZdddd„ZdS(s Vitality measures. iÿÿÿÿ(tpartialNtcloseness_vitalitycs’|dkr$tj|d|ƒ}n|dk rctj|jt|ƒ|hƒd|ƒ}||Stt|d|d|ƒ‰‡fd†|DƒS(s£Returns the closeness vitality for nodes in the graph. 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. 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 :func:`~networkx.wiener_index` function. node : object If specified, only the closeness vitality for this node will be returned. Otherwise, a dictionary mappping each node to its closeness vitality will be returned. 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. Returns ------- dictionary or float If `node` is None, this function returnes a dictionary with nodes as keys and closeness vitality as the value. Otherwise, it returns only the closeness vitality for the specified `node`. The closeness vitality of a node may be negative infinity if removing that node would disconnect the graph. Examples -------- >>> G = nx.cycle_graph(3) >>> nx.closeness_vitality(G) {0: 2.0, 1: 2.0, 2: 2.0} See Also -------- closeness_centrality References ---------- .. [1] Ulrik Brandes, Thomas Erlebach (eds.). *Network Analysis: Methodological Foundations*. Springer, 2005. tweightt wiener_indexcs"i|]}ˆd|ƒ|“qS(tnode((t.0tv(tvitality(sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/vitality.pys Ws N(tNonetnxRtsubgraphtsetRR(tGRRRtafter((Rsr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/vitality.pyRs9  + (t__doc__t functoolsRtnetworkxR t__all__RR(((sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/vitality.pyts