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

Class DepthFirstPaths

src/graph/util/paths.rs:21–25  ·  view source on GitHub ↗

Run depth-first search on an undirected graph. Determine reachability in a digraph from a given vertex using depth-first search. Runs in O(E + V) time.

Source from the content-addressed store, hash-verified

19/// depth-first search.
20/// Runs in O(E + V) time.
21pub struct DepthFirstPaths {
22 marked: Vec<bool>, // marked[v] = is there an s-v path?
23 edge_to: Vec<usize>, // edgeTo[v] = last edge on s-v path
24 s: usize, // source vertex
25}
26
27/// Run breadth first search on an undirected graph.
28/// Runs in O(E + V) time.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected