Ë
    D^(h-S  ã                   ó  — d Z ddlZddlZddlZddlZddlmZmZ ddlm	Z	m
Z
mZ ddlmZmZ ddlZg d¢Zdd„Zd„ Zdd	„Zdd
„Zdd„Zd„ Zdd„Zd„ Zdd„Z G d„ dej6                  «      Z G d„ d«      Zdd„Zd„ Zd„ Z d„ Z!d„ Z"ddddœd„Z#y)a  
Miscellaneous Helpers for NetworkX.

These are not imported into the base networkx namespace but
can be accessed, for example, as

>>> import networkx
>>> networkx.utils.make_list_of_ints({1, 2, 3})
[1, 2, 3]
>>> networkx.utils.arbitrary_element({5, 1, 7})  # doctest: +SKIP
1
é    N)ÚdefaultdictÚdeque)ÚIterableÚIteratorÚSized)ÚchainÚtee)ÚflattenÚmake_list_of_intsÚdict_to_numpy_arrayÚarbitrary_elementÚpairwiseÚgroupsÚcreate_random_stateÚcreate_py_random_stateÚPythonRandomInterfaceÚPythonRandomViaNumpyBitsÚnodes_equalÚedges_equalÚgraphs_equalÚ_clear_cachec                 ó
  — t        | t        t        z  «      rt        | t        «      r| S |€g }| D ]G  }t        |t        t        z  «      rt        |t        «      r|j	                  |«       Œ<t        ||«       ŒI t        |«      S )z>Return flattened version of (possibly nested) iterable object.)Ú
isinstancer   r   ÚstrÚappendr
   Útuple)ÚobjÚresultÚitems      úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/networkx/utils/misc.pyr
   r
   /   sr   € ä�cœ8¤eÑ+Ô,´
¸3ÄÔ0DØˆ
Ø€~ØˆØò "ˆÜ˜$¤¬5Ñ 0Ô1´ZÀÄcÔ5JØ�M‰M˜$Õä�D˜&Õ!ð	"ô
 �‹=Ðó    c                 óè  — t        | t        «      sGg }| D ]>  }d|› �}	 t        |«      }||k7  rt	        j
                  |«      ‚|j                  |«       Œ@ |S t        | «      D ]F  \  }}d|› �}t        |t        «      rŒ	 t        |«      }||k7  rt	        j
                  |«      ‚|| |<   ŒH | S # t        $ r t	        j
                  |«      d‚w xY w# t        $ r t	        j
                  |«      d‚w xY w)a*  Return list of ints from sequence of integral numbers.

    All elements of the sequence must satisfy int(element) == element
    or a ValueError is raised. Sequence is iterated through once.

    If sequence is a list, the non-int values are replaced with ints.
    So, no new list is created
    zsequence is not all integers: N)r   ÚlistÚintÚ
ValueErrorÚnxÚNetworkXErrorr   Ú	enumerate)Úsequencer   ÚiÚerrmsgÚiiÚindxs         r    r   r   =   s  € ô �h¤Ô%ØˆØò 	ˆAØ5°a°SÐ9ˆFð9Ü˜“V�ð �QŠwÜ×&Ñ& vÓ.Ð.Ø�M‰M˜"Õð	ð ˆä˜XÓ&ò 
‰ˆˆaØ1°!°Ð5ˆÜ�aœÔØð	5Ü�Q“ˆBð �Š7Ü×"Ñ" 6Ó*Ð*Øˆ�Šð
ð €Oøô% ò 9Ü×&Ñ& vÓ.°DÐ8ð9ûô ò 	5Ü×"Ñ" 6Ó*°Ð4ð	5ús   žB.Â CÂ. CÃ C1c                 ó^   — 	 t        | |«      S # t        t        f$ r t        | |«      cY S w xY w)zPConvert a dictionary of dictionaries to a numpy array
    with optional mapping.)Ú_dict_to_numpy_array2ÚAttributeErrorÚ	TypeErrorÚ_dict_to_numpy_array1)ÚdÚmappings     r    r   r   a   s7   € ð1Ü$ Q¨Ó0Ð0øÜœIÐ&ò 1ô % Q¨Ó0Ò0ð1ús   ‚ Ž,«,c           
      óÖ  — ddl }|€wt        | j                  «       «      }| j                  «       D ]$  \  }}|j	                  |j                  «       «       Œ& t        t        |t        t        |«      «      «      «      }t        |«      }|j                  ||f«      }|j                  «       D ]+  \  }}	|j                  «       D ]  \  }
}	 | |   |
   ||	|f<   Œ Œ- |S # t        $ r Y Œ%w xY w)zYConvert a dictionary of dictionaries to a 2d numpy array
    with optional mapping.

    r   N)ÚnumpyÚsetÚkeysÚitemsÚupdateÚdictÚzipÚrangeÚlenÚzerosÚKeyError)r3   r4   ÚnpÚsÚkÚvÚnÚaÚk1r*   Úk2Újs               r    r/   r/   l   sá   € ó
 à€Ü�—‘“‹MˆØ—G‘G“Iò 	‰DˆAˆqØ�H‰H�Q—V‘V“XÕð	ä”s˜1œe¤C¨£F›mÓ,Ó-ˆÜˆG‹€AØ
