MCPcopy
hub / github.com/wangzheng0822/algo / dfs

Method dfs

java/30_graph/Graph.java:91–100  ·  view source on GitHub ↗
(int s, int t)

Source from the content-addressed store, hash-verified

89 boolean found = false; // 全局变量或者类成员变量
90
91 public void dfs(int s, int t) {
92 found = false;
93 boolean[] visited = new boolean[v];
94 int[] prev = new int[v];
95 for (int i = 0; i < v; ++i) {
96 prev[i] = -1;
97 }
98 recurDfs(s, t, visited, prev);
99 print(prev, s, t);
100 }
101
102 private void recurDfs(int w, int t, boolean[] visited, int[] prev) {
103 if (found == true) return;

Callers 1

mainMethod · 0.95

Calls 2

recurDfsMethod · 0.95
printMethod · 0.95

Tested by

no test coverage detected