MCPcopy Index your code
hub / github.com/subbarayudu-j/TheAlgorithms-Python / DFSRec

Method DFSRec

Graphs/depth_first_search.py:36–45  ·  view source on GitHub ↗
(self, startVertex, visited)

Source from the content-addressed store, hash-verified

34 self.DFSRec(i, visited)
35
36 def DFSRec(self, startVertex, visited):
37 # mark start vertex as visited
38 visited[startVertex] = True
39
40 print(startVertex, end = ' ')
41
42 # Recur for all the vertexes that are adjacent to this node
43 for i in self.vertex.keys():
44 if visited[i] == False:
45 self.DFSRec(i, visited)
46
47if __name__ == '__main__':
48 g = Graph()

Callers 1

DFSMethod · 0.95

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected