Amazon interview question

they asked a question on bfs for a graph