Practis
Practis
# graph = {
# '5': ['3', '7'],
# '3': ['2', '4'],
# '7': ['8'],
# '2': [],
# '4': ['8'],
# '8': []
# }
# # Driver Code.
# print("Following is the Breadth-First Search:")
# bfs(visited, graph, '5') # Function calling.
### DFS
graph = {
'5': ['3', '7'],
'3': ['2', '4'],
'7': ['8'],
'2': [],
'4': ['8'],
'8': []
}
# Driver Code.
print("Following is the Depth-First Search:")
dfs(visited, graph, '5')