0% found this document useful (0 votes)
26 views10 pages

Presentation of Design Analysis and Algorithm On Approximation

The document discusses approximation algorithms, specifically in the context of the vertex cover and set cover problems, both of which are NP-complete. It outlines the principles of approximation algorithms, their goals, and provides algorithms for solving the vertex cover and set cover problems using greedy methods. Examples illustrate how these algorithms work to cover all edges or elements efficiently.

Uploaded by

swativijay.ai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views10 pages

Presentation of Design Analysis and Algorithm On Approximation

The document discusses approximation algorithms, specifically in the context of the vertex cover and set cover problems, both of which are NP-complete. It outlines the principles of approximation algorithms, their goals, and provides algorithms for solving the vertex cover and set cover problems using greedy methods. Examples illustrate how these algorithms work to cover all edges or elements efficiently.

Uploaded by

swativijay.ai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

APPROXIMATION ALGORITHM

AND VERTEX COVER PROBLEM


AND SET COVER PROBLEM
OVERVIEW
• Approximation Algorithm
• Vertex cover problem
• Example
• Vertex cover Algorithm
• Approximation algorithm for set cover problem
• Set cover problem
• Example
APPROXIMATION ALGORITHM

• It is a way of dealing with NP-completeness for optimization problem. This


technique does not guarantee the best solution.
• The goal of an approximation algorithm is to come as close as possible to the
optimum value in a reasonable amount of time which is at most polynomial
time.
• If we are dealing with optimization problem (maximization or minimization)
with feasible solution having positive cost then it is worthy to look at
approximate algorithm for near optimal solution.
VERTEX COVER PROBLEM

• An algorithm has an approximate ratio of p(n) if, for any problem of input size
n, the cost C of solution by an algorithm and the cost C of optimal solution
have the relation as max(C*/C,C,C) ≤ p(n). Such an algorithm is called p(n)-
approximation algorithm.
• The relation applies for both maximization (0 <C≤C*) and minimization (0 <
CC) problems. p(n) is always greater than or equal to 1. If solution produced
by approximation algorithm is true optimal solution then clearly we have p(n)
= 1.
VERTEX COVER PROBLEM
• A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the
graph, either 'u' or 'v' is in vertex cover. Although the name is Vertex Cover, the set covers all edges of
the given graph.
• It is also known as NP Complete problem, i.e., there is no polynomial time solution for this unless P NP.
There are approximate polynomial time algorithms to solve the problem though.
• Following are some Example:
VERTEX COVER PROBLEM ALGORITHM

• Start with an empty vertex cover.

• Pick any edge (u , v).

• Add both u and v to the cover.

• Remove all edges covered by u and v.

• Repeat until all edges are covered.


APPROXIMATION ALGORITHM FOR SET
COVER PROBLEM

• The Set Cover Problem is another classic NP-hard problem in which you are given a universe
of elements and a collection of sets, each containing some of these elements. The objective is
to find the smallest subset of sets that together cover all elements in the universe.

• For the Set Cover Problem, a commonly used approach is a greedy approximation algorithm,
which provides a solution that is within a factor of ln⁡(n)\ln(n)ln(n) of the optimal solution,
where n is the number of elements in the universe.
SET COVER PROBLEM

1. Initialize the cover as an empty set.

2. Repeat until all elements are covered:

• Find the set that covers the largest number of uncovered elements in the universe.
• Add this set to the cover.
• Mark the elements in this set as covered.

3. Output the collection of sets in the cover.


EXAMPLE
• Universe U={1,2,3,4,5}
• Sets:
• S1={1,2}
• S2={2,3,4}
• S3={4,5}
• S4={1,3,5}
• Solution Using the Greedy Algorithm
1. Initialize: No elements are covered yet.
2. Iteration 1: Find the set with the most uncovered elements.
1. S2={2,3,4} covers 3 elements, the most.
2. Cover so far: {2,3,4}
3. Selected sets: S2​
EXAMPLE

1. Iteration 2: Find the next set with the most remaining uncovered elements.
1. S1={1,2} covers 1 new element (1).
2. S3={4,5} covers 1 new element (5).
3. S4={1,3,5} covers 2 new elements (1 and 5), the most.
4. We pick S4.
5. Cover so far: {1,2,3,4,5}
6. Selected sets: S2,S4​
2. Completion: All elements are now covered.

You might also like