§
    bŠtjò  ã                   óÖ   — d Z ddlZddlmZ ddgZ ed¦  «         ed¦  «         ej        d¬	¦  «        dd„¦   «         ¦   «         ¦   «         Z ej        dd¬¦  «        d„ ¦   «         ZdS )zTFunctions related to the Mycielski Operation and the Mycielskian family
of graphs.

é    N)Únot_implemented_forÚmycielskianÚmycielski_graphÚdirectedÚ
multigraphT)Úreturns_graphé   c                 ó  ‡— t          j        | ¦  «        }t          |¦  «        D ]å}|                     ¦   «         Š|                     t          ‰d‰z  ¦  «        ¦  «         t          |                     ¦   «         ¦  «        }|                     ˆfd„|D ¦   «         ¦  «         |                     ˆfd„|D ¦   «         ¦  «         |                     d‰z  ¦  «         |                     ˆfd„t          ‰¦  «        D ¦   «         ¦  «         Œæ|S )a^  Returns the Mycielskian of a simple, undirected graph G

    The Mycielskian of graph preserves a graph's triangle free
    property while increasing the chromatic number by 1.

    The Mycielski Operation on a graph, :math:`G=(V, E)`, constructs a new
    graph with :math:`2|V| + 1` nodes and :math:`3|E| + |V|` edges.

    The construction is as follows:

    Let :math:`V = {0, ..., n-1}`. Construct another vertex set
    :math:`U = {n, ..., 2n}` and a vertex, `w`.
    Construct a new graph, `M`, with vertices :math:`U \bigcup V \bigcup w`.
    For edges, :math:`(u, v) \in E` add edges :math:`(u, v), (u, v + n)`, and
    :math:`(u + n, v)` to M. Finally, for all vertices :math:`u \in U`, add
    edge :math:`(u, w)` to M.

    The Mycielski Operation can be done multiple times by repeating the above
    process iteratively.

    More information can be found at https://en.wikipedia.org/wiki/Mycielskian

    Parameters
    ----------
    G : graph
        A simple, undirected NetworkX graph
    iterations : int
        The number of iterations of the Mycielski operation to
        perform on G. Defaults to 1. Must be a non-negative integer.

    Returns
    -------
    M : graph
        The Mycielskian of G after the specified number of iterations.

    Notes
    -----
    Graph, node, and edge data are not necessarily propagated to the new graph.

    é   c              3   ó,   •K  — | ]\  }}||‰z   fV — Œd S ©N© ©Ú.0ÚuÚvÚns      €ú[/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/generators/mycielski.pyú	<genexpr>zmycielskian.<locals>.<genexpr>?   s/   øè è € Ð:Ð:©¨¨1˜!˜Q ™U˜Ð:Ð:Ð:Ð:Ð:Ð:ó    c              3   ó,   •K  — | ]\  }}|‰z   |fV — Œd S r   r   r   s      €r   r   zmycielskian.<locals>.<genexpr>@   s/   øè è € Ð:Ð:©¨¨1˜!˜a™% ˜Ð:Ð:Ð:Ð:Ð:Ð:r   c              3   ó,   •K  — | ]}|‰z   d ‰z  fV — ŒdS )r   Nr   )r   r   r   s     €r   r   zmycielskian.<locals>.<genexpr>B   s/   øè è € Ð:Ð:¨A˜!˜a™%  Q¡˜Ð:Ð:Ð:Ð:Ð:Ð:r   )	ÚnxÚconvert_node_labels_to_integersÚrangeÚnumber_of_nodesÚadd_nodes_fromÚlistÚedgesÚadd_edges_fromÚadd_node)ÚGÚ
iterationsÚMÚiÚ	old_edgesr   s        @r   r   r      s  ø€ õZ 	Ô*¨1Ñ-Ô-€Aå�:ÑÔð ;ð ;ˆØ×ÒÑÔˆØ	×Ò�˜q ! a¡%™œÑ)Ô)Ð)Ý˜Ÿš™œ‘O”Oˆ	Ø	×ÒÐ:Ð:Ð:Ð:°	Ð:Ñ:Ô:Ñ:Ô:Ð:Ø	×ÒÐ:Ð:Ð:Ð:°	Ð:Ñ:Ô:Ñ:Ô:Ð:Ø	�
Š
�1�q‘5ÑÔÐØ	×ÒÐ:Ð:Ð:Ð:µ°q±´Ð:Ñ:Ô:Ñ:Ô:Ð:Ð:à€Hr   )Úgraphsr   c                 ó´   — | dk     rt          j        d¦  «        ‚| dk    rt          j        d¦  «        S t          t          j        d¦  «        | dz
  ¦  «        S )a‡  Generator for the n_th Mycielski Graph.

    The Mycielski family of graphs is an infinite set of graphs.
    :math:`M_1` is the singleton graph, :math:`M_2` is two vertices with an
    edge, and, for :math:`i > 2`, :math:`M_i` is the Mycielskian of
    :math:`M_{i-1}`.

    More information can be found at
    http://mathworld.wolfram.com/MycielskiGraph.html

    Parameters
    ----------
    n : int
        The desired Mycielski Graph.

    Returns
    -------
    M : graph
        The n_th Mycielski Graph

    Notes
    -----
    The first graph in the Mycielski sequence is the singleton graph.
    The Mycielskian of this graph is not the :math:`P_2` graph, but rather the
    :math:`P_2` graph with an extra, isolated vertex. The second Mycielski
    graph is the :math:`P_2` graph, so the first two are hard coded.
    The remaining graphs are generated using the Mycielski operation.

    r	   zmust satisfy n >= 1r   )r   ÚNetworkXErrorÚempty_graphr   Ú
path_graph)r   s    r   r   r   G   sY   € ð@ 	ˆ1‚u€uÝÔÐ4Ñ5Ô5Ð5àˆA‚v€vÝŒ~˜aÑ Ô Ð õ �2œ=¨Ñ+Ô+¨Q°©UÑ3Ô3Ð3r   )r	   )	Ú__doc__Únetworkxr   Únetworkx.utilsr   Ú__all__Ú_dispatchabler   r   r   r   r   ú<module>r1      sÐ   ððð ð
 Ð Ð Ð Ø .Ð .Ð .Ð .Ð .Ð .àÐ+Ð
,€ð Ð�ZÑ Ô ØÐ�\Ñ"Ô"Ø€Ô Ð%Ñ%Ô%ð5ð 5ð 5ñ &Ô%ñ #Ô"ñ !Ô ð5ðp €Ô˜¨TÐ2Ñ2Ô2ð&4ð &4ñ 3Ô2ð&4ð &4ð &4r   