BFS, connected components