0% found this document useful (0 votes)
3 views4 pages

Prim's Algorithm for Minimum Spanning Tree

The document outlines Prim's algorithm, which is used to find the minimum spanning tree of a graph. It begins with a random vertex and adds edges until all vertices are included, ensuring that the total weight is minimized. The procedure involves using a priority queue to manage edges connecting the tree's vertices to those outside the 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)
3 views4 pages

Prim's Algorithm for Minimum Spanning Tree

The document outlines Prim's algorithm, which is used to find the minimum spanning tree of a graph. It begins with a random vertex and adds edges until all vertices are included, ensuring that the total weight is minimized. The procedure involves using a priority queue to manage edges connecting the tree's vertices to those outside the 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

ALGORITHMS

ASSIGNMENT
3
Name : Ananthika.G
Branch/ Sec: BE - CS E ((A)

Reg. numbr: 310s)31D4007


PRIM'S AL GORIM

qrely tonthm usrd to fird he

The lqonthm gturts with a rardom verter

ad add edqes to the untl all vertces

Included n the The


edges re choosen in

SLuch a that the of ther weghts


minimized

Procedure:
Step 1: start ith one vertex.

chO0Se any vertex to


begin he minmum
tree and crcatea
spanning Set to keep track of
Verttes ddded to thg tee
Joitially, this Set Uil!
have only the starting Vertex

Stepa : Use d PrioTity queue ( Min-beap)


Store call edqes that COnoec+ tbe tyee's

vertices to Nertices outsicle


Stepand i Step
Ztep Example Simplified
ule
Verttces V 3
edges IF Grow
the
Pricvity f
Verttces=n tree MSI
=n-)
cdges
e,d,ef
{ab, doesn't step by
each
include
edge
its is
al
vertces
Smaller

Yeptat

Step?
Visit a
e d-e C-f C-d b-f b-c
q-e
a-f a-bEdges
-f

(d
a,b, 3
Step
Step 4
Step :s
mnmumPick
the

e,F, 2
d,sfVìsit f f,C, d,G C,Visit c 4 Visit b
b,fb,C,!
(c,f.44) rninimumPick
the

(6,c, )

a
a
2
a

eight
Total 3
T I8= f

of

gteps
(aSochae Visit e

uweight
Total
tofd

MST=S
of

You might also like