MCPcopy Create free account
hub / github.com/douchuan/algorithm / DirectedCycle

Class DirectedCycle

src/graph/directed/cycle.rs:26–31  ·  view source on GitHub ↗

The DirectedCycle represents a data type for determining whether a digraph has a directed cycle. The has_cycle operation determines whether the digraph has a simple directed cycle and, if so, the cycle operation returns one. This implementation uses depth-first search.

Source from the content-addressed store, hash-verified

24/// returns one.
25/// This implementation uses depth-first search.
26pub struct DirectedCycle {
27 cycle: Option<Stack<usize>>,
28 edge_to: Vec<usize>,
29 marked: Vec<bool>,
30 on_stack: Vec<bool>,
31}
32
33/// The EdgeWeightedDirectedCycle represents a data type for
34/// determining whether an edge-weighted digraph has a directed cycle.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected