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

Boyer moore algorithm
Boyer moore algorithmBoyer moore algorithm
Boyer moore algorithmAYESHA JAVED
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithmfaisal2204
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxSyed Zaid Irshad
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
Introduction to complex networks
Introduction to complex networksIntroduction to complex networks
Introduction to complex networksVincent Traag
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic ProgrammingSahil Kumar
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm sachin varun
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Traian Rebedea
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithmDevaKumari Vijay
 
02 order of growth
02 order of growth02 order of growth
02 order of growthHira Gul
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAmrinder Arora
 
Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem sumit gyawali
 

What's hot (20)

Boyer moore algorithm
Boyer moore algorithmBoyer moore algorithm
Boyer moore algorithm
 
Big o notation
Big o notationBig o notation
Big o notation
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
N queen problem
N queen problemN queen problem
N queen problem
 
Logic programming in python
Logic programming in pythonLogic programming in python
Logic programming in python
 
Introduction to complex networks
Introduction to complex networksIntroduction to complex networks
Introduction to complex networks
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic Programming
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithm
 
02 order of growth
02 order of growth02 order of growth
02 order of growth
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
 
Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem
 

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
 
Chapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformatChapter two(was 1) v9-oldformat
Chapter two(was 1) v9-oldformat
 
Cm exercise 6
Cm exercise 6Cm exercise 6
Cm exercise 6
 

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

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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 

Recently uploaded (20)

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...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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?
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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...
 

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