
    ިsgc                     n    d Z ddlZddlmZ dgZ ed       ej                  dd      d	d              Zy)
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   T)graphsreturns_graphc                 $   t        j                  d      t        |       D ]k  }t        j                  j	                         fd      }|j                  dd      dk(  rt        j                  |      Vt        j                  |      m 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                      | t              z   S N)len)xRs    O/var/www/html/venv/lib/python3.12/site-packages/networkx/generators/cographs.py<lambda>z random_cograph.<locals>.<lambda>=   s    !c!f*     r   )nxempty_graphrangerelabel_nodescopyrandint	full_joindisjoint_union)nseediRRr   s       @r   r   r      s|    J 	qA1X )affh(<=<<1"Q#A!!!R(A) Hr   r
   )__doc__networkxr   networkx.utilsr   __all___dispatchabler    r   r   <module>r#      sJ     *
 T2- 3 -r   