Amazon Interview Question

they asked a question on bfs for a graph