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

Method path_to

src/graph/util/paths.rs:44–60  ·  view source on GitHub ↗
(&self, v: usize)

Source from the content-addressed store, hash-verified

42 }
43
44 fn path_to(&self, v: usize) -> Option<LinkedList<usize>> {
45 if self.has_path(v) {
46 let mut paths = LinkedList::default();
47 let s = self.s;
48 let mut x = v;
49
50 while x != s {
51 paths.push_front(x);
52 x = self.edge_to[x];
53 }
54 paths.push_front(s);
55
56 Some(paths)
57 } else {
58 None
59 }
60 }
61}
62
63impl Paths for BreadthFirstPaths {

Callers

nothing calls this directly

Calls 2

push_frontMethod · 0.80
has_pathMethod · 0.45

Tested by

no test coverage detected