MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / DFS

Method DFS

Graphs/depth_first_search.py:27–34  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

25 self.vertex[fromVertex] = [toVertex]
26
27 def DFS(self):
28 # visited array for storing already visited nodes
29 visited = [False] * len(self.vertex)
30
31 # call the recursive helper function
32 for i in range(len(self.vertex)):
33 if visited[i] == False:
34 self.DFSRec(i, visited)
35
36 def DFSRec(self, startVertex, visited):
37 # mark start vertex as visited

Callers 1

Calls 1

DFSRecMethod · 0.95

Tested by

no test coverage detected