SlideShare a Scribd company logo
1 of 17
VERTEX COVER PROBLEM
-Gajanand Sharma
APPROXIMATION ALGORITHMS
Definition: Approximation algorithm
 An approximation algorithm for a problem is a
polynomial-time algorithm that, when given input i,
outputs an element of FS(i).
Feasible solution set
 A feasible solution is an object of the right type but not
necessarily an optimal one.
FS(i) is the set of feasible solutions for i.
Vertex Cover Problem
• In the mathematical discipline of graph theory, “A vertex
cover (sometimes node cover) of a graph is a subset of
vertices which “covers” every edge.
• An edge is covered if one of its endpoint is chosen.
• In other words “A vertex cover for a graph G is a set of
vertices incident to every edge in G.”
• The vertex cover problem: What is the minimum size vertex
cover in G?
Vertex Cover Problem
Problem: Given graph G = (V, E), find smallest s. t. if
(u, v) E, then u V′ or v V′ or both.
VV '
  
Idea: Keep finding a vertex which covers the maximum
number of edges.
Step 1: Find a vertex v with maximum degree.
Step 2: Add v to the solution and remove v and all its
incident edges from the graph.
Step 3: Repeat until all the edges are covered.
Vertex Cover : Greedy Algorithm(1)
Greedy Algorithm(1): Analysis
Optimal Solution = 6, select all red vertices.
 Greedy approach does not always lead to the best approximation
algorithm.
Greedy Algorithm(1): Analysis
Unfortunately if we select the vertices in following order, then we
will get worst solution for this vertex cover problem-
 First we might choose all the green vertices.
 Then we might choose all the blue vertices.
 And then we might choose all the orange vertices. Solution=11;
APPROX-VERTEX-COVER
1: C ← Ø ;
2: E′ ← E
3: while E′ ≠ Ø; do
4: let (u, v) be an arbitrary edge of E′
5: C ← C {(u, v)}
6: remove from E′ all edges incident on either u or v
7: end while
Vertex Cover : Algorithm(2)

4
1 2 3
65 7
Algorithm(2): Example
8
Initially C = Ø
E′ = {(1,2) (2,3) (1,4) (2,5) (3,6) (5,6) (3,7) (3,8)}
4
1 2 3
65 7
Algorithm(2): Example
8
C =
E′ = {(3,6) (5,6) (3,7) (3,8)}
1 2 3 6
4
1 2 3
65 7
Are the red vertices a vertex-cover?
No………. why?
Edge (3, 7) is not covered by it.
Algorithm(2): Example (Cont…)
4
1 2 3
65 7
Are the red vertices a vertex-cover?
Yes
What is the size?
Size = 4
Algorithm(2): Example (Cont…)
4
1 2 3
65 7
Are the red vertices a vertex-cover?
Of course……..
What is the size?
Size = 7
Algorithm(2): Example (Cont…)
4
1 2 3
65 7
Are the red vertices a vertex-cover?
Yes
What is the size?
Size = 5
Algorithm(2): Example (Cont…)
4
1 2 3
65 7
Are the red vertices a vertex-cover?
Yes
What is the size?
Size = 3
Algorithm(2): Example (Cont…)
A set of vertices such that each edge of the graph is incident
to at least one vertex of the set, is called the vertex cover.
Greedy algorithm may or may not produce optimal solution.
Approximation algorithm does not always guarantee optimal
solution but it’s aim is to produce a solution which is as close
as possible to the optimal solution.
Conclusion
Vertex cover Problem

More Related Content

What's hot

What's hot (20)

Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
 
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
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
 
And or graph
And or graphAnd or graph
And or graph
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
Backtracking
Backtracking  Backtracking
Backtracking
 
27 NP Completness
27 NP Completness27 NP Completness
27 NP Completness
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
Complexity analysis in Algorithms
Complexity analysis in AlgorithmsComplexity analysis in Algorithms
Complexity analysis in Algorithms
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Fuzzy relations
Fuzzy relationsFuzzy relations
Fuzzy relations
 

