結果 : how to implement bfs and dfs in python