§
    bŠtjñ  ã                   óZ   — d Z ddlmZ ddlZdgZ ej        d¬¦  «        dd„¦   «         ZdS )	z
Vitality measures.
é    )ÚpartialNÚcloseness_vitalityÚweight)Ú
edge_attrsc                 ó  ‡— |€t          j        | |¬¦  «        }|�?t          j        |                      t          | ¦  «        |hz
  ¦  «        |¬¦  «        }||z
  S t	          t
          | ||¬¦  «        Šˆfd„| D ¦   «         S )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>

    N)r   )r   Úwiener_indexc                 ó*   •— i | ]}| ‰|¬ ¦  «        “ŒS ))Únode© )Ú.0ÚvÚvitalitys     €úZ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/algorithms/vitality.pyú
<dictcomp>z&closeness_vitality.<locals>.<dictcomp>L   s(   ø€ Ð+Ð+Ð+ AˆAˆxˆx˜QÐÑÔÐ+Ð+Ð+ó    )Únxr   ÚsubgraphÚsetr   r   )ÚGr
   r   r   Úafterr   s        @r   r   r      sŽ   ø€ ðt ÐÝ” q°Ð8Ñ8Ô8ˆØÐÝ” §
¢
­3¨q©6¬6°T°F©?Ñ ;Ô ;ÀFÐKÑKÔKˆØ˜eÑ#Ð#ÝÕ)¨1°VÈ,ÐWÑWÔW€HØ+Ð+Ð+Ð+¨Ð+Ñ+Ô+Ð+r   )NNN)Ú__doc__Ú	functoolsr   Únetworkxr   Ú__all__Ú_dispatchabler   r   r   r   ú<module>r      sr   ððð ð Ð Ð Ð Ð Ð à Ð Ð Ð àÐ
 €ð €Ô˜XÐ&Ñ&Ô&ð?,ð ?,ð ?,ñ 'Ô&ð?,ð ?,ð ?,r   