Done BFS in an implicit graph.