MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / DFS

Method DFS

Programs/DepthFirstSearch.java:24–34  ·  view source on GitHub ↗
(int vertex)

Source from the content-addressed store, hash-verified

22
23 // DFS algorithm
24 void DFS(int vertex) {
25 visited[vertex] = true;
26 System.out.print(vertex + " ");
27
28 Iterator<Integer> ite = adjLists[vertex].listIterator();
29 while (ite.hasNext()) {
30 int adj = ite.next();
31 if (!visited[adj])
32 DFS(adj);
33 }
34 }
35
36 public static void main(String args[]) {
37 Graph g = new Graph(4);

Callers 1

mainMethod · 0.95

Calls 1

printMethod · 0.80

Tested by

no test coverage detected