§
    bŠtj%
  ã                   óŒ   — d dl Z d dlZd dlmZ dgZej         ed¦  «         ed¦  «        d„ ¦   «         ¦   «         ¦   «         ZdS )é    N)Únot_implemented_forÚis_perfect_graphÚdirectedÚ
multigraphc                 óÈ   — t          d„ t          j        t          j        | ¦  «        t          j        t          j        | ¦  «        ¦  «        ¦  «        D ¦   «         ¦  «         S )ui  Return True if G is a perfect graph, else False.

    A graph G is perfect if, for every induced subgraph H of G, the chromatic
    number of H equals the size of the largest clique in H.

    According to the **Strong Perfect Graph Theorem (SPGT)**:
    A graph is perfect if and only if neither the graph G nor its complement
    :math:`\overline{G}` contains an **induced odd hole** â€” an induced cycle of
    odd length at least five without chords.

    Parameters
    ----------
    G : NetworkX Graph
        The graph to check. Must be a finite, simple, undirected graph.

    Returns
    -------
    bool
        True if G is a perfect graph, else False.

    Notes
    -----
    This function uses a direct approach: cycle enumeration to detect
    chordless odd cycles in G and :math:`\overline{G}`. This implementation
    runs in exponential time in the worst case, since the number of chordless
    cycles can grow exponentially.

    The perfect-graph recognition problem is theoretically solvable in
    polynomial time. Chudnovsky *et al.* (2006) proved it can be solved in
    :math:`O(n^9)` time via a complex structural decomposition [1]_, [2]_.
    This implementation opts for a direct, transparent check rather than
    implementing that high-degree polynomial-time decomposition algorithm.

    See Also
    --------
    is_chordal, is_bipartite :
        Related checks for specific categories of perfect graphs, such as chordal
        graphs, and bipartite graphs.
    chordless_cycles :
        Used to detect "holes" in the graph

    References
    ----------
    .. [1] M. Chudnovsky, N. Robertson, P. Seymour, and R. Thomas,
           *The Strong Perfect Graph Theorem*,
           Annals of Mathematics, vol. 164, no. 1, pp. 51â€“229, 2006.
           https://doi.org/10.4007/annals.2006.164.51
    .. [2] M. Chudnovsky, G. CornuÃ©jols, X. Liu, P. Seymour, and K. VuÅ¡koviÄ‡,
           *Recognizing Berge Graphs*,
           Combinatorica 25(2): 143â€“186, 2005.
           DOI: 10.1007/s00493-005-0003-8
           Preprint available at:
           https://web.math.princeton.edu/~pds/papers/algexp/Bergealg.pdf
    c              3   óh   K  — | ]-}t          |¦  «        d k    ot          |¦  «        dz  dk    V — Œ.dS )é   é   é   N)Úlen)Ú.0Úcs     ú_/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/algorithms/perfect_graph.pyú	<genexpr>z#is_perfect_graph.<locals>.<genexpr>D   sS   è è € ð ð àõ 
ˆQ‰Œ�1ŠÐ+�3˜q™6œ6 A™:¨š?ðð ð ð ð ð ó    )ÚanyÚ	itertoolsÚchainÚnxÚchordless_cyclesÚ
complement)ÚGs    r   r   r   	   si   € õv ð ð å”ÝÔ Ñ"Ô"¥BÔ$7½¼ÀaÑ8HÔ8HÑ$IÔ$Iñ
ô 
ðñ ô ñ ô ð ð r   )r   Únetworkxr   Únetworkx.utils.decoratorsr   Ú__all__Ú_dispatchabler   © r   r   ú<module>r      sŒ   ðØ Ð Ð Ð à Ð Ð Ð Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9àÐ
€ð ÔØÐ�ZÑ Ô ØÐ�\Ñ"Ô"ð=ð =ñ #Ô"ñ !Ô ñ Ôð=ð =ð =r   