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

Class EdgeWeightedDirectedCycle

src/graph/directed/cycle.rs:39–44  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

37/// returns one.
38/// This implementation uses depth-first search.
39pub struct EdgeWeightedDirectedCycle {
40 cycle: Option<Stack<DirectedEdge>>,
41 edge_to: Vec<Option<DirectedEdge>>,
42 marked: Vec<bool>,
43 on_stack: Vec<bool>,
44}
45
46impl DirectedCycle {
47 /// does G have a directed cycle?

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected