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

Explain best - fit method, Best - Fit Method: - This method obtains the sma...

Best - Fit Method: - This method obtains the smallest free block whose  size is greater than or equal to get such a block by traversing the whole free list follows.

Explain floyds algorithm, Explain Floyd's algorithm It is convenient to...

Explain Floyd's algorithm It is convenient to record the lengths of shortest paths in an n by n matrix D known as the  distance matrix: the element d ij   in the i th   row an

Write a program to create a heap file, Write a program to create a heap fil...

Write a program to create a heap file that holds the records in the file " data_2013 " The source records are variablelength.However, the heap file should hold fixed-length reco

Example of pre order traversal, Example of pre order traversal: Reading of...

Example of pre order traversal: Reading of a book, since we do not read next chapter unless we complete all sections of previous chapter & all its sections. Figure  : Rea

Which sorting methods sorting a list which is almost sorted, Which sorting ...

Which sorting methods would be most suitable for sorting a list which is almost sorted  Bubble Sorting method.

Binary search trees, In this unit, we discussed Binary Search Trees, AVL tr...

In this unit, we discussed Binary Search Trees, AVL trees and B-trees. The outstanding feature of Binary Search Trees is that all of the elements of the left subtree of the root

Sort 5, The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending...

The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is 5

Name the five popular hashing functions, Five popular hashing functions are...

Five popular hashing functions are as follows: 1) Division Method 2) Midsquare Method 3) Folding Method 4) Multiplicative method 5) Digit Analysis

Graph traversal schemes, Q. Explain various graph traversal schemes and wri...

Q. Explain various graph traversal schemes and write their advantages and disadvantages. A n s . Graph Traversal Scheme is explained below In many troubles we wish

Construction of a binary tree , Q. Construct a binary tree whose nodes in i...

Q. Construct a binary tree whose nodes in inorder and preorder are written as follows: Inorder : 10, 15, 17, 18, 20, 25, 30, 35, 38, 40, 50 Preorder: 20, 15, 10

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