MCPcopy Index your code
hub / github.com/BeeBombshell/Python-DSA / dfs

Function dfs

Tree Data Structure/dfs.py:14–19  ·  view source on GitHub ↗
(visited, graph, node)

Source from the content-addressed store, hash-verified

12visited = set() # Set to keep track of visited nodes.
13
14def dfs(visited, graph, node):
15 if node not in visited:
16 print (node, end=" ")
17 visited.add(node)
18 for neighbour in graph[node]:
19 dfs(visited, graph, neighbour)
20
21# Driver Code
22dfs(visited, graph, 'A')

Callers 1

dfs.pyFile · 0.85

Calls 1

addMethod · 0.80

Tested by

no test coverage detected