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

Method dfs

src/graph/undirected/dfs.rs:47–55  ·  view source on GitHub ↗
(&mut self, g: &dyn IGraph, v: usize)

Source from the content-addressed store, hash-verified

45
46impl DepthFirstSearch {
47 fn dfs(&mut self, g: &dyn IGraph, v: usize) {
48 self.marked[v] = true;
49 self.count += 1;
50 for &w in g.adj(v) {
51 if !self.marked[w] {
52 self.dfs(g, w);
53 }
54 }
55 }
56}

Callers 1

newMethod · 0.45

Calls 1

adjMethod · 0.45

Tested by

no test coverage detected