Trait graph_cycles::Cycles
source · pub trait Cycles {
type NodeId;
fn visit_cycles<F, B>(&self, visitor: F) -> Option<B>
where
F: FnMut(&Self, &[Self::NodeId]) -> ControlFlow<B>;
fn cycles(&self) -> Vec<Vec<Self::NodeId>>;
fn visit_all_cycles<F>(&self, visitor: F)
where
F: FnMut(&Self, &[Self::NodeId]),
{ ... }
}
Expand description
Trait for identifying cycles in a graph The node identifier of the underlying graph
Required Associated Types§
Required Methods§
sourcefn visit_cycles<F, B>(&self, visitor: F) -> Option<B>where
F: FnMut(&Self, &[Self::NodeId]) -> ControlFlow<B>,
fn visit_cycles<F, B>(&self, visitor: F) -> Option<B>where
F: FnMut(&Self, &[Self::NodeId]) -> ControlFlow<B>,
Apply the visitor
to each cycle until we are told to stop
The first argument passed to the visitor is a reference to the
graph and the second one a slice with all nodes that form the
cycle. If at any point the visitor returns
ControlFlow::Break(b)
this function stops visiting any
further cycles and returns Some(b)
. Otherwise the return
value is None
.
Provided Methods§
sourcefn visit_all_cycles<F>(&self, visitor: F)where
F: FnMut(&Self, &[Self::NodeId]),
fn visit_all_cycles<F>(&self, visitor: F)where
F: FnMut(&Self, &[Self::NodeId]),
Apply the visitor
to each cycle until we are told to stop
The first argument passed to the visitor is a reference to the graph and the second one a slice with all nodes that form the cycle.