What do you want to save?
Add Code snippet
New code examples
-
Other 2021-10-11 15:10:12
python simple depth first search
# Using a Python dictionary to act as an adjacency list graph = { '5' : ['3','7'], '3' : ['2', '4'], '7' : ['8'], '2' : [], '4' : ['8'], '8' : [] } visited = set() # Set to keep track of visited nodes of graph. def dfs(visited, graph, node):... Add solution -
Other 2021-10-04 03:13:03
Depth First Searcha Java by ALGS4 princeton
/****************************************************************************** * Compilation: javac DepthFirstSearch.java * Execution: java DepthFirstSearch filename.txt s * Dependencies: Graph.java StdOut.java * Data files: https://algs4.c... Add solution