This lesson is for subscribers
You've completed the free preview. Subscribe to unlock every lesson in every course.
Iterate through all vertices, running DFS or BFS on unvisited vertices to count total number of components.
You've completed the free preview. Subscribe to unlock every lesson in every course.