Add bfs and dfs.