Depth-First Search Comments
Comments
-
Sorry, it's assumed you're continuing with the graph data structure you created in the last challenge, so the boilerplate code doesn't do enough. Here's a solution
to the previous challenge which processes the input into a 'graph' made out of an ArrayList of ArrayLists. You can modify/simplify that code to do a DFS, or try doing that part from scratch.
Kendall Ponder
Jul 21, 8:49 PMI don't understand how the graph data is stored in the array. Looking at the boiler plate code it looks like t is the number of times my code will be called. n is how many nodes the graph will
have so you dimension the array to n. But it looks like the second for loop reads in one integer for each array location but some nodes have multiple connections so how is that stored in the array? Thanks!