add DFS method and BFS method.