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§

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.

Find all cycles

Each element of the returned Vec is a Vec of all nodes in one cycle.

Provided Methods§

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.

Implementations on Foreign Types§

Implementors§