Kruskals algorithm, Data Structure & Algorithms

Assignment Help:

Krushkal's algorithm uses the concept of forest of trees. At first the forest contains n single node trees (and no edges). At each of the step, we add on one (the cheapest one) edge so that it links two trees together. If it makes a cycle, simply it would mean that it links two nodes that were connected already. So, we reject it.

The steps in Kruskal's Algorithm are as:

1.   The forest is constructed through the graph G - along each node as a separate tree in the forest.

2.   The edges are placed within a priority queue.

3.   Do till we have added n-1 edges to the graph,

  I.   Extract the lowest cost edge from the queue.

 II.   If it makes a cycle, then a link already exists among the concerned nodes. So reject it.

 III.  Otherwise add it to the forest. Adding it to the forest will join two trees together.

The forest of trees is a division of the original set of nodes. At first all the trees have exactly one node in them. As the algorithm progresses, we make a union of two of the trees (sub-sets), until the partition has only one sub-set containing all the nodes eventually.

Let us see the sequence of operations to determine the Minimum Cost Spanning Tree(MST) in a graph via Kruskal's algorithm. Suppose the graph of graph shown in figure  and below figure  illustrates the construction of MST of graph of Figure

1339_Kruskals Algorithm.png

Figure: A Graph

Figure: Construction of Minimum Cost Spanning Tree for the Graph by application of Kruskal's algorithm

The following are several steps in the construction of MST for the graph of Figure via Kruskal's algorithm.

Step 1 :  The lowest cost edge is chosen from the graph that is not in MST (initially MST is empty). The cheapest edge is 3 that is added to the MST (illustrated in bold edges)

Step 2: The next cheap edge which is not in MST is added (edge with cost 4).

Step 3 : The next lowest cost edge that is not in MST is added (edge with cost 6).

 Step 4 : The next lowest cost edge that is not in MST is added (edge with cost 7).

Step 5 : The next lowest cost edge that is not in MST is 8 but form a cycle. Hence, it is discarded. The next lowest cost edge 9 is added. Now the MST has all the vertices of the graph. This results in the MST of the original graph.


Related Discussions:- Kruskals algorithm

General, whats the definition of ADT and data type?

whats the definition of ADT and data type?

Perform depth -first search, You are given two jugs, a 4-gallon one and a 3...

You are given two jugs, a 4-gallon one and a 3-gallon one. Neither has any measuring marker on it. There is a tap that can be used to fill the jugs with water. How can you get exac

Design and implement a software system, In this assignment, you are invited...

In this assignment, you are invited to design and implement a software system for catalogue sale. A catalogue is organised in a tree structure. Each node of the catalogue tree repr

Tree, tree is graph or not

tree is graph or not

Queue, 1. Show the effect of each of the following operations on queue q. A...

1. Show the effect of each of the following operations on queue q. Assume that y (type Character) contains the character ‘&’. What are the final values of x and success (type boole

Recursive function , Q. Write down the recursive function to count the numb...

Q. Write down the recursive function to count the number of the nodes in the binary tree.    A n s . R ecursive Function to count no. of Nodes in Binary Tree is writt

Data Mining and Neural Networks, I am looking for some help with a data min...

I am looking for some help with a data mining class with questions that are about neural networks and decision trees. Can you help? I can send document with questions.

Find the optimal solution - branch and bound algorithm, Consider the follow...

Consider the following 5-city traveling salesman problem. The distance between each city (in miles) is shown in the following table: (a) Formulate an IP whose solution will

Explain about hidden-surface, Explain about Hidden-surface Hidden-line...

Explain about Hidden-surface Hidden-line removal refers to wire-frame diagrams without surface rendering and polygonal surfaces with straight edges. Hidden-surface removal ref

Method for keeping two stacks within a single linear array, Q. Define a met...

Q. Define a method for keeping two stacks within a single linear array S in such a way that neither stack overflows until entire array is used and a whole stack is never shifted to

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd