SlideShare a Scribd company logo
4
Most read
13
Most read
16
Most read
PRIM’S AND KRUSKAL’S
ALGORITHM
• Gauri Bharat (24)
• Anushka Bhave (25)
• Dhairyashil Desai (37)
• Jaydeep Desai(38)
Content
01 Prim’s Algorithm
02 Application of Prim’s algorithm
03 Kruskal’s algorithm
04 Application of Kruskal’s Algorithm
Prim’s Algorithm
Basic terms
01
03
02
sub-graph of an
undirected and a
connected graph, which
includes all the vertices of
the graph having a
minimum possible
number of edges.
Spanning tree
Greedy Algorithm works by making the
decision that seems most promising at
any moment; it never reconsiders this
decision, whatever situation may arise
later.
Greedy algorithm
spanning tree in which
the sum of the weight of
the edges is as minimum
as possible.
Minimum spanning tree
Steps for prim’s Algorithm
Choose a vertex
and find shortest
edge from it
Mark this edge
as visited and
add to spanning
tree
Select another
non visited edge
with the minimum
weight
Repeat the process
till we get spanning
tree with all
vertices
Prims Application
Network design
telephone, electrical, hydraulic,
TV cable, computer, road
PRIM’S AND KRUSKAL’S  ALGORITHM
Google map
network
Cluster Analysis
Kruskal’s Algorithm
Minimum Spanning
Tree
• Finds a subset of the edges that forms
a tree that includes every vertex, where
the total weight of all the edges in the tr
ee is minimized
• It is a greedy algorithm in graph theory
Applications of Kruskal’s Algorithm
Reducing
data
storage
(amino
acids)
Cluster
analysis
Network
Design
salesman
Problems
.
Kruskal’s algorithm
applications
On your trip to Venice, you plan to
visit all the important world heritage
sites but are short on time. To make
your itinerary work, you decide to use
Kruskal’s algorithm using
disjoint sets
Kruskals algorithm
Application
Cannar
egio
Ponte
Scalzi
Santa
Corce
Dell ‘Or
to
Ferrovi
a
Piazzal
e Roma
San Po
lo
Dorso
Duro
San M
arco
St. Mar
k Basil
ica
Castell
o
Arsena
le
A B C D E F G H I J K L
B,C I,J B,E C,G G,I C,D K,L E,F A,B A,C
1 1 2 2 2 2 3 4 6 6
A,D E,C J,L F,H F,G H,I I,K D,J G,H H,K
6 7 8 10 11 12 16 18 22 25
Remove all loops and parallel
edges So for the given map,
we have a parallel edge runni
ng between Madonna dell’Ort
o (D) to St. Mark Basilica (J),
which is of length 2.4kms(240
0mts).
We will remove the parallel ro
ad and keep the 1.8km (1800
m) length for representation
Differences
Prims algorithm
It start to build MST from any node
Selects shortest edge connected to that
vertex
Prims algorithm is faster for dense graphs
Kruskal’s algorithm
It start to build the MST from minimum
weighted edge in the graph
Selects next shortest edge which does not
create any cycle
Kruskal’s algorithm is faster for sparse
graphs
Thank you

More Related Content

PPTX
A presentation on prim's and kruskal's algorithm
PPTX
Prims and kruskal algorithms
PDF
Trees, Binary Search Tree, AVL Tree in Data Structures
PPT
Breadth first search and depth first search
PPTX
Kruskal's algorithm
PDF
N Queens problem
PPT
Graph coloring problem
PPTX
Kruskal’s Algorithm
A presentation on prim's and kruskal's algorithm
Prims and kruskal algorithms
Trees, Binary Search Tree, AVL Tree in Data Structures
Breadth first search and depth first search
Kruskal's algorithm
N Queens problem
Graph coloring problem
Kruskal’s Algorithm

What's hot (20)

PPTX
Backtracking
PDF
Prims Algorithm
PDF
All pairs shortest path algorithm
PPTX
Binary Search Tree in Data Structure
PPTX
Kruskal Algorithm
PPT
Priority queues
PPTX
Tree traversal techniques
PDF
Minimum spanning tree
PPTX
Data structures
PPTX
Multistage graph unit 4 of algorithm.ppt
PPTX
Minimum Spanning Tree
PPT
Singly link list
PPT
Backtracking Algorithm.ppt
PPTX
Trees data structure
PPTX
N queen problem
PPTX
Hash table in data structure and algorithm
PPTX
Minimum spanning Tree
PPT
Prim's Algorithm on minimum spanning tree
PPTX
Hashing
PPTX
Tree - Data Structure
Backtracking
Prims Algorithm
All pairs shortest path algorithm
Binary Search Tree in Data Structure
Kruskal Algorithm
Priority queues
Tree traversal techniques
Minimum spanning tree
Data structures
Multistage graph unit 4 of algorithm.ppt
Minimum Spanning Tree
Singly link list
Backtracking Algorithm.ppt
Trees data structure
N queen problem
Hash table in data structure and algorithm
Minimum spanning Tree
Prim's Algorithm on minimum spanning tree
Hashing
Tree - Data Structure
Ad

Similar to PRIM’S AND KRUSKAL’S ALGORITHM (20)

PPTX
Prim's and Kruskal's Algorithm
PPTX
Dijkstra’s Algorithm in modern navigation and autonomous vehicles
PDF
Ijciras1101
PDF
Mobile antennae general Beamforming principles presentation
PPTX
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
PPTX
Spanning Tree in data structure and .pptx
PPTX
Dijkstra's algorithm presentation
PPTX
dms slide discrete mathematics sem 2 engineering
PDF
Shortest path by using suitable algorithm.pdf
PDF
Direct QR factorizations for tall-and-skinny matrices in MapReduce architectu...
PDF
Continuous and Discrete Crooklet Transform
PDF
Big data matrix factorizations and Overlapping community detection in graphs
PDF
Introduction to Hadron Structure from Lattice QCD
PDF
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
PPT
(148065320) dijistra algo
PPTX
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
PDF
A CORDIC based QR Decomposition Technique for MIMO Detection
PDF
K-means Clustering Algorithm with Matlab Source code
PDF
OTP, Phishing, QR code, Shares, Visual Cryptography.
PPTX
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
Prim's and Kruskal's Algorithm
Dijkstra’s Algorithm in modern navigation and autonomous vehicles
Ijciras1101
Mobile antennae general Beamforming principles presentation
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
Spanning Tree in data structure and .pptx
Dijkstra's algorithm presentation
dms slide discrete mathematics sem 2 engineering
Shortest path by using suitable algorithm.pdf
Direct QR factorizations for tall-and-skinny matrices in MapReduce architectu...
Continuous and Discrete Crooklet Transform
Big data matrix factorizations and Overlapping community detection in graphs
Introduction to Hadron Structure from Lattice QCD
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
(148065320) dijistra algo
uva-201026072839.pptxvcvczcvzvcxbxcvbcxvbvcxbcx
A CORDIC based QR Decomposition Technique for MIMO Detection
K-means Clustering Algorithm with Matlab Source code
OTP, Phishing, QR code, Shares, Visual Cryptography.
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
Ad

Recently uploaded (20)

PDF
Abrasive, erosive and cavitation wear.pdf
PDF
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Occupational Health and Safety Management System
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
737-MAX_SRG.pdf student reference guides
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Abrasive, erosive and cavitation wear.pdf
Integrating Fractal Dimension and Time Series Analysis for Optimized Hyperspe...
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
86236642-Electric-Loco-Shed.pdf jfkduklg
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
III.4.1.2_The_Space_Environment.p pdffdf
R24 SURVEYING LAB MANUAL for civil enggi
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Occupational Health and Safety Management System
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
Nature of X-rays, X- Ray Equipment, Fluoroscopy
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
737-MAX_SRG.pdf student reference guides
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION

PRIM’S AND KRUSKAL’S ALGORITHM

  • 1. PRIM’S AND KRUSKAL’S ALGORITHM • Gauri Bharat (24) • Anushka Bhave (25) • Dhairyashil Desai (37) • Jaydeep Desai(38)
  • 2. Content 01 Prim’s Algorithm 02 Application of Prim’s algorithm 03 Kruskal’s algorithm 04 Application of Kruskal’s Algorithm
  • 4. Basic terms 01 03 02 sub-graph of an undirected and a connected graph, which includes all the vertices of the graph having a minimum possible number of edges. Spanning tree Greedy Algorithm works by making the decision that seems most promising at any moment; it never reconsiders this decision, whatever situation may arise later. Greedy algorithm spanning tree in which the sum of the weight of the edges is as minimum as possible. Minimum spanning tree
  • 5. Steps for prim’s Algorithm Choose a vertex and find shortest edge from it Mark this edge as visited and add to spanning tree Select another non visited edge with the minimum weight Repeat the process till we get spanning tree with all vertices
  • 6. Prims Application Network design telephone, electrical, hydraulic, TV cable, computer, road
  • 10. Kruskal’s Algorithm Minimum Spanning Tree • Finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tr ee is minimized • It is a greedy algorithm in graph theory
  • 11. Applications of Kruskal’s Algorithm Reducing data storage (amino acids) Cluster analysis Network Design salesman Problems .
  • 12. Kruskal’s algorithm applications On your trip to Venice, you plan to visit all the important world heritage sites but are short on time. To make your itinerary work, you decide to use Kruskal’s algorithm using disjoint sets
  • 13. Kruskals algorithm Application Cannar egio Ponte Scalzi Santa Corce Dell ‘Or to Ferrovi a Piazzal e Roma San Po lo Dorso Duro San M arco St. Mar k Basil ica Castell o Arsena le A B C D E F G H I J K L B,C I,J B,E C,G G,I C,D K,L E,F A,B A,C 1 1 2 2 2 2 3 4 6 6 A,D E,C J,L F,H F,G H,I I,K D,J G,H H,K 6 7 8 10 11 12 16 18 22 25
  • 14. Remove all loops and parallel edges So for the given map, we have a parallel edge runni ng between Madonna dell’Ort o (D) to St. Mark Basilica (J), which is of length 2.4kms(240 0mts). We will remove the parallel ro ad and keep the 1.8km (1800 m) length for representation
  • 15. Differences Prims algorithm It start to build MST from any node Selects shortest edge connected to that vertex Prims algorithm is faster for dense graphs Kruskal’s algorithm It start to build the MST from minimum weighted edge in the graph Selects next shortest edge which does not create any cycle Kruskal’s algorithm is faster for sparse graphs