Added DFS implementation and test for it.