find vertices in G that are reachable from s
(graph: &dyn IGraph, s: usize)
| 7 | impl DirectedDFS { |
| 8 | /// find vertices in G that are reachable from s |
| 9 | pub fn new_single(graph: &dyn IGraph, s: usize) -> Self { |
| 10 | let mut dfs = Self { |
| 11 | marked: vec![false; graph.V()], |
| 12 | }; |
| 13 | dfs.dfs(graph, s); |
| 14 | dfs |
| 15 | } |
| 16 | |
| 17 | /// find vertices in G that are reachable from sources |
| 18 | pub fn new_multi(graph: &dyn IGraph, sources: &[usize]) -> Self { |