
    h                     R    S r SSKJr  SSKrS/r\R                  " SS9SS j5       rg)	z
Vitality measures.
    )partialNcloseness_vitalityweight)
edge_attrsc                     Uc  [         R                  " XS9nUb5  [         R                  " U R                  [        U 5      U1-
  5      US9nX4-
  $ [	        [
        XUS9nU  Vs0 sH	  ofU" US9_M     sn$ s  snf )a  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 mapping 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 returns 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.
       <http://books.google.com/books?id=TTNhSm7HYrIC>

)r   )r   wiener_index)node)nxr   subgraphsetr   r   )Gr	   r   r   aftervitalityvs          T/var/www/html/shao/venv/lib/python3.13/site-packages/networkx/algorithms/vitality.pyr   r      sz    t q8

3q6TF? ;FK##)1,WH)*+AxQ+++s   #A5)NNN)__doc__	functoolsr   networkxr
   __all___dispatchabler        r   <module>r      s9     
  X&?, '?,r   