Finished Depth-first search to find paths in a graph