Count number of connected components
BFS for multiple source paths