Google Cloud interview question

Some DFS and BFS coding on a white board