Axon interview question

BFS question relating to graphs