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 cam software, Explain CAM software CAD/CAM software has been re...

Explain CAM software CAD/CAM software has been recognized as an essential tool in the designing and manufacturing of a product due to its ability to depict the designs and tool

BST has two children, If a node in a BST has two children, then its inorder...

If a node in a BST has two children, then its inorder predecessor has No right child

Linear array - numerical, Q. A linear array A is given with lower bound as ...

Q. A linear array A is given with lower bound as 1. If address of A[25] is 375 and A[30] is 390, then find address of A[16].

Searching techniques, Searching is the procedure of looking for something. ...

Searching is the procedure of looking for something. Searching a list containing 100000 elements is not the similar as searching a list containing 10 elements. We discussed two sea

Explain what is stack. describe ways to execute stack. , ST AC K is ...

ST AC K is explained as follows : A stack is one of the most usually used data structure. A stack is also called a Last-In-First-Out (LIFO) system, is a linear list in

Binry trees, Build a class ?Node?. It should have a ?value? that it stores ...

Build a class ?Node?. It should have a ?value? that it stores and also links to its parent and children (if they exist). Build getters and setters for it (e.g. parent node, child n

Areas of use - sequential files, Sequential files are most frequently utili...

Sequential files are most frequently utilized in commercial batch oriented data processing where there is the concept of a master file on which details are inserted periodically. F

Define midsquare method, Midsquare Method :- this operates in 2 steps. In t...

Midsquare Method :- this operates in 2 steps. In the first step the square of the key value K is taken. In the 2nd step, the hash value is obtained by deleting digits from ends of

Single pointer pointing to the tail of the queue, Can a Queue be shown by c...

Can a Queue be shown by circular linked list with only single pointer pointing to the tail of the queue? Yes a Queue can be shown by a circular linked list with only single p

What is complexity, Complexity is the rate at which the needed storage or c...

Complexity is the rate at which the needed storage or consumed time rise as a function of the problem size. The absolute growth based on the machine utilized to execute the program

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