ó
    …~i  ã                   ó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;Functions for computing the harmonic centrality of a graph.é    )ÚpartialNÚharmonic_centralityÚdistance)Ú
edge_attrsc                 óF  • [        Ub  U R                  U5      OU R                  5      n[        Ub  U R                  U5      OU R                  5      nU Vs0 s H  oDS_M     nnSn[        U5      [        U5      :  a4  SnX1p1[        R
                  " U 5      (       a  [        R                  " U SS9n [        [        R                  XS9nU HK  nU" U5      n	U	R                  5        H,  u  pJU
S:w  d  M  XA;   d  M  XV(       a  UOU==   SU
-  -  ss'   M.     MM     U$ s  snf )a…  Compute harmonic centrality for nodes.

Harmonic centrality [1]_ of a node `u` is the sum of the reciprocal
of the shortest path distances from all other nodes to `u`

.. math::

    C(u) = \sum_{v \neq u} \frac{1}{d(v, u)}

where `d(v, u)` is the shortest-path distance between `v` and `u`.

If `sources` is given as an argument, the returned harmonic centrality
values are calculated as the sum of the reciprocals of the shortest
path distances from the nodes specified in `sources` to `u` instead
of from all nodes to `u`.

Notice that higher values indicate higher centrality.

Parameters
----------
G : graph
  A NetworkX graph

nbunch : container (default: all nodes in G)
  Container of nodes for which harmonic centrality values are calculated.

sources : container (default: all nodes in G)
  Container of nodes `v` over which reciprocal distances are computed.
  Nodes not in `G` are silently ignored.

distance : edge attribute key, optional (default=None)
  Use the specified edge attribute as the edge distance in shortest
  path calculations.  If `None`, then each edge will have distance equal to 1.

Returns
-------
nodes : dictionary
  Dictionary of nodes with harmonic centrality as the value.

See Also
--------
betweenness_centrality, load_centrality, eigenvector_centrality,
degree_centrality, closeness_centrality

Notes
-----
If the 'distance' keyword is set to an edge attribute key then the
shortest-path length will be computed using Dijkstra's algorithm with
that edge attribute as the edge weight.

References
----------
.. [1] Boldi, Paolo, and Sebastiano Vigna. "Axioms for centrality."
       Internet Mathematics 10.3-4 (2014): 222-262.
r   FT)Úcopy)Úweighté   )
ÚsetÚnbunch_iterÚnodesÚlenÚnxÚis_directedÚreverser   Úshortest_path_lengthÚitems)ÚGÚnbunchr   ÚsourcesÚuÚ
centralityÚ
transposedÚsplÚvÚdistÚd_uvs              Úd/home/mande/repo/quber/.venv/lib/python3.13/site-packages/networkx/algorithms/centrality/harmonic.pyr   r   
   sü   € ôt ¨&Ñ*<�—‘˜vÔ&À!Ç'Á'ÓJ€FÜ¨GÑ,?�!—-‘- Ô(ÀQÇWÁWÓM€Gá &Ó'¢˜1�Q’$¡€JÐ'à€JÜ
ˆ6ƒ{”S˜“\Ó!Øˆ
Ø!�Ü�>Š>˜!×ÑÜ—
’
˜1 5Ñ)ˆAä
”"×)Ñ)¨1Ñ
>€CÛˆÙ�1‹vˆØ—z‘z–|‰GˆAà�q�y˜Q�[Ø¥
™1°Ó2°a¸$±hÑ>Õ2ó $ñ ð Ðùò# (s   ÁD)NNN)Ú__doc__Ú	functoolsr   Únetworkxr   Ú__all__Ú_dispatchabler   © ó    r   Ú<module>r&      s7   ðÙ Aå ã à Ð
!€ð ×Ò˜ZÑ(óMó )ñMr%   