linear search for next unvisited node in BFS