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

Method new

src/graph/directed/transitive_closure.rs:20–26  ·  view source on GitHub ↗

Computes the transitive closure of the digraph

(graph: &dyn IGraph)

Source from the content-addressed store, hash-verified

18impl 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 {

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
VMethod · 0.45

Tested by

no test coverage detected