Explain the Kruskal's shortest spanning tree algorithm with a suitable example by taking a graph with 7 vertices, 15 edges and with suitable weights for each edge.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Explain the Kruskal's shortest spanning tree algorithm with a suitable example by taking a graph with 7 vertices,
15 edges and with suitable weights for each edge.
Transcribed Image Text:Explain the Kruskal's shortest spanning tree algorithm with a suitable example by taking a graph with 7 vertices, 15 edges and with suitable weights for each edge.
Expert Solution
Step 1

Algorithm

Step 1:

Kruskal's algorithm is the shortest spanning tree algorithm that finds an edge with the least possible weight to connect any two trees in the connected undirected graph. It is also called the greedy algorithm. Graph with 7 vertices and 15 weighted edges is

Computer Science homework question answer, step 1, image 1

Step 2

Step 2 :

List all vertices and their adjusting edge and sort all the edges in the increasing order of their weights. The graph contains 7 vertices(A,B,C,D,E,F and G) and 15 weighted edges. The shortest-spanning-tree will be having (total vertices-1).

=6 edges

sort all the edges in the increasing order of their weight 

Weight

Source

Destination

3

A

C

3

B

C

3

D

E

3

E

G

4

A

B

4

C

E

4

D

F

5

B

D

5

D

G

5

F

G

6

A

D

6

C

D

6

E

F

7

B

G

8

A

E

 

Step 3

Step 3:

pick the smallest edge check if the edge creates a cycle or loop discard it. If the cycle or loop is not formed then
include the edge to form the spanning tree.
Pick edge A-C. No cycle is formed, include it to create a shortest-

Spanning-Tree:

Computer Science homework question answer, step 3, image 1

Pick edge B-C. No cycle is formed, so include it to create a

Computer Science homework question answer, step 3, image 2

steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education