Question: Show that a depth first search of an undirected graph G

Show that a depth-first search of an undirected graph G can be used to identify the connected components of G, and that the depth-first forest contains as many trees as G has connected components. More precisely, show how to modify depth-first search so that each vertex v is assigned an integer label cc[v] between 1 and k, where k is the number of connected components of G, such that cc[u] = cc[v] if and only if u and v are in the same connected component.

View Solution:


Sale on SolutionInn
Sales1
Views300
Comments
  • CreatedJuly 14, 2010
  • Files Included
Post your question
5000