BFS queue order generation