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

Method reverse

src/graph/directed/digraph.rs:33–42  ·  view source on GitHub ↗

reverse of this digraph

(&self)

Source from the content-addressed store, hash-verified

31
32 /// reverse of this digraph
33 fn reverse(&self) -> Box<dyn IGraph> {
34 let mut r = Digraph::from(self.nv);
35 for v in 0..self.nv {
36 for &w in self.adj(v) {
37 r.add_edge(w, v);
38 }
39 }
40
41 Box::new(r)
42 }
43}
44
45/// create a V-vertex graph with no edges

Callers 3

newMethod · 0.45
path_toMethod · 0.45
path_toMethod · 0.45

Calls 2

adjMethod · 0.45
add_edgeMethod · 0.45

Tested by

no test coverage detected