ó
    …~it  ã                   ó~   • S SK rS SKJrJr  S/r\" S5      \" S5      \R                  " SS9S	S j5       5       5       rg)
é    N)Únot_implemented_forÚpy_random_stateÚaverage_clusteringÚdirectedé   Úapproximate_average_clustering)Únamec                 óF  • [        U 5      nSn[        U 5      n[        U5       Vs/ s H  n[        UR	                  5       U-  5      PM!     sn HG  n[        XU      5      n[        U5      S:  a  M$  UR                  US5      u  p‰X€U	   ;   d  MB  US-  nMI     XA-  $ s  snf )u{  Estimates the average clustering coefficient of G.

The local clustering of each node in `G` is the fraction of triangles
that actually exist over all possible triangles in its neighborhood.
The average clustering coefficient of a graph `G` is the mean of
local clusterings.

This function finds an approximate average clustering coefficient
for G by repeating `n` times (defined in `trials`) the following
experiment: choose a node at random, choose two of its neighbors
at random, and check if they are connected. The approximate
coefficient is the fraction of triangles found over the number
of trials [1]_.

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

trials : integer
    Number of trials to perform (default 1000).

seed : integer, random_state, or None (default)
    Indicator of random number generation state.
    See :ref:`Randomness<randomness>`.

Returns
-------
c : float
    Approximated average clustering coefficient.

Examples
--------
>>> from networkx.algorithms import approximation
>>> G = nx.erdos_renyi_graph(10, 0.2, seed=10)
>>> approximation.average_clustering(G, trials=1000, seed=10)
0.214

Raises
------
NetworkXNotImplemented
    If G is directed.

References
----------
.. [1] Schank, Thomas, and Dorothea Wagner. Approximating clustering
   coefficient and transitivity. UniversitÃ¤t Karlsruhe, FakultÃ¤t fÃ¼r
   Informatik, 2004.
   https://doi.org/10.5445/IR/1000001239

r   r   é   )ÚlenÚlistÚrangeÚintÚrandomÚsample)
ÚGÚtrialsÚseedÚnÚ	trianglesÚnodesÚiÚnbrsÚuÚvs
             Úu/home/mande/repo/quber/.venv/lib/python3.13/site-packages/networkx/algorithms/approximation/clustering_coefficient.pyr   r      s›   € ôl 	ˆA‹€AØ€IÜ�‹G€EÜ.3°F¬mÓ<ªm¨Œc�$—+‘+“- !Ñ#Ö$©mÔ<ˆÜ�A˜A‘h‘KÓ ˆÜˆt‹9�q‹=ÙØ�{‰{˜4 Ó#‰ˆØ�!‘�9Ø˜‰NŠIñ =ð ÑÐùò =s   ¦&B)iè  N)ÚnetworkxÚnxÚnetworkx.utilsr   r   Ú__all__Ú_dispatchabler   © ó    r   Ú<module>r$      sM   ðÛ ß ?àÐ
 €ñ �ZÓ Ù�ÓØ×ÒÐ7Ñ8ó=ó 9ó ó !ñ=r#   