�‰�!�Q�Ó€AØ—‘“ò ‰ˆˆAØ—]‘]“_ò 	‰EˆB�ðØ˜B™% ™)��!�Q�$’ñ	ðð €Høô ò Ùðús   Ã	CÃ	C(Ã'C(c           
      ó  — ddl }|€@t        | j                  «       «      }t        t	        |t        t        |«      «      «      «      }t        |«      }|j                  |«      }|j                  «       D ]  \  }}||   }| |   ||<   Œ |S )zJConvert a dictionary of numbers to a 1d numpy array with optional mapping.r   N)	r6   r7   r8   r;   r<   r=   r>   r?   r9   )r3   r4   rA   rB   rE   rF   rG   r*   s           r    r2   r2   ƒ   s~   € ãà€Ü�—‘“‹MˆÜ”s˜1œe¤C¨£F›mÓ,Ó-ˆÜˆG‹€AØ
�‰�‹€AØ—‘“ò ‰ˆˆAØ�B‰KˆØ�‰uˆˆ!Šðð €Hr!   c                 ó`   — t        | t        «      rt        d«      ‚t        t	        | «      «      S )aÊ  Returns an arbitrary element of `iterable` without removing it.

    This is most useful for "peeking" at an arbitrary element of a set,
    but can be used for any list, dictionary, etc., as well.

    Parameters
    ----------
    iterable : `abc.collections.Iterable` instance
        Any object that implements ``__iter__``, e.g. set, dict, list, tuple,
        etc.

    Returns
    -------
    The object that results from ``next(iter(iterable))``

    Raises
    ------
    ValueError
        If `iterable` is an iterator (because the current implementation of
        this function would consume an element from the iterator).

    Examples
    --------
    Arbitrary elements from common Iterable objects:

    >>> nx.utils.arbitrary_element([1, 2, 3])  # list
    1
    >>> nx.utils.arbitrary_element((1, 2, 3))  # tuple
    1
    >>> nx.utils.arbitrary_element({1, 2, 3})  # set
    1
    >>> d = {k: v for k, v in zip([1, 2, 3], [3, 2, 1])}
    >>> nx.utils.arbitrary_element(d)  # dict_keys
    1
    >>> nx.utils.arbitrary_element(d.values())  # dict values
    3

    `str` is also an Iterable:

    >>> nx.utils.arbitrary_element("hello")
    'h'

    :exc:`ValueError` is raised if `iterable` is an iterator:

    >>> iterator = iter([1, 2, 3])  # Iterator, *not* Iterable
    >>> nx.utils.arbitrary_element(iterator)
    Traceback (most recent call last):
        ...
    ValueError: cannot return an arbitrary item from an iterator

    Notes
    -----
    This function does not return a *random* element. If `iterable` is
    ordered, sequential calls will return the same value::

        >>> l = [1, 2, 3]
        >>> nx.utils.arbitrary_element(l)
        1
        >>> nx.utils.arbitrary_element(l)
        1

    z0cannot return an arbitrary item from an iterator)r   r   r%   ÚnextÚiter)Úiterables    r    r   r   ’   s*   € ô~ �(œHÔ%ÜÐKÓLÐLä”�X“ÓÐr!   c                 ó„   — t        | «      \  }}t        |d«      }|du rt        |t        ||f«      «      S t        ||«      S )z&s -> (s0, s1), (s1, s2), (s2, s3), ...NT)r	   rL   r<   r   )rN   ÚcyclicrF   ÚbÚfirsts        r    r   r   Ø   sC   € äˆx‹=�D€A€qÜ��D‹M€EØ��~Ü�1”e˜A ˜xÓ(Ó)Ð)Üˆq�!‹9Ðr!   c                 óŽ   — t        t        «      }| j                  «       D ]  \  }}||   j                  |«       Œ t	        |«      S )aÿ  Converts a many-to-one mapping into a one-to-many mapping.

    `many_to_one` must be a dictionary whose keys and values are all
    :term:`hashable`.

    The return value is a dictionary mapping values from `many_to_one`
    to sets of keys from `many_to_one` that have that value.

    Examples
    --------
    >>> from networkx.utils import groups
    >>> many_to_one = {"a": 1, "b": 1, "c": 2, "d": 3, "e": 3}
    >>> groups(many_to_one)  # doctest: +SKIP
    {1: {'a', 'b'}, 2: {'c'}, 3: {'e', 'd'}}
    )r   r7   r9   Úaddr;   )Úmany_to_oneÚone_to_manyrD   rC   s       r    r   r   á   sG   € ô  œcÓ"€KØ×!Ñ!Ó#ò ‰ˆˆ1Ø�A‰×Ñ˜1Õðä�ÓÐr!   c                 óh  — ddl }| �| |j                  u r |j                  j                  j                  S t	        | |j                  j
                  «      r| S t	        | t        «      r|j                  j                  | «      S t	        | |j                  j                  «      r| S | › d�}t        |«      ‚)a  Returns a numpy.random.RandomState or numpy.random.Generator instance
    depending on input.

    Parameters
    ----------
    random_state : int or NumPy RandomState or Generator instance, optional (default=None)
        If int, return a numpy.random.RandomState instance set with seed=int.
        if `numpy.random.RandomState` instance, return it.
        if `numpy.random.Generator` instance, return it.
        if None or numpy.random, return the global random number generator used
        by numpy.random.
    r   NzW cannot be used to create a numpy.random.RandomState or
numpy.random.Generator instance)	r6   ÚrandomÚmtrandÚ_randr   ÚRandomStater$   Ú	Generatorr%   ©Úrandom_staterA   Úmsgs      r    r   r   ÷   s¡   € ó àÐ˜|¨r¯y©yÑ8Ø�y‰y×Ñ×%Ñ%Ð%Ü�, §	¡	× 5Ñ 5Ô6ØÐÜ�,¤Ô$Ø�y‰y×$Ñ$ \Ó2Ð2Ü�, §	¡	× 3Ñ 3Ô4ØÐàˆ.ð *ð 	*ð ô �S‹/Ðr!   c                   ó6   — e Zd ZdZd	d„Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)
r   aÃ  Provide the random.random algorithms using a numpy.random bit generator

    The intent is to allow people to contribute code that uses Python's random
    library, but still allow users to provide a single easily controlled random
    bit-stream for all work with NetworkX. This implementation is based on helpful
    comments and code from Robert Kern on NumPy's GitHub Issue #24458.

    This implementation supersedes that of `PythonRandomInterface` which rewrote
    methods to account for subtle differences in API between `random` and
    `numpy.random`. Instead this subclasses `random.Random` and overwrites
    the methods `random`, `getrandbits`, `getstate`, `setstate` and `seed`.
    It makes them use the rng values from an input numpy `RandomState` or `Generator`.
    Those few methods allow the rest of the `random.Random` methods to provide
    the API interface of `random.random` while using randomness generated by
    a numpy generator.
    Nc                 óÞ   — 	 dd l }|€-j
                  j                  j                  | _        d | _	        y || _        d | _	        y # t        $ r d}t        j                  |t        «       Y Œew xY w©Nr   z.numpy not found, only random.random available.)
r6   ÚImportErrorÚwarningsÚwarnÚImportWarningrX   rY   rZ   Ú_rngÚ
gauss_next©ÚselfÚrngrA   r_   s       r    Ú__init__z!PythonRandomViaNumpyBits.__init__'  sg   € ð	.Ûð
 ˆ;ØŸ	™	×(Ñ(×.Ñ.ˆDŒIð ˆ�ð	 ˆDŒIð ˆ�øô ò 	.ØBˆCÜ�M‰M˜#œ}Ö-ð	.ús   ‚A Á%A,Á+A,c                 ó6   — | j                   j                  «       S )z7Get the next random number in the range 0.0 <= X < 1.0.©rg   rX   ©rj   s    r    rX   zPythonRandomViaNumpyBits.random7  s   € à�y‰y×ÑÓ!Ð!r!   c                 ó¦   — |dk  rt        d«      ‚|dz   dz  }t        j                  | j                  j	                  |«      d«      }||dz  |z
  z	  S )z:getrandbits(k) -> x.  Generates an int with k random bits.r   z#number of bits must be non-negativeé   é   Úbig)r%   r$   Ú
from_bytesrg   Úbytes)rj   rC   ÚnumbytesÚxs       r    Úgetrandbitsz$PythonRandomViaNumpyBits.getrandbits;  sS   € àˆqŠ5ÜÐBÓCÐCØ˜‘E˜a‘<ˆÜ�N‰N˜4Ÿ9™9Ÿ?™?¨8Ó4°eÓ<ˆØ�X ‘\ AÑ%Ñ&Ð&r!   c                 ó6   — | j                   j                  «       S ©N)rg   Ú__getstate__ro   s    r    Úgetstatez!PythonRandomViaNumpyBits.getstateC  s   € Ø�y‰y×%Ñ%Ó'Ð'r!   c                 ó:   — | j                   j                  |«       y rz   )rg   Ú__setstate__)rj   Ústates     r    Úsetstatez!PythonRandomViaNumpyBits.setstateF  s   € Ø�	‰	×Ñ˜uÕ%r!   c                 ó   — t        d«      ‚)zDo nothing override method.z2seed() not implemented in PythonRandomViaNumpyBits)ÚNotImplementedError)rj   ÚargsÚkwdss      r    ÚseedzPythonRandomViaNumpyBits.seedI  s   € ä!Ð"VÓWÐWr!   rz   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__rl   rX   rx   r|   r€   r…   © r!   r    r   r     s&   „ ñó"ò "ò'ò(ò&óXr!   r   c                   óV   — e Zd ZdZdd„Zd„ Zd„ Zdd„Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zy)r   z{PythonRandomInterface is included for backward compatibility
    New code should use PythonRandomViaNumpyBits instead.
    Nc                 óÂ   — 	 dd l }|€&j
                  j                  j                  | _        y || _        y # t        $ r d}t        j                  |t        «       Y ŒWw xY wrb   )	r6   rc   rd   re   rf   rX   rY   rZ   rg   ri   s       r    rl   zPythonRandomInterface.__init__T  sS   € ð	.Ûð
 ˆ;ØŸ	™	×(Ñ(×.Ñ.ˆD�IàˆD�Iøô ò 	.ØBˆCÜ�M‰M˜#œ}Ö-ð	.ús   ‚6 ¶%AÁAc                 ó6   — | j                   j                  «       S rz   rn   ro   s    r    rX   zPythonRandomInterface.random`  s   € Ø�y‰y×ÑÓ!Ð!r!   c                 óH   — |||z
  | j                   j                  «       z  z   S rz   rn   )rj   rF   rQ   s      r    ÚuniformzPythonRandomInterface.uniformc  s#   € Ø�A˜‘E˜TŸY™Y×-Ñ-Ó/Ñ/Ñ/Ð/r!   c                 ó2  — dd l }|€d|}}|dkD  r't        | j                  «      }|j                  ||«      S t	        | j                  |j
                  j                  «      r| j                  j                  ||«      S | j                  j                  ||«      S )Nr   ì   ÿÿÿÿ )	r6   r   rg   Ú	randranger   rX   r\   ÚintegersÚrandint©rj   rF   rQ   rA   Útmp_rngs        r    r’   zPythonRandomInterface.randrangef  sƒ   € Ûàˆ9Ø�aˆqˆAØÐ"Ò"Ü.¨t¯y©yÓ9ˆGØ×$Ñ$ Q¨Ó*Ð*ä�d—i‘i §¡×!4Ñ!4Ô5Ø—9‘9×%Ñ% a¨Ó+Ð+Ø�y‰y× Ñ   AÓ&Ð&r!   c                 ó  — dd l }t        | j                  |j                  j                  «      r*| j                  j                  dt        |«      «      }||   S | j                  j                  dt        |«      «      }||   S )Nr   )r6   r   rg   rX   r\   r“   r>   r”   )rj   ÚseqrA   Úidxs       r    ÚchoicezPythonRandomInterface.choiceu  sg   € Ûä�d—i‘i §¡×!4Ñ!4Ô5Ø—)‘)×$Ñ$ Q¬¨C«Ó1ˆCð �3‰xˆð —)‘)×#Ñ# A¤s¨3£xÓ0ˆCØ�3‰xˆr!   c                 ó:   — | j                   j                  ||«      S rz   )rg   Únormal)rj   ÚmuÚsigmas      r    ÚgausszPythonRandomInterface.gauss~  s   € Ø�y‰y×Ñ  EÓ*Ð*r!   c                 ó8   — | j                   j                  |«      S rz   )rg   Úshuffle)rj   r˜   s     r    r¡   zPythonRandomInterface.shuffle�  s   € Ø�y‰y× Ñ  Ó%Ð%r!   c                 óR   — | j                   j                  t        |«      |fd¬«      S )NF)ÚsizeÚreplace)rg   rš   r#   )rj   r˜   rC   s      r    ÚsamplezPythonRandomInterface.sample‡  s$   € Ø�y‰y×Ñ¤ S£	°°¸eÐÓDÐDr!   c                 ó2  — dd l }|dkD  r't        | j                  «      }|j                  ||«      S t	        | j                  |j
                  j                  «      r| j                  j                  ||dz   «      S | j                  j                  ||dz   «      S )Nr   r‘   é   )r6   r   rg   r”   r   rX   r\   r“   r•   s        r    r”   zPythonRandomInterface.randintŠ  s{   € ÛàÐ"Ò"Ü.¨t¯y©yÓ9ˆGØ—?‘? 1 aÓ(Ð(ä�d—i‘i §¡×!4Ñ!4Ô5Ø—9‘9×%Ñ% a¨¨Q©Ó/Ð/Ø�y‰y× Ñ   A¨¡EÓ*Ð*r!   c                 ó>   — | j                   j                  d|z  «      S )Nr§   )rg   Úexponential)rj   Úscales     r    Úexpovariatez!PythonRandomInterface.expovariate–  s   € Ø�y‰y×$Ñ$ Q¨¡YÓ/Ð/r!   c                 ó8   — | j                   j                  |«      S rz   )rg   Úpareto)rj   Úshapes     r    Úparetovariatez#PythonRandomInterface.paretovariateš  s   € Ø�y‰y×Ñ Ó&Ð&r!   rz   )r†   r‡   rˆ   r‰   rl   rX   r�   r’   rš   rŸ   r¡   r¥   r”   r«   r¯   rŠ   r!   r    r   r   O  s?   „ ñó
