SlideShare une entreprise Scribd logo
1  sur  20
WELCOME
TO OUR
PRESENTATION
KRUSKAL’S ALGORITHM
&
PRIM’S ALGORITHM
Presented by :
Asif Ahmed Sajal #ID : 142-15-3710
Irin Afroze #ID : 142-15 3746
Minimum Connector Algorithms
Kruskal’s algorithm
1. Select the shortest edge in a
network
2. Select the next shortest edge
which does not create a cycle
3. Repeat step 2 until all vertices
have been connected
Prim’s algorithm
1. Select any vertex
2. Select the shortest edge
connected to that vertex
3. Select the shortest edge
connected to any vertex
already connected
4. Repeat step 3 until all
vertices have been
connected
A CABLE COMPANY WANT TO CONNECT FIVE VILLAGES TO THEIR
NETWORK WHICH CURRENTLY EXTENDS TO THE MARKET TOWN OF
AVONFORD. WHAT IS THE MINIMUM LENGTH OF CABLE NEEDED?
Avonford Fingley
Brinleigh Cornwell
Donster
Edan
2
7
4
5
8 6 4
5
3
8
Example
We model the situation as a network, then the problem
is to find the minimum connector for the network
A F
B C
D
E
2
7
4
5
8 6 4
5
3
8
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
List the edges in
order of size:
ED 2
AB 3
AE 4
CD 4
BC 5
EF 5
CF 6
AF 7
BF 8
CF 8
Kruskal’s Algorithm
Select the shortest
edge in the network
ED 2
Kruskal’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the next shortest
edge which does not
create a cycle
ED 2
AB 3
Kruskal’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the next shortest
edge which does not
create a cycle
ED 2
AB 3
CD 4 (or AE 4)
Kruskal’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the next shortest
edge which does not
create a cycle
ED 2
AB 3
CD 4
AE 4
Kruskal’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the next shortest
edge which does not
create a cycle
ED 2
AB 3
CD 4
AE 4
BC 5 – forms a cycle
EF 5
Kruskal’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
All vertices have been
connected.
The solution is
ED 2
AB 3
CD 4
AE 4
EF 5
Total weight of tree: 18
Kruskal’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select any vertex
A
Select the shortest
edge connected to
that vertex
AB 3
Prim’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the shortest
edge connected to
any vertex already
connected.
AE 4
Prim’s Algorithm
Select the shortest
edge connected to
any vertex already
connected.
ED 2
Prim’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the shortest
edge connected to
any vertex already
connected.
DC 4
Prim’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Select the shortest
edge connected to
any vertex already
connected.
CB 5 – forms a cycle
EF 5
Prim’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
Prim’s Algorithm
A
F
B
C
D
E
2
7
4
5
8 6 4
5
3
8
All vertices have been
connected.
The solution is
ED 2
AB 3
CD 4
AE 4
EF 5
Total weight of tree: 18
•Both algorithms will always give solutions with
the same length.
•They will usually select edges in a different order
– you must show this in your workings.
•Occasionally they will use different edges – this
may happen when you have to choose between
edges with the same length. In this case there is
more than one minimum connector for the
network.
USES OF BOTH ALGORITHM
THANK YOU

Contenu connexe

Tendances

KRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraKRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitra
guest1f4fb3
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
taimurkhan803
 

Tendances (20)

Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithms
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 
minimum spanning tree
minimum spanning tree minimum spanning tree
minimum spanning tree
 
Binary Search
Binary SearchBinary Search
Binary Search
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
KRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitraKRUSKAL'S algorithm from chaitra
KRUSKAL'S algorithm from chaitra
 
0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Shortest Path in Graph
Shortest Path in GraphShortest Path in Graph
Shortest Path in Graph
 
Single source stortest path bellman ford and dijkstra
Single source stortest path bellman ford and dijkstraSingle source stortest path bellman ford and dijkstra
Single source stortest path bellman ford and dijkstra
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
 
Floyd Warshall Algorithm
Floyd Warshall AlgorithmFloyd Warshall Algorithm
Floyd Warshall Algorithm
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 

En vedette

Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Prims Algorithm
Prims AlgorithmPrims Algorithm
Prims Algorithm
Sriram Raj
 
Application of greedy method
Application  of  greedy methodApplication  of  greedy method
Application of greedy method
Tech_MX
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
faisal2204
 
Review And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path AlgorithmsReview And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path Algorithms
Pawan Kumar Tiwari
 

En vedette (19)

Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
Prims Algorithm
Prims AlgorithmPrims Algorithm
Prims Algorithm
 
My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning tree
 
Kruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comKruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.com
 
Kruskal’s Algorithm
Kruskal’s AlgorithmKruskal’s Algorithm
Kruskal’s Algorithm
 
Greedy minimum spanning tree- prim's algorithm
Greedy minimum spanning tree- prim's algorithmGreedy minimum spanning tree- prim's algorithm
Greedy minimum spanning tree- prim's algorithm
 
Minimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree algorithms by ibrahim_alfayoumiMinimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree algorithms by ibrahim_alfayoumi
 
Application of greedy method
Application  of  greedy methodApplication  of  greedy method
Application of greedy method
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
 
Dijkstra’S Algorithm
Dijkstra’S AlgorithmDijkstra’S Algorithm
Dijkstra’S Algorithm
 
Review And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path AlgorithmsReview And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path Algorithms
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
 
Mst(engl)
Mst(engl)Mst(engl)
Mst(engl)
 
Kruskal’s algorithm
Kruskal’s algorithmKruskal’s algorithm
Kruskal’s algorithm
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
 
9 cm402.18
9 cm402.189 cm402.18
9 cm402.18
 

Similaire à Kruskal & Prim's Algorithm

IRC_Poster_WFTPElectrical_Final
IRC_Poster_WFTPElectrical_FinalIRC_Poster_WFTPElectrical_Final
IRC_Poster_WFTPElectrical_Final
Michael Bardwell
 

Similaire à Kruskal & Prim's Algorithm (20)

kruskal prim
kruskal primkruskal prim
kruskal prim
 
kruskal.ppt
kruskal.pptkruskal.ppt
kruskal.ppt
 
Network flow
Network flowNetwork flow
Network flow
 
prims and Kruskal 1.pdf
prims and Kruskal 1.pdfprims and Kruskal 1.pdf
prims and Kruskal 1.pdf
 
digital electronics Design of 101 sequence detector without overlapping for...
digital  electronics Design of 101 sequence detector without  overlapping for...digital  electronics Design of 101 sequence detector without  overlapping for...
digital electronics Design of 101 sequence detector without overlapping for...
 
3.7 GHz Microwave Amplifier Design
3.7 GHz Microwave Amplifier Design3.7 GHz Microwave Amplifier Design
3.7 GHz Microwave Amplifier Design
 
Catalog busbar ls 06. busduct presentation e series rev 2
Catalog busbar ls 06. busduct presentation e series rev 2Catalog busbar ls 06. busduct presentation e series rev 2
Catalog busbar ls 06. busduct presentation e series rev 2
 
Catalog busbar ls 06. busduct presentation e series rev 2
Catalog busbar ls 06. busduct presentation e series rev 2Catalog busbar ls 06. busduct presentation e series rev 2
Catalog busbar ls 06. busduct presentation e series rev 2
 
DATA STRUCTURE AND ALGORITHM LMS MST KRUSKAL'S ALGORITHM
DATA STRUCTURE AND ALGORITHM LMS MST KRUSKAL'S ALGORITHMDATA STRUCTURE AND ALGORITHM LMS MST KRUSKAL'S ALGORITHM
DATA STRUCTURE AND ALGORITHM LMS MST KRUSKAL'S ALGORITHM
 
PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...
PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...
PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...
 
Making a peaking filter by Julio Marqués
Making a peaking filter by Julio MarquésMaking a peaking filter by Julio Marqués
Making a peaking filter by Julio Marqués
 
Ecet 110 Success Begins / snaptutorial.com
Ecet 110 Success Begins / snaptutorial.comEcet 110 Success Begins / snaptutorial.com
Ecet 110 Success Begins / snaptutorial.com
 
