SlideShare a Scribd company logo
1 of 34
D.STEFFY(140071601072)
R.TASNIM TABASUM(140071601080)
THIRD YEAR CSE-B
ALGORITHM DESIGN AND ANALYSIS LAB(CSB 3105)
B.S.ABDUR RAHMAN UNIVERSITY
DONE BY:
1
 Problem Identification
 Definition Of Spanning Tree &Minimum Spanning Tree
 Algorithms used and its design
 Algorithm analysis
 Scenario Explanation
 Comparison between prim’s and Kruskal's algorithm
 Properties of Minimum Spanning Tree
2
3
PROBLEM IDENTIFICATION
 A cable TV company is laying cable in a new neighborhood. There is a condition
for them to bury the cable only along certain paths .
 In those paths, some might be very expensive to bury the cable because they are
longer, or require the cable to be buried deeper.
 A minimum spanning tree is a spanning tree which has a minimum total cost.
4
Definition : Spanning Tree & Minimum Spanning
Tree
 A spanning Tree of a connected graph G is its connected sub graph that
contains all the vertices of the graph.
 A Minimum Spanning Tree of a weighted connected graph G is its spanning
tree of the smallest weight where the weight of the tree is defined as the sum
of the weights on all its edges.
 A Minimum Spanning Tree exists if and only if G is connected.
5
6
Algorithms used To Find Minimum Spanning Tree
There are two algorithms used to find the minimum spanning tree of a
connected graph G.
7
Prim’s Algorithm
 Prim’s algorithm is one of the way to compute a minimum spanning tree.
 Initially discovered in 1930 by Vojtěch Jarník, then rediscovered in 1957 by
Robert C. Prim.
 This algorithm begins with a set U initialized to{1}.It then grows a spanning tree ,
one edge at a time.
 At each step , it finds a shortest edge (u ,v ) such that the cost of (u , v) is the
smallest among all edges , where u is in Minimum Spanning Tree and V is not in
Minimum Spanning Tree
 Complexity:O(v2)
8
Kruskal’s Algorithm
Step 1: Sort all edges in non-decreasing order of their weight.
Step 2: Pick the smallest edge.
Step 3:Check if it forms a cycle with Spanning Tree formed so far.
Step 4:If cycle is not formed , include this edge else discard it.
Step 5:Repeat Union-Find algorithm until there are V-1 edges in the spanning tree.
Complexity:O(ElogV) 9
10
ALGORITHMS
Two algorithms are used to find minimum spanning tree.
11
12
PRIM’S ALGORITHM
Place the starting node in the tree.
Repeat until all nodes are in the tree are visited:
Find all edges which is adjacent to source vertex.
Of those edges, choose one with the minimum weight.
Add that edge and the connected node to the tree.
A B
C
13
E
ANALYSIS
 Prim’s algorithm complexity varies based on the representation of the graph.
 In adjacency matrix representation, prim’s algorithm requires O(V2) running
time.
 Because, in adjacency representation linearly searching an array of weights to
find the minimum weight edge and to add that edge will require O(v2) running
time.
14
15
ALGORITHM