ò"ò0ó'òò+ò&òEò	+ò0ó'r!   r   c                 ó¦  — | �| t         u rt         j                  S t        | t         j                  «      r| S t        | t        «      rt        j                  | «      S 	 ddl}t        | t        t        z  «      r| S t        | |j                   j                  «      rt        | «      S | |j                   u r)t        |j                   j                  j                  «      S t        | |j                   j                  «      r8| |j                   j                  j                  u rt        | «      S t        | «      S | › d�}t        |«      ‚# t        $ r Y Œw xY w)a5  Returns a random.Random instance depending on input.

    Parameters
    ----------
    random_state : int or random number generator or None (default=None)
        - If int, return a `random.Random` instance set with seed=int.
        - If `random.Random` instance, return it.
        - If None or the `np.random` package, return the global random number
          generator used by `np.random`.
        - If an `np.random.Generator` instance, or the `np.random` package, or
          the global numpy random number generator, then return it.
          wrapped in a `PythonRandomViaNumpyBits` class.
        - If a `PythonRandomViaNumpyBits` instance, return it.
        - If a `PythonRandomInterface` instance, return it.
        - If a `np.random.RandomState` instance and not the global numpy default,
          return it wrapped in `PythonRandomInterface` for backward bit-stream
          matching with legacy code.

    Notes
    -----
    - A diagram intending to illustrate the relationships behind our support
      for numpy random numbers is called
      `NetworkX Numpy Random Numbers <https://excalidraw.com/#room=b5303f2b03d3af7ccc6a,e5ZDIWdWWCTTsg8OqoRvPA>`_.
    - More discussion about this support also appears in
      `gh-6869#comment <https://github.com/networkx/networkx/pull/6869#issuecomment-1944799534>`_.
    - Wrappers of numpy.random number generators allow them to mimic the Python random
      number generation algorithms. For example, Python can create arbitrarily large
      random ints, and the wrappers use Numpy bit-streams with CPython's random module
      to choose arbitrarily large random integers too.
    - We provide two wrapper classes:
      `PythonRandomViaNumpyBits` is usually what you want and is always used for
      `np.Generator` instances. But for users who need to recreate random numbers
      produced in NetworkX 3.2 or earlier, we maintain the `PythonRandomInterface`
      wrapper as well. We use it only used if passed a (non-default) `np.RandomState`
      instance pre-initialized from a seed. Otherwise the newer wrapper is used.
    Nr   z4 cannot be used to generate a random.Random instance)rX   Ú_instr   ÚRandomr$   r6   r   r   r\   rY   rZ   r[   rc   r%   r]   s      r    r   r   ©  s  € ðJ Ð˜|¬vÑ5Ü�|‰|ÐÜ�,¤§¡Ô.ØÐÜ�,¤Ô$Ü�}‰}˜\Ó*Ð*ð7Ûô �lÔ$9Ô<TÑ$TÔUØÐÜ�l B§I¡I×$7Ñ$7Ô8Ü+¨LÓ9Ð9Ø˜2Ÿ9™9Ñ$Ü+¨B¯I©I×,<Ñ,<×,BÑ,BÓCÐCä�l B§I¡I×$9Ñ$9Ô:Ø˜rŸy™y×/Ñ/×5Ñ5Ñ5Ü/°Ó=Ð=ä(¨Ó6Ð6àˆNÐNÐ
O€CÜ
�S‹/Ðøô# ò Ùðús   ÁE Å	EÅEc                 óì   — t        | «      }t        |«      }	 t        |«      }t        |«      }||k(  S # t        t        f$ r1 t        j	                  |«      }t        j	                  |«      }Y ||k(  S w xY w)aU  Check if nodes are equal.

    Equality here means equal as Python objects.
    Node data must match if included.
    The order of nodes is not relevant.

    Parameters
    ----------
    nodes1, nodes2 : iterables of nodes, or (node, datadict) tuples

    Returns
    -------
    bool
        True if nodes are equal, False otherwise.
    )r#   r;   r%   r1   Úfromkeys)Únodes1Únodes2Únlist1Únlist2Úd1Úd2s         r    r   r   ë  ss   € ô  �&‹\€FÜ�&‹\€Fð#Ü�&‹\ˆÜ�&‹\ˆð �‰8€Oøô œ	Ð"ò #Ü�]‰]˜6Ó"ˆÜ�]‰]˜6Ó"‰Ø�‰8€Oð#ús   ˜3 ³9A3Á2A3c                 óV  — ddl m}  |t        «      } |t        «      }d}t        | «      D ]7  \  }}|d   |d   }}|dd g}	|||   v r||   |   |	z   }	|	||   |<   |	||   |<   Œ9 d}
