Iterative BFS on graph