U
    ¹mœd;  ã                   @   sF   d Z ddlZddlmZ ddlmZ dgZedƒedƒd	d„ ƒƒZdS )
z
Ramsey numbers.
é    N)Únot_implemented_foré   )Úarbitrary_elementÚ	ramsey_R2ZdirectedZ
multigraphc                    sš   | st ƒ t ƒ fS t| ƒ‰ ‡ fdd„t | ˆ ¡D ƒ}t | ˆ ¡}t|  |¡ ¡ ƒ\}}t|  |¡ ¡ ƒ\}}| ˆ ¡ | ˆ ¡ t	||t
d�t	||t
d�fS )aH  Compute the largest clique and largest independent set in `G`.

    This can be used to estimate bounds for the 2-color
    Ramsey number `R(2;s,t)` for `G`.

    This is a recursive implementation which could run into trouble
    for large recursions. Note that self-loop edges are ignored.

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

    Returns
    -------
    max_pair : (set, set) tuple
        Maximum clique, Maximum independent set.

    Raises
    ------
    NetworkXNotImplemented
        If the graph is directed or is a multigraph.
    c                 3   s   | ]}|ˆ kr|V  qd S )N© )Ú.0Znbr©Únoder   úa/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/networkx/algorithms/approximation/ramsey.pyÚ	<genexpr>*   s      zramsey_R2.<locals>.<genexpr>)Úkey)Úsetr   ÚnxZall_neighborsZnon_neighborsr   ZsubgraphÚcopyÚaddÚmaxÚlen)ÚGZnbrsZnnbrsZc_1Zi_1Zc_2Zi_2r   r   r
   r      s    

)	Ú__doc__Znetworkxr   Znetworkx.utilsr   Úutilsr   Ú__all__r   r   r   r   r
   Ú<module>   s   