Computes the transitive closure of the digraph
(graph: &dyn IGraph)
| 18 | impl TransitiveClosure { |
| 19 | /// Computes the transitive closure of the digraph |
| 20 | pub fn new(graph: &dyn IGraph) -> Self { |
| 21 | let mut tc = Vec::with_capacity(graph.V()); |
| 22 | for v in 0..graph.V() { |
| 23 | tc.push(DirectedDFS::new_single(graph, v)); |
| 24 | } |
| 25 | Self { tc } |
| 26 | } |
| 27 | |
| 28 | /// Is there a directed path from vertex v to vertex w in the digraph? |
| 29 | pub fn reachable(&self, v: usize, w: usize) -> bool { |