Viewers also liked

Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theoryTech_MX
 
Social Piggybacking: Leveraging Common Friends to Generate Event Streams
Social Piggybacking: Leveraging Common Friends to Generate Event StreamsSocial Piggybacking: Leveraging Common Friends to Generate Event Streams
Social Piggybacking: Leveraging Common Friends to Generate Event StreamsMarco Serafini
 
Efficient Primary-Backup replication on top of consensus
Efficient Primary-Backup replication on top of consensusEfficient Primary-Backup replication on top of consensus
Efficient Primary-Backup replication on top of consensusMarco Serafini
 
Réplication des bases de données
Réplication des bases de donnéesRéplication des bases de données
Réplication des bases de donnéessie92
 
Réplication de base de données oracle avec Golden Gate
Réplication de base de données oracle avec Golden GateRéplication de base de données oracle avec Golden Gate
Réplication de base de données oracle avec Golden GateMor THIAM
 
Introduction au datamining, concepts et techniques
Introduction au datamining, concepts et techniquesIntroduction au datamining, concepts et techniques
Introduction au datamining, concepts et techniquesIsmail CHAIB
 
Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Kalyan Acharjya
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 

Viewers also liked (9)

Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theory
 
Randomized Algorithm
Randomized AlgorithmRandomized Algorithm
Randomized Algorithm
 
Social Piggybacking: Leveraging Common Friends to Generate Event Streams
Social Piggybacking: Leveraging Common Friends to Generate Event StreamsSocial Piggybacking: Leveraging Common Friends to Generate Event Streams
Social Piggybacking: Leveraging Common Friends to Generate Event Streams
 
Efficient Primary-Backup replication on top of consensus
Efficient Primary-Backup replication on top of consensusEfficient Primary-Backup replication on top of consensus
Efficient Primary-Backup replication on top of consensus
 
Réplication des bases de données
Réplication des bases de donnéesRéplication des bases de données
Réplication des bases de données
 
Réplication de base de données oracle avec Golden Gate
Réplication de base de données oracle avec Golden GateRéplication de base de données oracle avec Golden Gate
Réplication de base de données oracle avec Golden Gate
 
Introduction au datamining, concepts et techniques
Introduction au datamining, concepts et techniquesIntroduction au datamining, concepts et techniques
Introduction au datamining, concepts et techniques
 
Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 

Similar to Vertex cover Problem

04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2MuradAmn
 
Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9chidabdu
 
Unit 3 greedy method
Unit 3  greedy methodUnit 3  greedy method
Unit 3 greedy methodMaryJacob24
 
Unit 3 - Greedy Method
Unit 3  - Greedy MethodUnit 3  - Greedy Method
Unit 3 - Greedy MethodMaryJacob24
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm sachin varun
 
Treewidth and Applications
Treewidth and ApplicationsTreewidth and Applications
Treewidth and ApplicationsASPAK2014
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhdanielgetachew0922
 
test pre
test pretest pre
test prefarazch
 
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8Nguyễn Công Hoàng
 
Secure Domination in graphs
Secure Domination in graphsSecure Domination in graphs
Secure Domination in graphsMahesh Gadhwal
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_PresentationAnna Lasota
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...appasami
 

Similar to Vertex cover Problem (20)

Approx
ApproxApprox
Approx
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
 
Lecture26
Lecture26Lecture26
Lecture26
 
Analysis of Algorithm
Analysis of AlgorithmAnalysis of Algorithm
Analysis of Algorithm
 
Chap8 new
Chap8 newChap8 new
Chap8 new
 
Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9
 
Unit 3 greedy method
Unit 3  greedy methodUnit 3  greedy method
Unit 3 greedy method
 
Unit 3 - Greedy Method
Unit 3  - Greedy MethodUnit 3  - Greedy Method
Unit 3 - Greedy Method
 
