finish BFS visit