t        |«      D ]7  \  }
}|d   |d   }}|dd g}	|||   v r||   |   |	z   }	|	||   |<   |	||   |<   Œ9 ||
k7  ry|j	                  «       D ]d  \  }}|j	                  «       D ]L  \  }}||vr  y|||   vr  y||   |   }|D ])  }	|j                  |	«      |j                  |	«      k7  sŒ'   y ŒN Œf y)aÕ  Check if edges are equal.

    Equality here means equal as Python objects.
    Edge data must match if included.
    The order of the edges is not relevant.

    Parameters
    ----------
    edges1, edges2 : iterables of with u, v nodes as
        edge tuples (u, v), or
        edge tuples with data dicts (u, v, d), or
        edge tuples with keys and data dicts (u, v, k, d)

    Returns
    -------
    bool
        True if edges are equal, False otherwise.
    r   )r   r§   é   NFT)Úcollectionsr   r;   r(   r9   Úcount)Úedges1Úedges2r   r¹   rº   Úc1ÚeÚurD   ÚdataÚc2rE   ÚnbrdictÚnbrÚdatalistÚ
d2datalists                   r    r   r     s–  € õ& (á	”TÓ	€BÙ	”TÓ	€BØ	
€BÜ˜6Ó"ò ‰ˆˆAØ�‰t�Q�q‘Tˆ1ˆØ�!�"�ˆwˆØ��1‘‰:Ø�a‘5˜‘8˜d‘?ˆDØˆˆ1‰ˆa‰Øˆˆ1‰ˆaŠðð 
€BÜ˜6Ó"ò ‰ˆˆAØ�‰t�Q�q‘Tˆ1ˆØ�!�"�ˆwˆØ��1‘‰:Ø�a‘5˜‘8˜d‘?ˆDØˆˆ1‰ˆa‰Øˆˆ1‰ˆaŠðð 
ˆR‚xØà—h‘h“jò 	!‰
ˆˆ7Ø$Ÿ]™]›_ò 	!‰MˆC�Ø˜‰{ÚØ˜"˜Q™%ÑÚØ˜A™˜s™ˆJØ ò !�Ø—>‘> $Ó'¨:×+;Ñ+;¸DÓ+AÓAÛ ñ!ñ	!ð	!ð r!   c                 ó    — | j                   |j                   k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S )a  Check if graphs are equal.

    Equality here means equal as Python objects (not isomorphism).
    Node, edge and graph data must match.

    Parameters
    ----------
    graph1, graph2 : graph

    Returns
    -------
    bool
        True if graphs are equal, False otherwise.
    )ÚadjÚnodesÚgraph)Úgraph1Úgraph2s     r    r   r   =  sC   € ð  	�
