View worked solution
Answer: 60
A Depth-First Search () traversal of an undirected graph produces a spanning forest (DFS forest) of the graph. This forest has the following properties:
- It contains all the vertices of the original graph . Thus, the number of vertices in the forest is .
- The number of connected components (trees) in the DFS forest is exactly equal to the number of connected components in the original graph .
For any forest with vertices, edges, and connected components, the relationship is given by:
Rearranging the formula to find the number of connected components :
Substituting the given values:
Thus, the number of connected components in is 60.
Free practice · Your answers on this page are not saved.
