SlideShare a Scribd company logo
1 of 18
Minimum spanning trees
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.
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
AB 3
AE 4
ED 2
DC 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.
Some points to note

More Related Content

Similar to kruskal.ppt

Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....
Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....
Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....SintooChauhan6
 
Ecet 110 Success Begins / snaptutorial.com
Ecet 110 Success Begins / snaptutorial.comEcet 110 Success Begins / snaptutorial.com
Ecet 110 Success Begins / snaptutorial.comWilliamsTaylorzm
 
3.7 GHz Microwave Amplifier Design
3.7 GHz Microwave Amplifier Design3.7 GHz Microwave Amplifier Design
3.7 GHz Microwave Amplifier DesignRashad Alsaffar
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmAcad
 
Basics of electrical_and_electronics-2019-syllabus-ktustudents.in
Basics of electrical_and_electronics-2019-syllabus-ktustudents.inBasics of electrical_and_electronics-2019-syllabus-ktustudents.in
Basics of electrical_and_electronics-2019-syllabus-ktustudents.inSreepadam Padam
 
A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...
A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...
A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...aiclab
 
2001_Book_FundamentalsOfPowerElectronics.pdf
2001_Book_FundamentalsOfPowerElectronics.pdf2001_Book_FundamentalsOfPowerElectronics.pdf
2001_Book_FundamentalsOfPowerElectronics.pdfLucianoCastelli4
 
Setp by step design of transformer
Setp by step design of transformerSetp by step design of transformer
Setp by step design of transformerbinodsahu8
 
Power system slide notes
Power system slide notesPower system slide notes
Power system slide notesmichaeljmack
 
Chapter 15
Chapter 15Chapter 15
Chapter 15Tha Mike
 
Network_theory_by_alaxander_and_sadiku.pdf
Network_theory_by_alaxander_and_sadiku.pdfNetwork_theory_by_alaxander_and_sadiku.pdf
Network_theory_by_alaxander_and_sadiku.pdfparameshwar7
 
AutoCad warehouse project
AutoCad warehouse projectAutoCad warehouse project
AutoCad warehouse projectSandu Stefan
 
2.4 mst prim &kruskal demo
2.4 mst  prim &kruskal demo2.4 mst  prim &kruskal demo
2.4 mst prim &kruskal demoKrish_ver2
 
Substation grounding grid design using Alternative Transients Program-ATP and...
Substation grounding grid design using Alternative Transients Program-ATP and...Substation grounding grid design using Alternative Transients Program-ATP and...
Substation grounding grid design using Alternative Transients Program-ATP and...Jose Dariel Arcila
 

Similar to kruskal.ppt (20)

Network flow
Network flowNetwork flow
Network flow
 
Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....
Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....
Decision Maths 1 Chapter 3 Algorithms on Graphs (including Floyd A2 content)....
 
Ecet 110 Success Begins / snaptutorial.com
Ecet 110 Success Begins / snaptutorial.comEcet 110 Success Begins / snaptutorial.com
Ecet 110 Success Begins / snaptutorial.com
 
3.7 GHz Microwave Amplifier Design
3.7 GHz Microwave Amplifier Design3.7 GHz Microwave Amplifier Design
3.7 GHz Microwave Amplifier Design
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithm
 
OptiCal & LUMOS Networks
OptiCal & LUMOS NetworksOptiCal & LUMOS Networks
OptiCal & LUMOS Networks
 
Basics of electrical_and_electronics-2019-syllabus-ktustudents.in
Basics of electrical_and_electronics-2019-syllabus-ktustudents.inBasics of electrical_and_electronics-2019-syllabus-ktustudents.in
Basics of electrical_and_electronics-2019-syllabus-ktustudents.in
 
A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...
A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...
A 64Gb/s PAM-4 Transmitter with 4-Tap FFE and 2.26pJ/b Energy Efficiency in 2...
 
