[−][src]Trait rustc_ap_rustc_data_structures::graph::iterate::TriColorVisitor
What to do when a node is examined or becomes Settled
during DFS.
Associated Types
type BreakVal
The value returned by this search.
Provided methods
fn node_examined(
&mut self,
_target: G::Node,
_prior_status: Option<NodeStatus>
) -> ControlFlow<Self::BreakVal>
&mut self,
_target: G::Node,
_prior_status: Option<NodeStatus>
) -> ControlFlow<Self::BreakVal>
Called when a node is examined by the depth-first search.
By checking the value of prior_status
, this visitor can determine whether the edge
leading to this node was a tree edge (None
), forward edge (Some(Settled)
) or back edge
(Some(Visited)
). For a full explanation of each edge type, see the "Depth-first Search"
chapter in CLR or wikipedia.
If you want to know both nodes linked by each edge, you'll need to modify
TriColorDepthFirstSearch
to store a source
node for each Visited
event.
fn node_settled(&mut self, _target: G::Node) -> ControlFlow<Self::BreakVal>
Called after all nodes reachable from this one have been examined.
Implementors
impl<G: ?Sized> TriColorVisitor<G> for CycleDetector where
G: DirectedGraph,
[src]
G: DirectedGraph,
type BreakVal = ()
fn node_examined(
&mut self,
_node: G::Node,
prior_status: Option<NodeStatus>
) -> ControlFlow<Self::BreakVal>
[src]
&mut self,
_node: G::Node,
prior_status: Option<NodeStatus>
) -> ControlFlow<Self::BreakVal>