
    z	iq                         S SK JrJr  \" S5      r " S S\5      r " S S\5      r " S S\\   5      r " S	 S
\\   5      r " S S\\   5      r	g)    )TypeVarGeneric_Tc                       \ rS rSrSrSrg)
StopSearch   zStop graph traversal N__name__
__module____qualname____firstlineno____doc____static_attributes__r	       I/home/james-whalen/.local/lib/python3.13/site-packages/rustworkx/visit.pyr   r      s    r   r   c                       \ rS rSrSrSrg)PruneSearch   z7Prune part of the search tree while traversing a graph.r	   Nr
   r	   r   r   r   r      s    Ar   r   c                   <    \ rS rSrSrS rS rS rS rS r	S r
S	rg
)
BFSVisitor   zA visitor object that is invoked at the event-points inside the
:func:`~rustworkx.bfs_search` algorithm. By default, it performs no
action, and should be used as a base class in order to be useful.
c                     g)zB
This is invoked when a vertex is encountered for the first time.
Nr	   selfvs     r   discover_vertexBFSVisitor.discover_vertex         	r   c                     gzN
This is invoked on vertex `v` after all of its out edges have been examined.
Nr	   r   s     r   finish_vertexBFSVisitor.finish_vertex&   r   r   c                     gz]
This is invoked on each edge as it becomes a member of the edges
that form the search tree.
Nr	   r   es     r   	tree_edgeBFSVisitor.tree_edge,       
 	r   c                     g)zc
This is invoked on back or cross edges for directed graphs and cross edges
for undirected graphs.
Nr	   r&   s     r   non_tree_edgeBFSVisitor.non_tree_edge3   r*   r   c                     g)z
This is invoked on the subset of non-tree edges whose target vertex is
colored gray at the time of examination.
The color gray indicates that the vertex is currently in the queue.
Nr	   r&   s     r   gray_target_edgeBFSVisitor.gray_target_edge:        	r   c                     g)z
This is invoked on the subset of non-tree edges whose target vertex is
colored black at the time of examination.
The color black indicates that the vertex has been removed from the queue.
Nr	   r&   s     r   black_target_edgeBFSVisitor.black_target_edgeB   r1   r   r	   N)r   r   r   r   r   r   r"   r(   r,   r/   r3   r   r	   r   r   r   r      s%    
r   r   c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)

DFSVisitorK   zA visitor object that is invoked at the event-points inside the
:func:`~rustworkx.dfs_search` algorithm. By default, it performs no
action, and should be used as a base class in order to be useful.
c                     g)zv
This is invoked when a vertex is encountered for the first time.
Together we report the discover time of vertex `v`.
Nr	   r   r   ts      r   r   DFSVisitor.discover_vertexQ   r*   r   c                     g)aA  
This is invoked on vertex `v` after `finish_vertex` has been called for all
the vertices in the DFS-tree rooted at vertex `v`. If vertex `v` is a leaf in
the DFS-tree, then the `finish_vertex` function is called on `v` after all
the out-edges of `v` have been examined. Together we report the finish time
of vertex `v`.
Nr	   r9   s      r   r"   DFSVisitor.finish_vertexX   s     	r   c                     gr%   r	   r&   s     r   r(   DFSVisitor.tree_edgeb   r*   r   c                     g)a  
This is invoked on the back edges in the graph.
For an undirected graph there is some ambiguity between tree edges
and back edges since the edge :math:`(u, v)` and :math:`(v, u)` are the
same edge, but both the `tree_edge()` and `back_edge()` functions will be
invoked. One way to resolve this ambiguity is to record the tree edges,
and then disregard the back-edges that are already marked as tree edges.
An easy way to record tree edges is to record predecessors at the
`tree_edge` event point.
Nr	   r&   s     r   	back_edgeDFSVisitor.back_edgei   s     	r   c                     g)zm
This is invoked on forward or cross edges in the graph.
In an undirected graph this method is never called.
Nr	   r&   s     r   forward_or_cross_edge DFSVisitor.forward_or_cross_edgev   r*   r   r	   N)r   r   r   r   r   r   r"   r(   rA   rD   r   r	   r   r   r6   r6   K   s     
r   r6   c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
DijkstraVisitor~   zA visitor object that is invoked at the event-points inside the
:func:`~rustworkx.dijkstra_search` algorithm. By default, it performs no
action, and should be used as a base class in order to be useful.
c                     g)z
This is invoked when a vertex is encountered for the first time and
it's popped from the queue. Together with the node, we report the optimal
distance of the node.
Nr	   )r   r   scores      r   r   DijkstraVisitor.discover_vertex   r1   r   c                     gr!   r	   r   s     r   r"   DijkstraVisitor.finish_vertex   r   r   c                     g)zJ
This is invoked on every out-edge of each vertex after it is discovered.
Nr	   r   edges     r   examine_edgeDijkstraVisitor.examine_edge   r   r   c                     g)z`
Upon examination, if the distance of the target of the edge is reduced,
this event is emitted.
Nr	   rO   s     r   edge_relaxedDijkstraVisitor.edge_relaxed   r*   r   c                     g)zF
Upon examination, if the edge is not relaxed, this event is emitted.
Nr	   rO   s     r   edge_not_relaxed DijkstraVisitor.edge_not_relaxed   r   r   r	   N)r   r   r   r   r   r   r"   rQ   rT   rW   r   r	   r   r   rG   rG   ~   s     
r   rG   N)
typingr   r   r   	Exceptionr   r   r   r6   rG   r	   r   r   <module>r[      s]    $T]	 		) 	. .b0 0f%gbk %r   