(g: &dyn IGraph, s: usize)
| 86 | |
| 87 | impl DepthFirstPaths { |
| 88 | pub fn new(g: &dyn IGraph, s: usize) -> Self { |
| 89 | let marked = vec![false; g.V()]; |
| 90 | let edge_to = vec![0; g.V()]; |
| 91 | let mut h = Self { marked, s, edge_to }; |
| 92 | h.dfs(g, s); |
| 93 | h |
| 94 | } |
| 95 | |
| 96 | fn dfs(&mut self, g: &dyn IGraph, v: usize) { |
| 97 | self.marked[v] = true; |