‰
�f—j‘jÑ ò 	)Ø�L‰L˜FŸL™LÑ(ò	)à�L‰L˜FŸL™LÑ(ðr!   c                 óD   — t        | dd«      x}r|j                  «        yy)z—Clear the cache of a graph (currently stores converted graphs).

    Caching is controlled via ``nx.config.cache_converted_graphs`` configuration.
    Ú__networkx_cache__N)ÚgetattrÚclear)ÚGÚcaches     r    r   r   S  s'   € ô
 ˜Ð/°Ó6Ð6€uÐ6Ø�‰�ð 7r!   )ÚdirectedÚ
multigraphÚdefaultc                óÊ  — |€t         j                  }| �| n|}t        |t        «      r|j	                  d«      n|j	                  «       }t        |t        «      r|j                  d«      n|j                  «       }|�2|r|st        j                  d«      ‚|s|rt        j                  d«      ‚|�2|r|st        j                  d«      ‚|s|rt        j                  d«      ‚|S )a!  Assert that create_using has good properties

    This checks for desired directedness and multi-edge properties.
    It returns `create_using` unless that is `None` when it returns
    the optionally specified default value.

    Parameters
    ----------
    create_using : None, graph class or instance
        The input value of create_using for a function.
    directed : None or bool
        Whether to check `create_using.is_directed() == directed`.
        If None, do not assert directedness.
    multigraph : None or bool
        Whether to check `create_using.is_multigraph() == multigraph`.
        If None, do not assert multi-edge property.
    default : None or graph class
        The graph class to return if create_using is None.

    Returns
    -------
    create_using : graph class or instance
        The provided graph class or instance, or if None, the `default` value.

    Raises
    ------
    NetworkXError
        When `create_using` doesn't match the properties specified by `directed`
        or `multigraph` parameters.
    Nzcreate_using must be directedz!create_using must not be directedz"create_using must be a multi-graphz&create_using must not be a multi-graph)r&   ÚGraphr   ÚtypeÚis_directedÚis_multigraphr'   )Úcreate_usingrÖ   r×   rØ   rÔ   Ú
G_directedÚG_multigraphs          r    Úcheck_create_usingrá   \  sÊ   € ð> €Ü—(‘(ˆØ$Ð0‰°g€Aä(2°1´dÔ(;�—‘˜tÔ$ÀÇÁÃ€JÜ,6°q¼$Ô,?�1—?‘? 4Ô(ÀQÇ_Á_ÓEV€LàÐÙ™JÜ×"Ñ"Ð#BÓCÐCÙ™JÜ×"Ñ"Ð#FÓGÐGàÐÙ™lÜ×"Ñ"Ð#GÓHÐHÙ™lÜ×"Ñ"Ð#KÓLÐLØ€Hr!   rz   )F)$r‰   rX   ÚsysÚuuidrd   r½   r   r   Úcollections.abcr   r   r   Ú	itertoolsr   r	   Únetworkxr&   Ú__all__r
   r   r   r/   r2   r   r   r   r   r²   r   r   r   r   r   r   r   rá   rŠ   r!   r    ú<module>rè      s¨   ðñó Û 
Û Û ß *ß 5Ñ 5ß  ã ò€ó.ò!óH1óó.òB óLòó,ô<6X˜vŸ}™}ô 6X÷tL'ñ L'ót?òDò64ònò,ð 26À$ÐPTõ 1r!   