Ë
    [^(hþ  ã                   ó$   — d dl mZ  G d„ d«      Zy)é    )Údequec                   ó¸   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Ze	d„ «       Z
e	d„ «       Zd	„ Zd
„ Zdedee   fd„Zdedee   fd„Zdedefd„Zdedee   fd„Zdefd„Zy)ÚDiGraphz´Really simple unweighted directed graph data structure to track dependencies.

    The API is pretty much the same as networkx so if you add something just
    copy their API.
    c                 óJ   — i | _         i | _        i | _        i | _        d| _        y )Nr   )Ú_nodeÚ_succÚ_predÚ_node_orderÚ_insertion_idx©Úselfs    úT/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/package/_digraph.pyÚ__init__zDiGraph.__init__   s+   € àˆŒ
ð ˆŒ
àˆŒ
ð ˆÔØˆÕó    c                 ó  — || j                   vr\|| j                   |<   i | j                  |<   i | j                  |<   | j                  | j                  |<   | xj                  dz  c_        y| j                   |   j                  |«       y)zºAdd a node to the graph.

        Args:
            n: the node. Can we any object that is a valid dict key.
            **kwargs: any attributes you want to attach to the node.
        é   N)r   r   r	   r   r
   Úupdate)r   ÚnÚkwargss      r   Úadd_nodezDiGraph.add_node   st   € ð �D—J‘JÑØ"ˆD�J‰J�q‰MØˆD�J‰J�q‰MØˆD�J‰J�q‰MØ"&×"5Ñ"5ˆD×Ñ˜QÑØ×Ò 1Ñ$Öà�J‰J�q‰M× Ñ  Õ(r   c                 ó�   — | j                  |«       | j                  |«       d| j                  |   |<   d| j                  |   |<   y)z‚Add an edge to graph between nodes ``u`` and ``v``

        ``u`` and ``v`` will be created if they do not already exist.
        TN)r   r   r	   )r   ÚuÚvs      r   Úadd_edgezDiGraph.add_edge*   sB   € ð 	�‰�aÔØ�‰�aÔð  ˆ�
‰
�1‰�aÑØˆ�
‰
�1‰�aÒr   c                 óv   — 	 t        | j                  |   «      S # t        $ r}t        d|› d�«      |‚d}~ww xY w)z.Returns an iterator over successor nodes of n.ú	The node ú is not in the digraph.N)Úiterr   ÚKeyErrorÚ
ValueError©r   r   Úes      r   Ú
successorszDiGraph.successors7   óD   € ð	LÜ˜Ÿ
™
 1™Ó&Ð&øÜò 	LÜ˜y¨¨Ð+BÐCÓDÈ!ÐKûð	Lúó   ‚ š	8£3³8c                 óv   — 	 t        | j                  |   «      S # t        $ r}t        d|› d�«      |‚d}~ww xY w)z1Returns an iterator over predecessors nodes of n.r   r   N)r   r	   r   r    r!   s      r   ÚpredecessorszDiGraph.predecessors>   r$   r%   c              #   ój   K  — | j                   j                  «       D ]  \  }}|D ]  }||f–— Œ
 Œ y­w)z6Returns an iterator over all edges (u, v) in the graphN)r   Úitems)r   r   r#   Úsuccs       r   ÚedgeszDiGraph.edgesE   s@   è ø€ ð "ŸZ™Z×-Ñ-Ó/ò 	‰MˆAˆzØ"ò �Ø˜�g“ññ	ùs   ‚13c                 ó   — | j                   S )z6Returns a dictionary of all nodes to their attributes.)r   r   s    r   ÚnodeszDiGraph.nodesL   s   € ð �z‰zÐr   c                 ó,   — t        | j                  «      S )zIterate over the nodes.)r   r   r   s    r   Ú__iter__zDiGraph.__iter__Q   s   € ä�D—J‘JÓÐr   c                 ó>   — 	 || j                   v S # t        $ r Y yw xY w)z>Returns True if ``n`` is a node in the graph, False otherwise.F)r   Ú	TypeError)r   r   s     r   Ú__contains__zDiGraph.__contains__U   s'   € ð	Ø˜Ÿ
™
�?Ð"øÜò 	Ùð	ús   ‚ �	›ÚsrcÚreturnc                 ó  — t        |«      }t        |«      }t        |«      dkD  r\|j                  «       }| j	                  |«      D ])  }||vsŒ|j                  |«       |j                  |«       Œ+ t        |«      dkD  rŒ\|S )z2Returns a set of nodes that are reachable from srcr   )Úsetr   ÚlenÚpopleftr#   ÚaddÚappend©r   r3   ÚresultÚworking_setÚcurr   s         r   Úforward_transitive_closurez"DiGraph.forward_transitive_closure\   s   € ô �S“ˆÜ˜C“jˆÜ�+Ó Ò"Ø×%Ñ%Ó'ˆCØ—_‘_ SÓ)ò *�Ø˜F’?Ø—J‘J˜q”MØ×&Ñ& qÕ)ð*ô �+Ó Ó"ð ˆr   c                 ó  — t        |«      }t        |«      }t        |«      dkD  r\|j                  «       }| j	                  |«      D ])  }||vsŒ|j                  |«       |j                  |«       Œ+ t        |«      dkD  rŒ\|S )zGReturns a set of nodes that are reachable from src in reverse directionr   )r6   r   r7   r8   r'   r9   r:   r;   s         r   Úbackward_transitive_closurez#DiGraph.backward_transitive_closurei   s�   € ô �S“ˆÜ˜C“jˆÜ�+Ó Ò"Ø×%Ñ%Ó'ˆCØ×&Ñ& sÓ+ò *�Ø˜F’?Ø—J‘J˜q”MØ×&Ñ& qÕ)ð*ô �+Ó Ó"ð ˆr   Údstc                 óP  — t        «       }| j                  |«      }||vr|S t        |«      }t        |«      dkD  r]|j	                  «       }| j                  |«      D ]*  }||v sŒ|j                  ||«       |j                  |«       Œ, t        |«      dkD  rŒ]|j                  «       S )zAReturns a subgraph rooted at src that shows all the paths to dst.r   )	r   r?   r   r7   r8   r'   r   r:   Úto_dot)r   r3   rB   Úresult_graphÚforward_reachable_from_srcr=   r>   r   s           r   Ú	all_pathszDiGraph.all_pathsv   s²   € ô “yˆà%)×%DÑ%DÀSÓ%IÐ"àÐ0Ñ0ØÐô
 ˜C“jˆÜ�+Ó Ò"Ø×%Ñ%Ó'ˆCØ×&Ñ& sÓ+ò *�ØÐ2Ò2Ø ×)Ñ)¨!¨SÔ1à×&Ñ& qÕ)ð	*ô �+Ó Ó"ð ×"Ñ"Ó$Ð$r   c                 ó  — g }|ri|j                  |«       | j                  |   j                  «       }d\  }}|D ].  }| j                  j	                  |d«      }|€ n|�||k  sŒ+|}|}Œ0 |rŒit        t        |«      «      S )z_Returns a list of nodes that show the first path that resulted in dst being added to the graph.)Ú NN)r:   r	   Úkeysr
   ÚgetÚlistÚreversed)r   rB   ÚpathÚ
candidatesÚmin_idxÚ	candidateÚidxs          r   Ú
first_pathzDiGraph.first_pathŽ   s�   € àˆáØ�K‰K˜ÔØŸ™ C™×-Ñ-Ó/ˆJØ#‰LˆC�Ø'ò $�	Ø×&Ñ&×*Ñ*¨9°dÓ;�Ø�;ÙØ�? c¨G£mØ!�GØ#‘Cð$ò	 ô ”H˜T“NÓ#Ð#r   c                 óR   — dj                  d„ | j                  D «       «      }d|› d�S )zvReturns the dot representation of the graph.

        Returns:
            A dot representation of the graph.
        ú
c              3   ó4   K  — | ]  \  }}d |› d|› d�–— Œ y­w)ú"z" -> "z";N© )Ú.0ÚfÚts      r   ú	<genexpr>z!DiGraph.to_dot.<locals>.<genexpr>¦   s#   è ø€ ÒD±°°A˜A˜a˜S  q c¨Ô,ÑDùs   ‚z,digraph G {
rankdir = LR;
node [shape=box];
z
}
)Újoinr+   )r   r+   s     r   rD   zDiGraph.to_dot    s7   € ð —	‘	ÑD¸¿¹ÔDÓDˆðð €ð ð	ð 	r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r#   r'   Úpropertyr+   r-   r/   r2   Ústrr6   r?   rA   rG   rL   rS   rD   rX   r   r   r   r      s¸   „ ñò ò)ò  òLòLð ñó ðð ñó ðò òð¨cð °c¸#±hó ð¨sð °s¸3±xó ð%˜Sð % só %ð0$˜cð $ d¨3¡ió $ð$˜ô r   r   N)Úcollectionsr   r   rX   r   r   ú<module>re      s   ðå ÷hò hr   