DFS on graph, both iterative and recursive