Ë
    D^(hz  ã                   óŽ   — d Z ddlmZ ddlZddlmZ ddgZ ed«      ej                  d„ «       «       Z	ej                  d	„ «       Z
y)
z
Dominance algorithms.
é    )ÚreduceN)Únot_implemented_forÚimmediate_dominatorsÚdominance_frontiersÚ
undirectedc                 ó¤  ‡‡	— || vrt        j                  d«      ‚||iŠ	t        t        j                  | |«      «      }t	        |«      D ��ci c]  \  }}||“Œ
 c}}Š|j                  «        |j                  «        ˆˆ	fd„}d}|rBd}|D ]8  }t        |ˆ	fd„| j                  |   D «       «      }|‰	vs	‰	|   |k7  sŒ2|‰	|<   d}Œ: |rŒB‰	S c c}}w )a1  Returns the immediate dominators of all nodes of a directed graph.

    Parameters
    ----------
    G : a DiGraph or MultiDiGraph
        The graph where dominance is to be computed.

    start : node
        The start node of dominance computation.

    Returns
    -------
    idom : dict keyed by nodes
        A dict containing the immediate dominators of each node reachable from
        `start`.

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

    NetworkXError
        If `start` is not in `G`.

    Notes
    -----
    Except for `start`, the immediate dominators are the parents of their
    corresponding nodes in the dominator tree.

    Examples
    --------
    >>> G = nx.DiGraph([(1, 2), (1, 3), (2, 5), (3, 4), (4, 5)])
    >>> sorted(nx.immediate_dominators(G, 1).items())
    [(1, 1), (2, 1), (3, 1), (4, 3), (5, 1)]

    References
    ----------
    .. [1] Cooper, Keith D., Harvey, Timothy J. and Kennedy, Ken.
           "A simple, fast dominance algorithm." (2006).
           https://hdl.handle.net/1911/96345
    zstart is not in Gc                 óŽ   •— | |k7  r>‰|    ‰|   k  r‰|    } ‰|    ‰|   k  rŒ‰|    ‰|   kD  r‰|   }‰|    ‰|   kD  rŒ| |k7  rŒ>| S ©N© )ÚuÚvÚdfnÚidoms     €€ú[/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/networkx/algorithms/dominance.pyÚ	intersectz'immediate_dominators.<locals>.intersectC   sl   ø€ Ø�1ŠfØ�a‘&˜3˜q™6’/Ø˜‘G�ð �a‘&˜3˜q™6“/à�a‘&˜3˜q™6’/Ø˜‘G�ð �a‘&˜3˜q™6“/ð �1‹fð
 ˆó    TFc              3   ó,   •K  — | ]  }|‰v sŒ|–— Œ y ­wr
   r   )Ú.0r   r   s     €r   ú	<genexpr>z'immediate_dominators.<locals>.<genexpr>O   s   øè ø€ Ò)L°À!ÀtÂ)¬!Ñ)Lùs   ƒ	�)	ÚnxÚNetworkXErrorÚlistÚdfs_postorder_nodesÚ	enumerateÚpopÚreverser   Úpred)
ÚGÚstartÚorderÚir   r   ÚchangedÚnew_idomr   r   s
           @@r   r   r      sÜ   ù€ ðX �A�~Ü×ÑÐ2Ó3Ð3à�5ˆ>€Dä”×'Ñ'¨¨5Ó1Ó2€EÜ% eÓ,×
-‘D�A�qˆ1ˆa‰4Ó
-€CØ	‡I�I„KØ	‡M�M„Oõð €GÙ
ØˆØò 	ˆAÜ˜iÓ)L°Q·V±V¸A±YÔ)LÓMˆHØ˜‰}  Q¡¨8Ó 3Ø"��Q‘Ø‘ð		ò ð €Kùó+ .s   ÁCc                 ó:  — t        j                  | |«      }|D �ci c]  }|t        «       “Œ }}|D ]b  }t        | j                  |   «      dk\  sŒ| j                  |   D ]2  }||v sŒ|||   k7  sŒ||   j                  |«       ||   }|||   k7  rŒ"Œ4 Œd |S c c}w )aÌ  Returns the dominance frontiers of all nodes of a directed graph.

    Parameters
    ----------
    G : a DiGraph or MultiDiGraph
        The graph where dominance is to be computed.

    start : node
        The start node of dominance computation.

    Returns
    -------
    df : dict keyed by nodes
        A dict containing the dominance frontiers of each node reachable from
        `start` as lists.

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

    NetworkXError
        If `start` is not in `G`.

    Examples
    --------
    >>> G = nx.DiGraph([(1, 2), (1, 3), (2, 5), (3, 4), (4, 5)])
    >>> sorted((u, sorted(df)) for u, df in nx.dominance_frontiers(G, 1).items())
    [(1, []), (2, [5]), (3, [5]), (4, [5]), (5, [])]

    References
    ----------
    .. [1] Cooper, Keith D., Harvey, Timothy J. and Kennedy, Ken.
           "A simple, fast dominance algorithm." (2006).
           https://hdl.handle.net/1911/96345
    é   )r   r   ÚsetÚlenr   Úadd)r   r   r   r   Údfr   s         r   r   r   W   s­   € ôL ×"Ñ" 1 eÓ,€Dà Ö	!�qˆ!ŒS‹U‰(Ð	!€BÐ	!Øò $ˆÜˆq�v‰v�a‰y‹>˜QÓØ—V‘V˜A‘Yò $�Ø˜’9Ø˜t A™w›,Ø˜1™Ÿ	™	 !œØ  ™G˜ð ˜t A™wœ,ñ$ð$ð €Iùò 
"s   ›B)Ú__doc__Ú	functoolsr   Únetworkxr   Únetworkx.utilsr   Ú__all__Ú_dispatchabler   r   r   r   r   ú<module>r0      sd   ðñõ ã Ý .à!Ð#8Ð
9€ñ �\Ó"Ø×ÑñEó ó #ðEðP ×Ññ/ó ñ/r   