reaching def for BFS