2001_Book_FundamentalsOfPowerElectronics.pdf
2001_Book_FundamentalsOfPowerElectronics.pdf2001_Book_FundamentalsOfPowerElectronics.pdf
2001_Book_FundamentalsOfPowerElectronics.pdf
 
Rc detailing-to-ec2
Rc detailing-to-ec2Rc detailing-to-ec2
Rc detailing-to-ec2
 
Setp by step design of transformer
Setp by step design of transformerSetp by step design of transformer
Setp by step design of transformer
 
Power system slide notes
Power system slide notesPower system slide notes
Power system slide notes
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Network_theory_by_alaxander_and_sadiku.pdf
Network_theory_by_alaxander_and_sadiku.pdfNetwork_theory_by_alaxander_and_sadiku.pdf
Network_theory_by_alaxander_and_sadiku.pdf
 
AutoCad warehouse project
AutoCad warehouse projectAutoCad warehouse project
AutoCad warehouse project
 
tutorial 3.pptx
tutorial 3.pptxtutorial 3.pptx
tutorial 3.pptx
 
Transformer
TransformerTransformer
Transformer
 
2.4 mst prim &kruskal demo
2.4 mst  prim &kruskal demo2.4 mst  prim &kruskal demo
2.4 mst prim &kruskal demo
 
19 primkruskal
19 primkruskal19 primkruskal
19 primkruskal
 
Substation grounding grid design using Alternative Transients Program-ATP and...
Substation grounding grid design using Alternative Transients Program-ATP and...Substation grounding grid design using Alternative Transients Program-ATP and...
Substation grounding grid design using Alternative Transients Program-ATP and...
 

More from erosslo

tema1.ppt
tema1.ppttema1.ppt
tema1.ppterosslo
 
Java2-Clases.ppt
Java2-Clases.pptJava2-Clases.ppt
Java2-Clases.ppterosslo
 
[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf
[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf
[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdferosslo
 
Koldijk et. al - 2018 - Detecting Work Stress.pdf
Koldijk et. al - 2018 - Detecting Work Stress.pdfKoldijk et. al - 2018 - Detecting Work Stress.pdf
Koldijk et. al - 2018 - Detecting Work Stress.pdferosslo
 
Emotion semantics show both cultural variation anduniversal structure.pdf
Emotion semantics show both cultural variation anduniversal structure.pdfEmotion semantics show both cultural variation anduniversal structure.pdf
Emotion semantics show both cultural variation anduniversal structure.pdferosslo
 
Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...
Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...
Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...erosslo
 

More from erosslo (6)

tema1.ppt
tema1.ppttema1.ppt
tema1.ppt
 
Java2-Clases.ppt
Java2-Clases.pptJava2-Clases.ppt
Java2-Clases.ppt
 
[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf
[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf
[Robert_B._Cialdini]_Influence__The_Psychology_of_(z-lib.org).pdf
 
Koldijk et. al - 2018 - Detecting Work Stress.pdf
Koldijk et. al - 2018 - Detecting Work Stress.pdfKoldijk et. al - 2018 - Detecting Work Stress.pdf
Koldijk et. al - 2018 - Detecting Work Stress.pdf
 
Emotion semantics show both cultural variation anduniversal structure.pdf
Emotion semantics show both cultural variation anduniversal structure.pdfEmotion semantics show both cultural variation anduniversal structure.pdf
Emotion semantics show both cultural variation anduniversal structure.pdf
 
Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...
Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...
Predicting longterm-dynamics-of-soil-salinity-and-sodicity-on-a-global-scale2...
 

Recently uploaded

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 

kruskal.ppt

  • 2. 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
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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
  • 7. 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
  • 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. Select the shortest edge connected to any vertex already connected. EF 5 Prim’s Algorithm A F B C D E 2 7 4 5 8 6 4 5 3 8
  • 17. 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 AB 3 AE 4 ED 2 DC 4 EF 5 Total weight of tree: 18
  • 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. Some points to note