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

Class BreadthFirstPaths

src/graph/util/paths.rs:32–37  ·  view source on GitHub ↗

Run breadth first search on an undirected graph. Runs in O(E + V) time. Run breadth-first search on a digraph. Runs in O(E + V) time.

Source from the content-addressed store, hash-verified

30/// Run breadth-first search on a digraph.
31/// Runs in O(E + V) time.
32pub struct BreadthFirstPaths {
33 marked: Vec<bool>, // marked[v] = is there an s-v path
34 edge_to: Vec<usize>, // edgeTo[v] = previous edge on shortest s-v path
35 dist_to: Vec<usize>, // distTo[v] = number of edges shortest s-v path
36 s: usize, // source vertex
37}
38
39impl Paths for DepthFirstPaths {
40 fn has_path(&self, v: usize) -> bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected