• :00Days
  • :00Hours
  • :00Mins
  • 00Seconds
A new era for learning is coming soonSign up for free
Log In Start studying!

Select your language

Suggested languages for you:
Answers without the blur. Sign up and see all textbooks for free! Illustration

Q37E

Expert-verified
Discrete Mathematics and its Applications
Found in: Page 796
Discrete Mathematics and its Applications

Discrete Mathematics and its Applications

Book edition 7th
Author(s) Kenneth H. Rosen
Pages 808 pages
ISBN 9780073383095

Answers without the blur.

Just sign up for free and you're in.

Illustration

Short Answer

Devise an algorithm based on breadth-first search for finding the connected components of a graph.

Using the breadth-first search and algorithm helps in finding the connected components of graph G.

See the step by step solution

Step by Step Solution

Step 1: Compare with the definition

A spanning tree of a simple graph G is a subgraph of G that is a tree and that contains all vertices of G.

A tree is an undirected graph that is connected and does not contain any single circuit n vertices has n-1 edges of a tree.

Step 2: The breadth-first search method.

In breadth-first search first, choose a root. Add all edges incident to the root. Then each of the vertices at level 1, add all edges incident with ta vertex not included in the tree yet. And repeat until all vertices were added to the tree.

Step 3: Procedure for finding the connected components.

Select the first vertex. And add all vertices connected by an edge to the list L and M then remove the edges from the graph. L will keep track of all vertices checked in the algorithm, while M keeps track of all vertices in the last step of the algorithm. It then adds all vertices connected by an edge to a vertex in M. If no vertex was added to the L, then it needs to choose a new vertex to add to the first list and repeat the procedure for the vertex, then it is moving on to a different connected component and thus it increase the connected components C by 1.

Step 4: Algorithm.

Let G be an undirected graph having vertices\({\bf{V = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{,}}{{\bf{v}}_{\bf{2}}}{\bf{,}}......{\bf{,}}{{\bf{v}}_{\bf{n}}}{\bf{\} }}\).

\(\begin{array}{c}{\bf{T = G}}\\{\bf{V = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{,}}{{\bf{v}}_{\bf{2}}}{\bf{,}}......{\bf{,}}{{\bf{v}}_{\bf{n}}}{\bf{\} }}\\{\bf{L = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{\} }}\\{\bf{M = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{\} }}\end{array}\)

\(\begin{array}{c}{\rm{while }}{\bf{L}} \ne {\bf{M}}\\{\rm{if }}{\bf{M = }}\phi ;\forall j = 1{\rm{ to }}n.\\{\rm{if }}{{\bf{v}}_{\bf{j}}} \notin {\bf{L}}{\rm{ then L = L}} \cup \left\{ {{v_j}} \right\}\\{\rm{M = M}} \cup \left\{ {{v_j}} \right\}\\N = \phi \end{array}\)

For every vertex v in M \({\bf{forj = 1ton}}\).

If \({\bf{(}}{{\bf{v}}_{\bf{i}}}{\bf{,}}{{\bf{v}}_{\bf{j}}}{\bf{)}}\) is an edge in G then \({{\bf{v}}_{\bf{j}}} \in L\).

Remove the edge \({\bf{(}}{{\bf{v}}_{\bf{i}}}{\bf{,}}{{\bf{v}}_{\bf{j}}}{\bf{)}}\) from T.

Remove the edge \({\bf{(}}{{\bf{v}}_{\bf{i}}}{\bf{,}}{{\bf{v}}_{\bf{j}}}{\bf{)}}\) from G.

Else remove the edge from the graph G.

\(\begin{array}{c}{\bf{L = L}} \cup {\bf{\{ }}{{\bf{v}}_{\bf{j}}}{\bf{\} }}\\{\bf{N = N}} \cup {\bf{\{ }}{{\bf{v}}_{\bf{j}}}{\bf{\} }}\\{\bf{M = N}}\\{\bf{returnT}}\end{array}\)

Therefore, this is the required algorithm.

Recommended explanations on Math Textbooks

94% of StudySmarter users get better grades.

Sign up for free
94% of StudySmarter users get better grades.