pub trait TriColorVisitor<G>where
G: ?Sized + DirectedGraph,{
type BreakVal;
// Provided methods
fn node_examined(
&mut self,
_node: G::Node,
_prior_status: Option<NodeStatus>,
) -> ControlFlow<Self::BreakVal> { ... }
fn node_settled(&mut self, _node: G::Node) -> ControlFlow<Self::BreakVal> { ... }
fn ignore_edge(&mut self, _source: G::Node, _target: G::Node) -> bool { ... }
}
Expand description
What to do when a node is examined or becomes Settled
during DFS.
Required Associated Types§
Provided Methods§
Sourcefn node_examined(
&mut self,
_node: G::Node,
_prior_status: Option<NodeStatus>,
) -> ControlFlow<Self::BreakVal>
fn node_examined( &mut self, _node: 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.
Sourcefn node_settled(&mut self, _node: G::Node) -> ControlFlow<Self::BreakVal>
fn node_settled(&mut self, _node: G::Node) -> ControlFlow<Self::BreakVal>
Called after all nodes reachable from this one have been examined.
Sourcefn ignore_edge(&mut self, _source: G::Node, _target: G::Node) -> bool
fn ignore_edge(&mut self, _source: G::Node, _target: G::Node) -> bool
Behave as if no edges exist from source
to target
.