Heat Shrink Cable Joints & Cable Terminations LV HV, 6.6kV 11kV 33kV - SPS Ca...
Heat Shrink Cable Joints & Cable Terminations LV HV, 6.6kV 11kV 33kV - SPS Ca...Heat Shrink Cable Joints & Cable Terminations LV HV, 6.6kV 11kV 33kV - SPS Ca...
Heat Shrink Cable Joints & Cable Terminations LV HV, 6.6kV 11kV 33kV - SPS Ca...
 
DB Cable
DB CableDB Cable
DB Cable
 
Setp by step design of transformer
Setp by step design of transformerSetp by step design of transformer
Setp by step design of transformer
 
IRC_Poster_WFTPElectrical_Final
IRC_Poster_WFTPElectrical_FinalIRC_Poster_WFTPElectrical_Final
IRC_Poster_WFTPElectrical_Final
 
Concurrent Triple Band Low Noise Amplifier Design
Concurrent Triple Band Low Noise Amplifier DesignConcurrent Triple Band Low Noise Amplifier Design
Concurrent Triple Band Low Noise Amplifier Design
 
Metal Detector Project
Metal Detector ProjectMetal Detector Project
Metal Detector Project
 
07
0707
07
 
Vikas marka.pptx
Vikas marka.pptxVikas marka.pptx
Vikas marka.pptx
 

Dernier

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Dernier (20)

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 

Kruskal & Prim's Algorithm

  • 2. KRUSKAL’S ALGORITHM & PRIM’S ALGORITHM Presented by : Asif Ahmed Sajal #ID : 142-15-3710 Irin Afroze #ID : 142-15 3746
  • 3. Minimum Connector Algorithms Kruskal’s algorithm 1. Select the shortest edge in a network 2. Select the next shortest edge which does not create a cycle 3. Repeat step 2 until all vertices have been connected Prim’s algorithm 1. Select any vertex 2. Select the shortest edge connected to that vertex 3. Select the shortest edge connected to any vertex already connected 4. Repeat step 3 until all vertices have been connected
  • 4. A CABLE COMPANY WANT TO CONNECT FIVE VILLAGES TO THEIR NETWORK WHICH CURRENTLY EXTENDS TO THE MARKET TOWN OF AVONFORD. WHAT IS THE MINIMUM LENGTH OF CABLE NEEDED? Avonford Fingley Brinleigh Cornwell Donster Edan 2 7 4 5 8 6 4 5 3 8 Example
  • 5. We model the situation as a network, then the problem is to find the minimum connector for the network A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 6. A F B C D E 2 7 4 5 8 6 4 5 3 8 List the edges in order of size: ED 2 AB 3 AE 4 CD 4 BC 5 EF 5 CF 6 AF 7 BF 8 CF 8 Kruskal’s Algorithm
  • 7. Select the shortest edge in the network ED 2 Kruskal’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 8. Select the next shortest edge which does not create a cycle ED 2 AB 3 Kruskal’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 9. Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 (or AE 4) Kruskal’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 10. Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 AE 4 Kruskal’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 11. Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 AE 4 BC 5 – forms a cycle EF 5 Kruskal’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 12. All vertices have been connected. The solution is ED 2 AB 3 CD 4 AE 4 EF 5 Total weight of tree: 18 Kruskal’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 13. A F B C D E 2 7 4 5 8 6 4 5 3 8 Select any vertex A Select the shortest edge connected to that vertex AB 3 Prim’s Algorithm
  • 14. A F B C D E 2 7 4 5 8 6 4 5 3 8 Select the shortest edge connected to any vertex already connected. AE 4 Prim’s Algorithm
  • 15. Select the shortest edge connected to any vertex already connected. ED 2 Prim’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 16. Select the shortest edge connected to any vertex already connected. DC 4 Prim’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 17. Select the shortest edge connected to any vertex already connected. CB 5 – forms a cycle EF 5 Prim’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 18. Prim’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8 All vertices have been connected. The solution is ED 2 AB 3 CD 4 AE 4 EF 5 Total weight of tree: 18
  • 19. •Both algorithms will always give solutions with the same length. •They will usually select edges in a different order – you must show this in your workings. •Occasionally they will use different edges – this may happen when you have to choose between edges with the same length. In this case there is more than one minimum connector for the network. USES OF BOTH ALGORITHM