Write prim's algorithm, Mathematics

Assignment Help:

Write Prim's Algorithm.  

Ans: Prim's algorithm to find out a minimum spanning tree from a weighted graph in step by step form is given below. 

Let G = (V, E) be graph and S = (VS, ES) be the spanning tree to be found from G.

Step 1: Choose a vertex v1 of V and initialize 

VS = {v1} and

ES

= {}

Step 2: Choose a nearest neighbor of vi from V that is adjacent to some vj∈VS and that edge (vi, vj) does not form a cycle with members edge of ES. Set

VS = VS ∪{vi} and

ES = ES ∪{(vi, vj)}  

Step 3: Again Repeat step2 until |Es| = |V| - 1.


Related Discussions:- Write prim's algorithm

Construction , construct of tangents a circle from an external point when ...

construct of tangents a circle from an external point when its centre is not known

Calculate the area of remaining piece of cardboard, A piece of cardboard in...

A piece of cardboard in the shape of a trapezium ABCD & AB || DE, ∠ BCD = 900, quarter circle BFEC is removed. Given AB = BC = 3.5 cm, DE = 2 cm. Calculate the area of remaining p

Find the volume and surface area of the double cone formed, A right triangl...

A right triangle whose sides are 15 cm and 20 cm is made to revolve about its hypotenuse. Find the volume and surface area of the double cone so formed. (Ans : 3768cu.cm,1318.8

Definition of a function, Definition of a Function Now we need to move...

Definition of a Function Now we need to move into the second topic of this chapter.  Before we do that however we must look a quick definition taken care of.

Permatuation and combination problem, 4 boys and 4 girls are to seated in a...

4 boys and 4 girls are to seated in arow i)no. of girls sit together ii)not all girls sit together iii)boys and girls are altenate to each other iv)if a particular boy and g

What is the probability of getting a royal flush, Q. What is the probabilit...

Q. What is the probability of getting a Royal Flush? Ans. Five cards are picked from a standard deck of 52 cards. How many different hands of five cards are possible? What

Fractions, how do you do fractions mixed numbers and how do you add and sub...

how do you do fractions mixed numbers and how do you add and subtract fractions.

Find the lesser of two consecutive positive even integers, Find the lesser ...

Find the lesser of two consecutive positive even integers whose product is 168. Let x = the lesser even integer and let x + 2 = the greater even integer. Because product is a k

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