0% found this document useful (0 votes)
2 views3 pages

Kruskal's Spanning Tree Algorithm

Kruskal's algorithm is a greedy method for finding the minimum cost spanning tree by treating the graph as a forest of individual trees. The process involves removing loops and parallel edges, arranging edges by weight, and adding the least weight edges while ensuring no circuits are formed. The algorithm continues until all nodes are included in the minimum cost spanning tree.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Kruskal's Spanning Tree Algorithm

Kruskal's algorithm is a greedy method for finding the minimum cost spanning tree by treating the graph as a forest of individual trees. The process involves removing loops and parallel edges, arranging edges by weight, and adding the least weight edges while ensuring no circuits are formed. The algorithm continues until all nodes are included in the minimum cost spanning tree.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

3/10/22, 10:05 AM Kruskal's Spanning Tree Algorithm

Kruskal's Spanning Tree Algorithm

Kruskal's algorithm to find the minimum cost spanning tree uses the greedy approach. This algorithm treats the graph as a forest and every node it
has as an individual tree. A tree connects to another only and only if, it has the least cost among all available options and does not violate MST
properties.

To understand Kruskal's algorithm let us consider the following example −

Step 1 - Remove all loops and Parallel Edges

Remove all loops and parallel edges from the given graph.

In case of parallel edges, keep the one which has the least cost associated and remove all others.

Step 2 - Arrange all edges in their increasing order of weight


The next step is to create a set of edges and weight, and arrange them in an ascending order of weightage (cost).

Step 3 - Add the edge which has the least weightage

Now we start adding edges to the graph beginning from the one which has the least weight. Throughout, we shall keep checking that the spanning
properties remain intact. In case, by adding one edge, the spanning tree property does not hold then we shall consider not to include the edge in
the graph.

The least cost is 2 and edges involved are B,D and D,T. We add them. Adding them does not violate spanning tree properties, so we continue to
our next edge selection.

https://www.tutorialspoint.com/data_structures_algorithms/kruskals_spanning_tree_algorithm.htm 1/3
3/10/22, 10:05 AM Kruskal's Spanning Tree Algorithm
Next cost is 3, and associated edges are A,C and C,D. We add them again −

Next cost in the table is 4, and we observe that adding it will create a circuit in the graph. −

We ignore it. In the process we shall ignore/avoid all edges that create a circuit.

We observe that edges with cost 5 and 6 also create circuits. We ignore them and move on.

Now we are left with only one node to be added. Between the two least cost edges available 7 and 8, we shall add the edge with cost 7.

By adding edge S,A we have included all the nodes of the graph and we now have minimum cost spanning tree.

Useful Video Courses


Video

Azure Data Lake Online Training

42 Lectures 1.5 hours

Ravi Kiran

More Detail

Video

https://www.tutorialspoint.com/data_structures_algorithms/kruskals_spanning_tree_algorithm.htm 2/3
3/10/22, 10:05 AM Kruskal's Spanning Tree Algorithm
Data Structure Online Training

141 Lectures 13 hours


Arnab Chakraborty

More Detail

Video

Oracle Data Guard Online Training

26 Lectures 8.5 hours


Parth Panjabi

More Detail

Video

Big Data & Hadoop Online Training

65 Lectures 6 hours

Arnab Chakraborty

More Detail

Video

Python With Data Science

75 Lectures 13 hours

Eduonix Learning Solutions

More Detail

Video

Mathematics For Data Science And Machine Learning Using R

64 Lectures 10.5 hours


Eduonix Learning Solutions

More Detail

https://www.tutorialspoint.com/data_structures_algorithms/kruskals_spanning_tree_algorithm.htm 3/3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy