finish bfs in graph