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

8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
Tech_MX
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 

What's hot (20)

Unification and Lifting
Unification and LiftingUnification and Lifting
Unification and Lifting
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen 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
Presentation of daa on approximation algorithm and vertex cover problem
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Introduction to Approximation Algorithms
Introduction to Approximation AlgorithmsIntroduction to Approximation Algorithms
Introduction to Approximation Algorithms
 
Unit 3 daa
Unit 3 daaUnit 3 daa
Unit 3 daa
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Elements of dynamic programming
Elements of dynamic programmingElements of dynamic programming
Elements of dynamic programming
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
N Queens problem
N Queens problemN Queens problem
N Queens problem
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
N queens using backtracking
N queens using backtrackingN queens using backtracking
N queens using backtracking
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
 
Backtracking
Backtracking  Backtracking
Backtracking
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 

Viewers also liked

Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theory
Tech_MX
 

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

Algorithm chapter 9
Algorithm chapter 9Algorithm chapter 9
Algorithm chapter 9
chidabdu
 
Treewidth and Applications
Treewidth and ApplicationsTreewidth and Applications
Treewidth and Applications
ASPAK2014
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
danielgetachew0922
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_Presentation
Anna Lasota
 

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

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

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