§
    bŠtjÿ  ã                   ó‚   — d Z ddlZddlZddlmZ dgZ ed¦  «         ej        d¬¦  «        d„ ¦   «         ¦   «         ZdS )	z;Function for computing the moral graph of a directed graph.é    N)Únot_implemented_forÚmoral_graphÚ
undirectedT)Úreturns_graphc                 ó¼   — |                       ¦   «         }| j                             ¦   «         D ]-}t          j        |d¬¦  «        }|                     |¦  «         Œ.|S )a  Return the Moral Graph

    Returns the moralized graph of a given directed graph.

    Parameters
    ----------
    G : NetworkX graph
        Directed graph

    Returns
    -------
    H : NetworkX graph
        The undirected moralized graph of G

    Raises
    ------
    NetworkXNotImplemented
        If `G` is undirected.

    Examples
    --------
    >>> G = nx.DiGraph([(1, 2), (2, 3), (2, 5), (3, 4), (4, 3)])
    >>> G_moral = nx.moral_graph(G)
    >>> G_moral.edges()
    EdgeView([(1, 2), (2, 3), (2, 5), (2, 4), (3, 4)])

    Notes
    -----
    A moral graph is an undirected graph H = (V, E) generated from a
    directed Graph, where if a node has more than one parent node, edges
    between these parent nodes are inserted and all directed edges become
    undirected.

    https://en.wikipedia.org/wiki/Moral_graph

    References
    ----------
    .. [1] Wray L. Buntine. 1995. Chain graphs for learning.
           In Proceedings of the Eleventh conference on Uncertainty
           in artificial intelligence (UAI'95)
    é   )Úr)Úto_undirectedÚpredÚvaluesÚ	itertoolsÚcombinationsÚadd_edges_from)ÚGÚHÚpredsÚpredecessors_combinationss       úW/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/algorithms/moral.pyr   r      s`   € ðX 	
�ŠÑÔ€AØ”—’‘”ð 4ð 4ˆÝ$-Ô$:¸5ÀAÐ$FÑ$FÔ$FÐ!Ø	×ÒÐ2Ñ3Ô3Ð3Ð3Ø€Hó    )	Ú__doc__r   ÚnetworkxÚnxÚnetworkx.utilsr   Ú__all__Ú_dispatchabler   © r   r   ú<module>r      sˆ   ðØ BÐ Bà Ð Ð Ð à Ð Ð Ð Ø .Ð .Ð .Ð .Ð .Ð .àˆ/€ð Ð�\Ñ"Ô"Ø€Ô Ð%Ñ%Ô%ð.ð .ñ &Ô%ñ #Ô"ð.ð .ð .r   