Daa chapter11
Daa chapter11Daa chapter11
Daa chapter11
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
 
Treewidth and Applications
Treewidth and ApplicationsTreewidth and Applications
Treewidth and Applications
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
 
test pre
test pretest pre
test pre
 
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
 
Secure Domination in graphs
Secure Domination in graphsSecure Domination in graphs
Secure Domination in graphs
 
Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_Presentation
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...
 
DAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptxDAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptx
 

Recently uploaded

Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 

Recently uploaded (20)

Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 

Vertex cover Problem

  • 2. APPROXIMATION ALGORITHMS Definition: Approximation algorithm  An approximation algorithm for a problem is a polynomial-time algorithm that, when given input i, outputs an element of FS(i). Feasible solution set  A feasible solution is an object of the right type but not necessarily an optimal one. FS(i) is the set of feasible solutions for i.
  • 3. Vertex Cover Problem • In the mathematical discipline of graph theory, “A vertex cover (sometimes node cover) of a graph is a subset of vertices which “covers” every edge. • An edge is covered if one of its endpoint is chosen. • In other words “A vertex cover for a graph G is a set of vertices incident to every edge in G.” • The vertex cover problem: What is the minimum size vertex cover in G?
  • 4. Vertex Cover Problem Problem: Given graph G = (V, E), find smallest s. t. if (u, v) E, then u V′ or v V′ or both. VV '   
  • 5. Idea: Keep finding a vertex which covers the maximum number of edges. Step 1: Find a vertex v with maximum degree. Step 2: Add v to the solution and remove v and all its incident edges from the graph. Step 3: Repeat until all the edges are covered. Vertex Cover : Greedy Algorithm(1)
  • 6. Greedy Algorithm(1): Analysis Optimal Solution = 6, select all red vertices.  Greedy approach does not always lead to the best approximation algorithm.
  • 7. Greedy Algorithm(1): Analysis Unfortunately if we select the vertices in following order, then we will get worst solution for this vertex cover problem-  First we might choose all the green vertices.  Then we might choose all the blue vertices.  And then we might choose all the orange vertices. Solution=11;
  • 8. APPROX-VERTEX-COVER 1: C ← Ø ; 2: E′ ← E 3: while E′ ≠ Ø; do 4: let (u, v) be an arbitrary edge of E′ 5: C ← C {(u, v)} 6: remove from E′ all edges incident on either u or v 7: end while Vertex Cover : Algorithm(2) 
  • 9. 4 1 2 3 65 7 Algorithm(2): Example 8 Initially C = Ø E′ = {(1,2) (2,3) (1,4) (2,5) (3,6) (5,6) (3,7) (3,8)}
  • 10. 4 1 2 3 65 7 Algorithm(2): Example 8 C = E′ = {(3,6) (5,6) (3,7) (3,8)} 1 2 3 6
  • 11. 4 1 2 3 65 7 Are the red vertices a vertex-cover? No………. why? Edge (3, 7) is not covered by it. Algorithm(2): Example (Cont…)
  • 12. 4 1 2 3 65 7 Are the red vertices a vertex-cover? Yes What is the size? Size = 4 Algorithm(2): Example (Cont…)
  • 13. 4 1 2 3 65 7 Are the red vertices a vertex-cover? Of course…….. What is the size? Size = 7 Algorithm(2): Example (Cont…)
  • 14. 4 1 2 3 65 7 Are the red vertices a vertex-cover? Yes What is the size? Size = 5 Algorithm(2): Example (Cont…)
  • 15. 4 1 2 3 65 7 Are the red vertices a vertex-cover? Yes What is the size? Size = 3 Algorithm(2): Example (Cont…)
  • 16. A set of vertices such that each edge of the graph is incident to at least one vertex of the set, is called the vertex cover. Greedy algorithm may or may not produce optimal solution. Approximation algorithm does not always guarantee optimal solution but it’s aim is to produce a solution which is as close as possible to the optimal solution. Conclusion