16
CONTINUES………
17
18
Problem : Laying TV Cable
Central office
19
Graph G
Central office
Expensive!!!! & cost:94
18
3
5
1
210
3
1
16
8
9
5
7
4
2A
B
C
D
E
F
G
H
V Know
n
dv Pv
A 0 0 0
B 0 ∞ 0
C 0 ∞ 0
D 0 ∞ 0
E 0 ∞ 0
F 0 ∞ 0
G 0 ∞ 0
H 0 ∞ 0
CO 0 ∞ 0
20
WHY PRIM’S ALGORITHM?
Graph is a connected graph
Since ,Graph which represents this scenario is looks like a dense graph.
Prim’s algorithm works well in dense graphs.
Prim’s algorithm complexity will be O(v2)
21
Problem : Laying TV Cable->Step 1
Central office
A
B
C
D
E
F
G
H
Source vertex
22
Problem : Laying TV Cable->step 2
Central office
A
B
C
D
E
F
G
H
1
V Known dv Pv
A 1 0 0
B 0 1 A
C 0 ∞ 0
D 0 ∞ 0
E 0 ∞ 0
F 0 ∞ 0
G 0 ∞ 0
H 0 ∞ 0
CO 0 ∞ 0
23
Problem : Laying TV Cable
Central office
A
B
C
D
E
F
G
H
1
3
V Known dv Pv
A 1 0 0
B 1 1 A
C 0 3 B
D 0 ∞ 0
E 0 ∞ 0
F 0 ∞ 0
G 0 ∞ 0
H 0 ∞ 0
CO 0 ∞ 0
24
Problem : Laying TV Cable->step 3
Central office
A
B
C
D
E
F
G
H
1
3
5
V Known dv Pv
A 1 0 0
B 1 1 A
C 1 3 B
D 0 5 c
E 0 ∞ 0
F 0 ∞ 0
G 0 ∞ 0
H 0 ∞ 0
CO 0 ∞ 025
Final step : Minimum Spanning Tree
B
C
D
E
H
G
F
Central office
A
Minimum Cost=24
1
4
3
3
1
5
2
5
V Known dv Pv
A 1 0 0
B 1 1 A
C 1 3 B
D 1 5 C
E 1 3 CO
F 1 5 E
G 1 2 F
H 1 1 G
CO 1 4 D
26
27
COMPARISON
PRIM’S ALGORITHM
Initializes with node
MST grows like a tree
Graph must be a connected
graph
Time complexity is O(v2)
Works well in dense graphs
KRUSKAL’S ALGORITHM
Initializes with an edge
MST grows like a forest
Works well in non connected
graphs also.
Time complexity is O(E log E)
Works well in sparse graphs
28
29
Properties Of Minimum Spanning Tree
1.Possible Multiplicity:
 There may be several minimum spanning trees of the same weight having
a minimum number of edges
 If all the edge weights of a given graph are the same, then every spanning
tree of that graph is minimum.
 If there are n vertices in the graph, then each minimum spanning tree has
n-1 edges.
30
Example:
Graph G Minimum spanning tree 1 Minimum spanning tree 2
31
Continues….
2.Uniqueness:
 If each edge has a distinct weight then there will be only one, unique minimum
spanning tree.
3.Cyclic property:
 For any cycle C in the graph G , if the weight of an edge of e of c is larger than the
individual weights of all other edges of c , then this edge cannot belong to MST.
C 32
Continues….
4.Minimum Cost Edge:
If the minimum cost edge e of a graph is unique, then this edge is
included in any MST.
33
34

More Related Content

What's hot

Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treeoneous
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's AlgorithmArijitDhali
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm sachin varun
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmAcad
 
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 Sahil Kumar
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)Madhu Bala
 
My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning treeAlona Salva
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approachAkash Sethiya
 
Prims & kruskal algorithms
Prims & kruskal algorithmsPrims & kruskal algorithms
Prims & kruskal algorithmsAyesha Tahir
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentationSubid Biswas
 
DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxArbabMaalik
 

What's hot (20)

Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithm
 
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
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
 
My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning tree
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approach
 
Spanning trees
Spanning treesSpanning trees
Spanning trees
 
Prims & kruskal algorithms
Prims & kruskal algorithmsPrims & kruskal algorithms
Prims & kruskal algorithms
 
BFS
BFSBFS
BFS
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
 
DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptx
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
Graph algorithm
Graph algorithmGraph algorithm
Graph algorithm
 

Viewers also liked

Presentationfhs 110808045337-phpapp02
Presentationfhs 110808045337-phpapp02Presentationfhs 110808045337-phpapp02
Presentationfhs 110808045337-phpapp02Punit_Agarwal
 
Flow control
Flow controlFlow control
Flow controlSTEFFY D
 
%22Cracking India%22 Unit Plan and Analysis
%22Cracking India%22 Unit Plan and Analysis%22Cracking India%22 Unit Plan and Analysis
%22Cracking India%22 Unit Plan and AnalysisGriffin Muckley
 
Lores BLANK Catalog
Lores BLANK CatalogLores BLANK Catalog
Lores BLANK CatalogJoyce Orloff
 
Atul Joshi - Oct 2016
Atul Joshi - Oct 2016Atul Joshi - Oct 2016
Atul Joshi - Oct 2016Atul Joshi
 
Nahha Course Catalog (2)
Nahha Course Catalog (2)Nahha Course Catalog (2)
Nahha Course Catalog (2)iHawaiidigital
 
Bitcoin weekly update oct 12th oct 18th
Bitcoin weekly update oct 12th   oct 18thBitcoin weekly update oct 12th   oct 18th
Bitcoin weekly update oct 12th oct 18th99Coins ltd.
 
