U
    9vf3  ã                   @   s4   d Z ddlZddlmZ dgZedƒddd„ƒZdS )a–  Generators for cographs

A cograph is a graph containing no path on four vertices.
Cographs or $P_4$-free graphs can be obtained from a single vertex
by disjoint union and complementation operations.

References
----------
.. [0] D.G. Corneil, H. Lerchs, L.Stewart Burlingham,
    "Complement reducible graphs",
    Discrete Applied Mathematics, Volume 3, Issue 3, 1981, Pages 163-174,
    ISSN 0166-218X.
é    N)Úpy_random_stateÚrandom_cographé   c                    s^   t  d¡‰ t| ƒD ]F}t  ˆ  ¡ ‡ fdd„¡}| dd¡dkrLt  ˆ |¡‰ qt  ˆ |¡‰ qˆ S )aô  Returns a random cograph with $2 ^ n$ nodes.

    A cograph is a graph containing no path on four vertices.
    Cographs or $P_4$-free graphs can be obtained from a single vertex
    by disjoint union and complementation operations.

    This generator starts off from a single vertex and performs disjoint
    union and full join operations on itself.
    The decision on which operation will take place is random.

    Parameters
    ----------
    n : int
            The order of the cograph.
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.

    Returns
    -------
    G : A random graph containing no path on four vertices.

    See Also
    --------
    full_join
    union

    References
    ----------
    .. [1] D.G. Corneil, H. Lerchs, L.Stewart Burlingham,
       "Complement reducible graphs",
       Discrete Applied Mathematics, Volume 3, Issue 3, 1981, Pages 163-174,
       ISSN 0166-218X.
    r   c                    s   | t ˆ ƒ S )N)Úlen)Úx©ÚR© ú@/tmp/pip-unpacked-wheel-_lngutwb/networkx/generators/cographs.pyÚ<lambda>;   ó    z random_cograph.<locals>.<lambda>r   )ÚnxZempty_graphÚrangeZrelabel_nodesÚcopyÚrandintZ	full_joinZdisjoint_union)ÚnÚseedÚiZRRr	   r   r
   r      s    $
)N)Ú__doc__Znetworkxr   Znetworkx.utilsr   Ú__all__r   r	   r	   r	   r
   Ú<module>   s
   