Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def depth_first_search_recursive(graph, start, visited=None):
- if visited is None:
- visited = set()
- visited.add(start)
- for next in graph[start] - visited:
- depth_first_search_recursive(graph, next, visited)
- return visited
Add Comment
Please, Sign In to add comment