SWISS BULLION TABLES
SWISS BULLION TABLESSWISS BULLION TABLES
SWISS BULLION TABLESYesh Lazarte
 
Trane: Pasos para automatizar un hogar y oficina sin cables
Trane: Pasos para automatizar un hogar y oficina sin cables Trane: Pasos para automatizar un hogar y oficina sin cables
Trane: Pasos para automatizar un hogar y oficina sin cables Trane México
 

Viewers also liked (13)

Abeer Barghouti 2
Abeer Barghouti 2Abeer Barghouti 2
Abeer Barghouti 2
 
Presentationfhs 110808045337-phpapp02
Presentationfhs 110808045337-phpapp02Presentationfhs 110808045337-phpapp02
Presentationfhs 110808045337-phpapp02
 
Flow control
Flow controlFlow control
Flow control
 
StrenghtsFinder
StrenghtsFinderStrenghtsFinder
StrenghtsFinder
 
%22Cracking India%22 Unit Plan and Analysis
%22Cracking India%22 Unit Plan and Analysis%22Cracking India%22 Unit Plan and Analysis
%22Cracking India%22 Unit Plan and Analysis
 
Hirches_6Pg_v2
Hirches_6Pg_v2Hirches_6Pg_v2
Hirches_6Pg_v2
 
Lores BLANK Catalog
Lores BLANK CatalogLores BLANK Catalog
Lores BLANK Catalog
 
Atul Joshi - Oct 2016
Atul Joshi - Oct 2016Atul Joshi - Oct 2016
Atul Joshi - Oct 2016
 
Nahha Course Catalog (2)
Nahha Course Catalog (2)Nahha Course Catalog (2)
Nahha Course Catalog (2)
 
Bitcoin weekly update oct 12th oct 18th
Bitcoin weekly update oct 12th   oct 18thBitcoin weekly update oct 12th   oct 18th
Bitcoin weekly update oct 12th oct 18th
 
Holy prophet (S.A.W)
Holy prophet (S.A.W)Holy prophet (S.A.W)
Holy prophet (S.A.W)
 
SWISS BULLION TABLES
SWISS BULLION TABLESSWISS BULLION TABLES
SWISS BULLION TABLES
 
Trane: Pasos para automatizar un hogar y oficina sin cables
Trane: Pasos para automatizar un hogar y oficina sin cables Trane: Pasos para automatizar un hogar y oficina sin cables
Trane: Pasos para automatizar un hogar y oficina sin cables
 

Similar to Minimum spanning tree

Ijciras1101
Ijciras1101Ijciras1101
Ijciras1101zhendy94
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...KUSHDHIRRA2111026030
 
Shortest path by using suitable algorithm.pdf
Shortest path by using suitable algorithm.pdfShortest path by using suitable algorithm.pdf
Shortest path by using suitable algorithm.pdfzefergaming
 
Comparative Report Ed098
Comparative Report Ed098Comparative Report Ed098
Comparative Report Ed098mikebrowl
 
Minimal spanning tree class 15
Minimal spanning tree class 15Minimal spanning tree class 15
Minimal spanning tree class 15Kumar
 
Ram minimum spanning tree
Ram   minimum spanning treeRam   minimum spanning tree
Ram minimum spanning treeRama Prasath A
 
Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9chidabdu
 
OTP, Phishing, QR code, Shares, Visual Cryptography.
OTP, Phishing, QR code, Shares, Visual Cryptography.OTP, Phishing, QR code, Shares, Visual Cryptography.
OTP, Phishing, QR code, Shares, Visual Cryptography.IJERA Editor
 
Skiena algorithm 2007 lecture13 minimum spanning trees
Skiena algorithm 2007 lecture13 minimum spanning treesSkiena algorithm 2007 lecture13 minimum spanning trees
Skiena algorithm 2007 lecture13 minimum spanning treeszukun
 
Network and Tree in Graph Theory
Network and Tree in Graph TheoryNetwork and Tree in Graph Theory
Network and Tree in Graph TheoryRabin BK
 
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)Mohanlal Sukhadia University (MLSU)
 

Similar to Minimum spanning tree (20)

8_MST_pptx.pptx
8_MST_pptx.pptx8_MST_pptx.pptx
8_MST_pptx.pptx
 
Ijciras1101
Ijciras1101Ijciras1101
Ijciras1101
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
 
Shortest path by using suitable algorithm.pdf
Shortest path by using suitable algorithm.pdfShortest path by using suitable algorithm.pdf
Shortest path by using suitable algorithm.pdf
 
Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
 
Comparative Report Ed098
Comparative Report Ed098Comparative Report Ed098
Comparative Report Ed098
 
1 sollins algorithm
1 sollins algorithm1 sollins algorithm
1 sollins algorithm
 
Minimal spanning tree class 15
Minimal spanning tree class 15Minimal spanning tree class 15
Minimal spanning tree class 15
 
Ram minimum spanning tree
Ram   minimum spanning treeRam   minimum spanning tree
Ram minimum spanning tree
 
Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9
 
Daa chapter13
Daa chapter13Daa chapter13
Daa chapter13
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
OTP, Phishing, QR code, Shares, Visual Cryptography.
OTP, Phishing, QR code, Shares, Visual Cryptography.OTP, Phishing, QR code, Shares, Visual Cryptography.
OTP, Phishing, QR code, Shares, Visual Cryptography.
 
Siegel
SiegelSiegel
Siegel
 
DAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptxDAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptx
 
Skiena algorithm 2007 lecture13 minimum spanning trees
Skiena algorithm 2007 lecture13 minimum spanning treesSkiena algorithm 2007 lecture13 minimum spanning trees
Skiena algorithm 2007 lecture13 minimum spanning trees
 
17 prims-kruskals (1)
17 prims-kruskals (1)17 prims-kruskals (1)
17 prims-kruskals (1)
 
Network and Tree in Graph Theory
Network and Tree in Graph TheoryNetwork and Tree in Graph Theory
Network and Tree in Graph Theory
 
Data structure
Data structureData structure
Data structure
 
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)
 

Recently uploaded

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...Amil Baba Dawood bangali
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Industrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIESIndustrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIESNarmatha D
 

Recently uploaded (20)

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Industrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIESIndustrial Safety Unit-I SAFETY TERMINOLOGIES
Industrial Safety Unit-I SAFETY TERMINOLOGIES
 

Minimum spanning tree

  • 1. D.STEFFY(140071601072) R.TASNIM TABASUM(140071601080) THIRD YEAR CSE-B ALGORITHM DESIGN AND ANALYSIS LAB(CSB 3105) B.S.ABDUR RAHMAN UNIVERSITY DONE BY: 1
  • 2.  Problem Identification  Definition Of Spanning Tree &Minimum Spanning Tree  Algorithms used and its design  Algorithm analysis  Scenario Explanation  Comparison between prim’s and Kruskal's algorithm  Properties of Minimum Spanning Tree 2
  • 3. 3
  • 4. PROBLEM IDENTIFICATION  A cable TV company is laying cable in a new neighborhood. There is a condition for them to bury the cable only along certain paths .  In those paths, some might be very expensive to bury the cable because they are longer, or require the cable to be buried deeper.  A minimum spanning tree is a spanning tree which has a minimum total cost. 4
  • 5. Definition : Spanning Tree & Minimum Spanning Tree  A spanning Tree of a connected graph G is its connected sub graph that contains all the vertices of the graph.  A Minimum Spanning Tree of a weighted connected graph G is its spanning tree of the smallest weight where the weight of the tree is defined as the sum of the weights on all its edges.  A Minimum Spanning Tree exists if and only if G is connected. 5
  • 6. 6
  • 7. Algorithms used To Find Minimum Spanning Tree There are two algorithms used to find the minimum spanning tree of a connected graph G. 7
  • 8. Prim’s Algorithm  Prim’s algorithm is one of the way to compute a minimum spanning tree.  Initially discovered in 1930 by Vojtěch Jarník, then rediscovered in 1957 by Robert C. Prim.  This algorithm begins with a set U initialized to{1}.It then grows a spanning tree , one edge at a time.  At each step , it finds a shortest edge (u ,v ) such that the cost of (u , v) is the smallest among all edges , where u is in Minimum Spanning Tree and V is not in Minimum Spanning Tree  Complexity:O(v2) 8
  • 9. Kruskal’s Algorithm Step 1: Sort all edges in non-decreasing order of their weight. Step 2: Pick the smallest edge. Step 3:Check if it forms a cycle with Spanning Tree formed so far. Step 4:If cycle is not formed , include this edge else discard it. Step 5:Repeat Union-Find algorithm until there are V-1 edges in the spanning tree. Complexity:O(ElogV) 9
  • 10. 10
  • 11. ALGORITHMS Two algorithms are used to find minimum spanning tree. 11
  • 12. 12
  • 13. PRIM’S ALGORITHM Place the starting node in the tree. Repeat until all nodes are in the tree are visited: Find all edges which is adjacent to source vertex. Of those edges, choose one with the minimum weight. Add that edge and the connected node to the tree. A B C 13 E
  • 14. ANALYSIS  Prim’s algorithm complexity varies based on the representation of the graph.  In adjacency matrix representation, prim’s algorithm requires O(V2) running time.  Because, in adjacency representation linearly searching an array of weights to find the minimum weight edge and to add that edge will require O(v2) running time. 14
  • 15. 15
  • 18. 18
  • 19. Problem : Laying TV Cable Central office 19
  • 20. Graph G Central office Expensive!!!! & cost:94 18 3 5 1 210 3 1 16 8 9 5 7 4 2A B C D E F G H V Know n dv Pv A 0 0 0 B 0 ∞ 0 C 0 ∞ 0 D 0 ∞ 0 E 0 ∞ 0 F 0 ∞ 0 G 0 ∞ 0 H 0 ∞ 0 CO 0 ∞ 0 20
  • 21. WHY PRIM’S ALGORITHM? Graph is a connected graph Since ,Graph which represents this scenario is looks like a dense graph. Prim’s algorithm works well in dense graphs. Prim’s algorithm complexity will be O(v2) 21
  • 22. Problem : Laying TV Cable->Step 1 Central office A B C D E F G H Source vertex 22
  • 23. Problem : Laying TV Cable->step 2 Central office A B C D E F G H 1 V Known dv Pv A 1 0 0 B 0 1 A C 0 ∞ 0 D 0 ∞ 0 E 0 ∞ 0 F 0 ∞ 0 G 0 ∞ 0 H 0 ∞ 0 CO 0 ∞ 0 23
  • 24. Problem : Laying TV Cable Central office A B C D E F G H 1 3 V Known dv Pv A 1 0 0 B 1 1 A C 0 3 B D 0 ∞ 0 E 0 ∞ 0 F 0 ∞ 0 G 0 ∞ 0 H 0 ∞ 0 CO 0 ∞ 0 24
  • 25. Problem : Laying TV Cable->step 3 Central office A B C D E F G H 1 3 5 V Known dv Pv A 1 0 0 B 1 1 A C 1 3 B D 0 5 c E 0 ∞ 0 F 0 ∞ 0 G 0 ∞ 0 H 0 ∞ 0 CO 0 ∞ 025
  • 26. Final step : Minimum Spanning Tree B C D E H G F Central office A Minimum Cost=24 1 4 3 3 1 5 2 5 V Known dv Pv A 1 0 0 B 1 1 A C 1 3 B D 1 5 C E 1 3 CO F 1 5 E G 1 2 F H 1 1 G CO 1 4 D 26
  • 27. 27
  • 28. COMPARISON PRIM’S ALGORITHM Initializes with node MST grows like a tree Graph must be a connected graph Time complexity is O(v2) Works well in dense graphs KRUSKAL’S ALGORITHM Initializes with an edge MST grows like a forest Works well in non connected graphs also. Time complexity is O(E log E) Works well in sparse graphs 28
  • 29. 29
  • 30. Properties Of Minimum Spanning Tree 1.Possible Multiplicity:  There may be several minimum spanning trees of the same weight having a minimum number of edges  If all the edge weights of a given graph are the same, then every spanning tree of that graph is minimum.  If there are n vertices in the graph, then each minimum spanning tree has n-1 edges. 30
  • 31. Example: Graph G Minimum spanning tree 1 Minimum spanning tree 2 31
  • 32. Continues…. 2.Uniqueness:  If each edge has a distinct weight then there will be only one, unique minimum spanning tree. 3.Cyclic property:  For any cycle C in the graph G , if the weight of an edge of e of c is larger than the individual weights of all other edges of c , then this edge cannot belong to MST. C 32
  • 33. Continues…. 4.Minimum Cost Edge: If the minimum cost edge e of a graph is unique, then this edge is included in any MST. 33
  • 34. 34

Editor's Notes

  1. 1
  2. 3
  3. 6
  4. 10
  5. 12
  6. 15
  7. 18
  8. 27
  9. 29