+
    &j                     &    ^ RI Ht  ! R R4      tR# )    )dequec                      a  ] tR t^t o RtR tR tR tR tR t	]
R 4       t]
R 4       tR	 tR
 tV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )DiGraphzReally 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                L    / V n         / V n        / V n        / V n        ^ V n        R# )r   N)_node_succ_pred_node_order_insertion_idxselfs   &n/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/package/_digraph.py__init__DiGraph.__init__   s+    
 

     c                *   WP                   9  da   W P                   V&   / V P                  V&   / V P                  V&   V P                  V P                  V&   V ;P                  ^,          un        R# V P                   V,          P                  V4       R# )zAdd 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_nodeDiGraph.add_node   sp     JJ"JJqMDJJqMDJJqM"&"5"5DQ1$JJqM  (r   c                    V P                  V4       V P                  V4       RV P                  V,          V&   RV P                  V,          V&   R# )zrAdd 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_edgeDiGraph.add_edge*   sB     	aa  

1a

1ar   c                     \        V P                  V,          4      #   \         d   p\        RT R24      ThRp?ii ; i)z.Returns an iterator over successor nodes of n.	The node  is not in the digraph.N)iterr   KeyError
ValueErrorr   r   es   && r   
successorsDiGraph.successors7   D    	L

1&& 	Ly+BCD!K	L    >9>c                     \        V P                  V,          4      #   \         d   p\        RT R24      ThRp?ii ; i)z1Returns an iterator over predecessors nodes of n.r   r   N)r    r	   r!   r"   r#   s   && r   predecessorsDiGraph.predecessors>   r'   r(   c              #  p   "   V P                   P                  4        F  w  rV F  pW3x  K
  	  K  	  R# 5i)z6Returns an iterator over all edges (u, v) in the graphN)r   items)r   r   r%   succs   &   r   edgesDiGraph.edgesE   s1      "ZZ--/MA"g # 0s   46c                    V P                   # )z6Returns a dictionary of all nodes to their attributes.)r   r   s   &r   nodesDiGraph.nodesL   s     zzr   c                ,    \        V P                  4      # )zIterate over the nodes.)r    r   r   s   &r   __iter__DiGraph.__iter__Q   s    DJJr   c                D     WP                   9   #   \         d     R# i ; i)z>Returns True if ``n`` is a node in the graph, False otherwise.F)r   	TypeError)r   r   s   &&r   __contains__DiGraph.__contains__U   s%    	

?" 		s    c                6   < V ^8  d   QhRS[ RS[S[ ,          /#    srcreturnstrset)format__classdict__s   "r   __annotate__DiGraph.__annotate__\   s      c c#h r   c                    \        V4      p\        V4      p\        V4      ^ 8  dU   VP                  4       pV P	                  V4       F-  pWR9  g   K  VP                  V4       VP                  V4       K/  	  Kd  V# )z2Returns a set of nodes that are reachable from src)rB   r   lenpopleftr%   addappendr   r>   resultworking_setcurr   s   &&    r   forward_transitive_closure"DiGraph.forward_transitive_closure\   si     SCj+"%%'C__S)?JJqM&&q) * r   c                6   < V ^8  d   QhRS[ RS[S[ ,          /# r<   r@   )rC   rD   s   "r   rE   rF   i   s      s s3x r   c                    \        V4      p\        V4      p\        V4      ^ 8  dU   VP                  4       pV P	                  V4       F-  pWR9  g   K  VP                  V4       VP                  V4       K/  	  Kd  V# )zGReturns a set of nodes that are reachable from src in reverse direction)rB   r   rH   rI   r*   rJ   rK   rL   s   &&    r   backward_transitive_closure#DiGraph.backward_transitive_closurei   sk     SCj+"%%'C&&s+?JJqM&&q) , r   c                &   < V ^8  d   QhRS[ RS[ /# )r=   r>   dstrA   )rC   rD   s   "r   rE   rF   v   s     % %S %s %r   c                F   \        4       pV P                  V4      pW$9  d   V# \        V4      p\        V4      ^ 8  dU   VP	                  4       pV P                  V4       F-  pWt9   g   K  VP                  Wv4       VP                  V4       K/  	  Kd  VP                  4       # )zAReturns a subgraph rooted at src that shows all the paths to dst.)	r   rP   r   rH   rI   r*   r   rK   to_dot)r   r>   rW   result_graphforward_reachable_from_srcrN   rO   r   s   &&&     r   	all_pathsDiGraph.all_pathsv   s     y%)%D%DS%I"0
 Cj+"%%'C&&s+2 ))!1&&q)	 , ""$$r   c                6   < V ^8  d   QhRS[ RS[S[ ,          /# )r=   rW   r?   )rA   list)rC   rD   s   "r   rE   rF      s     $ $c $d3i $r   c                $   . pV'       dt   VP                  V4       V P                  V,          P                  4       pRRrAV F6  pV P                  P	                  VR4      pVf    Ke  Ve	   Wd8  g   K2  TpTpK8  	  K{  \        \        V4      4      # )z_Returns a list of nodes that show the first path that resulted in dst being added to the graph. N)rK   r	   keysr
   getr`   reversed)r   rW   path
candidatesmin_idx	candidateidxs   &&     r   
first_pathDiGraph.first_path   s    KKC--/Jt'	&&**9d;;?cm!G#C ( HTN##r   c                    < V ^8  d   QhRS[ /# )r=   r?   rX   )rC   rD   s   "r   rE   rF      s       r   c                R    RP                  R V P                   4       4      pRV R2# )z^Returns the dot representation of the graph.

Returns:
    A dot representation of the graph.

c              3   8   "   T F  w  rR V RV R2x  K  	  R# 5i)"z" -> "z";N ).0fts   &  r   	<genexpr>!DiGraph.to_dot.<locals>.<genexpr>   s!     DAaSqc,s   z,digraph G {
rankdir = LR;
node [shape=box];
z
}
)joinr/   )r   r/   s   & r   rZ   DiGraph.to_dot   s7     		DDD  	 	r   )r   r   r
   r	   r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r%   r*   propertyr/   r2   r5   r9   rP   rT   r]   rk   rZ   __static_attributes____classdictcell__)rD   s   @r   r   r      s      )  LL       % %0$ $$ r   r   N)collectionsr   r   rr   r   r   <module>r      s    h hr   