populate using BFS