Finding paths Given a graph and a source vertex s, support queries of the form: Is there a path from s to a given target vertex v? If so, find such a path.
| 7 | /// of the form: Is there a path from s to a given target |
| 8 | /// vertex v? If so, find such a path. |
| 9 | pub trait Paths { |
| 10 | /// is there a path from s to v ? |
| 11 | fn has_path(&self, v: usize) -> bool; |
| 12 | /// path from s to v; None if no such path |
| 13 | fn path_to(&self, v: usize) -> Option<LinkedList<usize>>; |
| 14 | } |
| 15 | |
| 16 | /// Run depth-first search on an undirected graph. |
| 17 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected