SlideShare a Scribd company logo
1 of 40
Application of greedy method:
Prim’s Algorithm
Greedy Method ???
A greedy method is an method that follows
the problem solving technique of making the
locally optimal choice at each stage with the
hope of finding a global optimum.
Prim’s Algorithm
Prim's algorithm is a greedy algorithm that
finds a minimum spanning tree for
a connected weighted undirected graph. This
means it finds a subset of the edges that forms
a tree that includes every vertex, where the
total weight of all the edges in the tree is
minimized.
Spanning Tree ???
A spanning tree of a connected graph G can
be defined as a maximal set of edges of G that
contains no cycle, or as a minimal set of edges
that connect all vertices.
Minimum Spanning Tree ???
A minimum spanning tree is a subgraph of an
undirected weighted graph G, such that

• it is a tree (i.e., it is acyclic)
• it covers all the vertices V
    – contains |V| - 1 edges
• the total cost associated with tree edges is the
  minimum among all possible spanning trees
• not necessarily unique
Algorithm
Example 1
5
        A               B
    4       6       2

        2       D           3
C

    3       1       2
        E               F
                4
5
        A               B
    4       6       2

        2       D           3
C

    3       1       2
        E               F
                4
5
        A               B
    4       6       2

        2       D           3
C

    3       1       2
        E               F
                4
5
        A               B
    4       6       2

        2       D           3
C

    3       1       2
        E               F
                4
A               B
                    2

        2       D           3
C

    3       1       2
        E               F
                4
A               B
                    2

        2       D           3
C

    3       1       2
        E               F
A               B
                    2

        2       D           3
C

    3       1       2
        E               F
A               B
                    2

        2       D
C

    3       1       2
        E               F
A               B
                    2

        2       D
C

    3       1       2
        E               F
minimum- spanning tree


                A                    B
                                 2

               2             D
C

        3                1       2
                E                    F
Example 2
Prim’s Algorithm
                    9           b
    a       2           6
                d
                        4       5
    5       4

                    5       e
        c
Prim’s algorithm


                    9           b
    a       2           6
                d
                        4       5
    5       4

                    5       e
        c


    The MST initially consists of the vertex e
Prim’s algorithm


                    9           b
    a       2           6
                d
                        4       5
    5       4

                    5       e
        c
Prim’s algorithm


                    9           b
    a       2           6
                d
                        4       5
    5       4

                    5       e
        c
Prim’s algorithm


                    9           b
    a       2           6
                d
                        4       5
    5       4

                    5       e
        c
Prim’s algorithm


                    9           b
    a       2           6
                d
                        4       5
    5       4

                    5       e
        c

        The final minimum spanning tree
Example 3
Weight (T) = 23 + 29 + 31 + 32 + 47 + 54 + 66 = 282
Problem: Laying Telephone
Wire




             Central office
Wiring: Normal Approach




              Central office




           Expensive!
Wiring: Better Approach




                           Central office




Minimize the total length of wire connecting the customers
Thank You

More Related Content

What's hot

Minimum Spanning Tree
Minimum Spanning TreeMinimum Spanning Tree
Minimum Spanning Treezhaokatherine
 
Fairness and Privacy in AI/ML Systems
Fairness and Privacy in AI/ML SystemsFairness and Privacy in AI/ML Systems
Fairness and Privacy in AI/ML SystemsKrishnaram Kenthapadi
 
Simplifies and normal forms - Theory of Computation
Simplifies and normal forms - Theory of ComputationSimplifies and normal forms - Theory of Computation
Simplifies and normal forms - Theory of ComputationNikhil Pandit
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventionssaranyatdr
 
Subset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochSubset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochIjlal Ijlal
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR Zahid Parvez
 
Finite automata intro
Finite automata introFinite automata intro
Finite automata introlavishka_anuj
 
Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)Niloy Biswas
 
Recent Trends in Deep Learning
Recent Trends in Deep LearningRecent Trends in Deep Learning
Recent Trends in Deep LearningSungjoon Choi
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture NotesFellowBuddy.com
 
Max flow min cut
Max flow min cutMax flow min cut
Max flow min cutMayank Garg
 
Hamiltonian cycle in data structure 2
Hamiltonian cycle in data structure  2Hamiltonian cycle in data structure  2
Hamiltonian cycle in data structure 2Home
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic ProgrammingSahil Kumar
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problemsJyotsna Suryadevara
 
Maximum Matching in General Graphs
Maximum Matching in General GraphsMaximum Matching in General Graphs
Maximum Matching in General GraphsAhmad Khayyat
 

What's hot (20)

Minimum Spanning Tree
Minimum Spanning TreeMinimum Spanning Tree
Minimum Spanning Tree
 
Fairness and Privacy in AI/ML Systems
Fairness and Privacy in AI/ML SystemsFairness and Privacy in AI/ML Systems
Fairness and Privacy in AI/ML Systems
 
Simplifies and normal forms - Theory of Computation
Simplifies and normal forms - Theory of ComputationSimplifies and normal forms - Theory of Computation
Simplifies and normal forms - Theory of Computation
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
Subset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochSubset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force Approch
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
 
Finite automata intro
Finite automata introFinite automata intro
Finite automata intro
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
 
Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)Regular expression to NFA (Nondeterministic Finite Automata)
Regular expression to NFA (Nondeterministic Finite Automata)
 
Recent Trends in Deep Learning
Recent Trends in Deep LearningRecent Trends in Deep Learning
Recent Trends in Deep Learning
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
Max flow min cut
Max flow min cutMax flow min cut
Max flow min cut
 
NP completeness
NP completenessNP completeness
NP completeness
 
Hamiltonian cycle in data structure 2
Hamiltonian cycle in data structure  2Hamiltonian cycle in data structure  2
Hamiltonian cycle in data structure 2
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic Programming
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problems
 
Maximum Matching in General Graphs
Maximum Matching in General GraphsMaximum Matching in General Graphs
Maximum Matching in General Graphs
 

Viewers also liked

Application of greedy method
Application  of  greedy methodApplication  of  greedy method
Application of greedy methodTech_MX
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy AlgorithmWaqar Akram
 
モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡Tadahisa Kumagai
 
モリンガ+(プラス)レシピ集
モリンガ+(プラス)レシピ集モリンガ+(プラス)レシピ集
モリンガ+(プラス)レシピ集Tadahisa Kumagai
 
モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡Tadahisa Kumagai
 
Physical examination of cattle lecture
Physical examination of cattle lecture Physical examination of cattle lecture
Physical examination of cattle lecture Dauda Iliyasu
 
Back to School Night 2012 2013
Back to School Night 2012 2013Back to School Night 2012 2013
Back to School Night 2012 2013Jengilly83
 
Io processing
Io processingIo processing
Io processingTech_MX
 
Knapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comKnapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comHemant Gautam
 

Viewers also liked (20)

Application of greedy method
Application  of  greedy methodApplication  of  greedy method
Application of greedy method
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy Algorithm
 
Greedy
GreedyGreedy
Greedy
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡
 
Presentation1
Presentation1Presentation1
Presentation1
 
Special techniques
Special techniquesSpecial techniques
Special techniques
 
モリンガ+(プラス)レシピ集
モリンガ+(プラス)レシピ集モリンガ+(プラス)レシピ集
モリンガ+(プラス)レシピ集
 
モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡モリンガライフパウダーの軌跡
モリンガライフパウダーの軌跡
 
Physical examination of cattle lecture
Physical examination of cattle lecture Physical examination of cattle lecture
Physical examination of cattle lecture
 
Back to School Night 2012 2013
Back to School Night 2012 2013Back to School Night 2012 2013
Back to School Night 2012 2013
 
Io processing
Io processingIo processing
Io processing
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
モリンガとは?
モリンガとは?モリンガとは?
モリンガとは?
 
Knapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comKnapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.com
 

Similar to Application of greedy method prim

Day 2 adding polynomials senteo
Day 2 adding polynomials senteoDay 2 adding polynomials senteo
Day 2 adding polynomials senteoErik Tjersland
 
Kruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comKruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comHemant Gautam
 
Double patterning (4/20 update)
Double patterning (4/20 update)Double patterning (4/20 update)
Double patterning (4/20 update)Danny Luk
 
Chapter two(was 1) v9-oldformat-c
Chapter two(was 1) v9-oldformat-cChapter two(was 1) v9-oldformat-c
Chapter two(was 1) v9-oldformat-cnewtonsgroove
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatnewtonsgroove
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatnewtonsgroove
 
Chapter two(was 1) v9-oldformat-cd-b
Chapter two(was 1) v9-oldformat-cd-bChapter two(was 1) v9-oldformat-cd-b
Chapter two(was 1) v9-oldformat-cd-bnewtonsgroove
 
Dicionário de acordes para teclado
Dicionário de acordes para tecladoDicionário de acordes para teclado
Dicionário de acordes para tecladoaltairhg
 
Day 12 factoring trinomials senteo
Day 12 factoring trinomials senteoDay 12 factoring trinomials senteo
Day 12 factoring trinomials senteoErik Tjersland
 
Module 5 Indices PMR
Module 5 Indices PMRModule 5 Indices PMR
Module 5 Indices PMRroszelan
 
Datamining 8th hclustering
Datamining 8th hclusteringDatamining 8th hclustering
Datamining 8th hclusteringsesejun
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclusteringsesejun
 
Gabarito vestibular
Gabarito vestibularGabarito vestibular
Gabarito vestibularDante Napoli
 
Worked examples projects unit 1
Worked examples projects unit 1Worked examples projects unit 1
Worked examples projects unit 1Sameer Alam
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatnewtonsgroove
 

Similar to Application of greedy method prim (20)

Day 2 adding polynomials senteo
Day 2 adding polynomials senteoDay 2 adding polynomials senteo
Day 2 adding polynomials senteo
 
Kruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.comKruskals prims shared by: geekssay.com
Kruskals prims shared by: geekssay.com
 
Double patterning (4/20 update)
Double patterning (4/20 update)Double patterning (4/20 update)
Double patterning (4/20 update)
 
Chapter two(was 1) v9-oldformat-c
Chapter two(was 1) v9-oldformat-cChapter two(was 1) v9-oldformat-c
Chapter two(was 1) v9-oldformat-c
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformat
 
Geom4-4
Geom4-4Geom4-4
Geom4-4
 
09 trial kedah_s1
09 trial kedah_s109 trial kedah_s1
09 trial kedah_s1
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformat
 
Chapter two(was 1) v9-oldformat-cd-b
Chapter two(was 1) v9-oldformat-cd-bChapter two(was 1) v9-oldformat-cd-b
Chapter two(was 1) v9-oldformat-cd-b
 
Dicionário de acordes para teclado
Dicionário de acordes para tecladoDicionário de acordes para teclado
Dicionário de acordes para teclado
 
Saes tables
Saes tablesSaes tables
Saes tables
 
Day 12 factoring trinomials senteo
Day 12 factoring trinomials senteoDay 12 factoring trinomials senteo
Day 12 factoring trinomials senteo
 
Module 5 Indices PMR
Module 5 Indices PMRModule 5 Indices PMR
Module 5 Indices PMR
 
Datamining 8th hclustering
Datamining 8th hclusteringDatamining 8th hclustering
Datamining 8th hclustering
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclustering
 
Gabarito vestibular
Gabarito vestibularGabarito vestibular
Gabarito vestibular
 
1.2.4
1.2.41.2.4
1.2.4
 
Worked examples projects unit 1
Worked examples projects unit 1Worked examples projects unit 1
Worked examples projects unit 1
 
Mst(engl)
Mst(engl)Mst(engl)
Mst(engl)
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformat
 

More from Tech_MX

Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimationTech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
String & its application
String & its applicationString & its application
String & its applicationTech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application Tech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pcTech_MX
 
More on Lex
More on LexMore on Lex
More on LexTech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbmsTech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 

More from Tech_MX (20)

Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Uid
UidUid
Uid
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
String & its application
String & its applicationString & its application
String & its application
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Spss
SpssSpss
Spss
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
 
Set data structure
Set data structure Set data structure
Set data structure
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Parsing
ParsingParsing
Parsing
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
 
More on Lex
More on LexMore on Lex
More on Lex
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 
Linkers
LinkersLinkers
Linkers
 

Recently uploaded

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

Application of greedy method prim

  • 1. Application of greedy method: Prim’s Algorithm
  • 2. Greedy Method ??? A greedy method is an method that follows the problem solving technique of making the locally optimal choice at each stage with the hope of finding a global optimum.
  • 3. Prim’s Algorithm Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized.
  • 4. Spanning Tree ??? A spanning tree of a connected graph G can be defined as a maximal set of edges of G that contains no cycle, or as a minimal set of edges that connect all vertices.
  • 5.
  • 6. Minimum Spanning Tree ??? A minimum spanning tree is a subgraph of an undirected weighted graph G, such that • it is a tree (i.e., it is acyclic) • it covers all the vertices V – contains |V| - 1 edges • the total cost associated with tree edges is the minimum among all possible spanning trees • not necessarily unique
  • 7.
  • 9.
  • 10.
  • 12. 5 A B 4 6 2 2 D 3 C 3 1 2 E F 4
  • 13. 5 A B 4 6 2 2 D 3 C 3 1 2 E F 4
  • 14. 5 A B 4 6 2 2 D 3 C 3 1 2 E F 4
  • 15. 5 A B 4 6 2 2 D 3 C 3 1 2 E F 4
  • 16. A B 2 2 D 3 C 3 1 2 E F 4
  • 17. A B 2 2 D 3 C 3 1 2 E F
  • 18. A B 2 2 D 3 C 3 1 2 E F
  • 19. A B 2 2 D C 3 1 2 E F
  • 20. A B 2 2 D C 3 1 2 E F
  • 21. minimum- spanning tree A B 2 2 D C 3 1 2 E F
  • 23. Prim’s Algorithm 9 b a 2 6 d 4 5 5 4 5 e c
  • 24. Prim’s algorithm 9 b a 2 6 d 4 5 5 4 5 e c The MST initially consists of the vertex e
  • 25. Prim’s algorithm 9 b a 2 6 d 4 5 5 4 5 e c
  • 26. Prim’s algorithm 9 b a 2 6 d 4 5 5 4 5 e c
  • 27. Prim’s algorithm 9 b a 2 6 d 4 5 5 4 5 e c
  • 28. Prim’s algorithm 9 b a 2 6 d 4 5 5 4 5 e c The final minimum spanning tree
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Weight (T) = 23 + 29 + 31 + 32 + 47 + 54 + 66 = 282
  • 38. Wiring: Normal Approach Central office Expensive!
  • 39. Wiring: Better Approach Central office Minimize the total length of wire connecting the customers