CSC325 · 2076 · 5 marks
Explain the approximation for solving vertex cover with a suitable example.
Explain the approximation for solving vertex cover with a suitable example. [5]
Quick answer
A vertex cover of an undirected graph G = (V, E) is a subset V' ⊆ V such that for every edge (u, v) ∈ E, at least one of u or v belongs to V'.
Approximation Algorithm for Vertex Cover
Definition
The optimization problem is to find the vertex cover with the fewest vertices. The approximation problem is to find a vertex cover with few vertices (not necessarily minimum, but within a guaranteed bound).
Approximation Algorithm (APPROX-VERTEX-COVER)
APPROX-VERTEX-COVER(G):
1. C = {} (empty set - will hold the vertex cover)
2. E' = E[G] (copy of all edges)
3. while E' is not empty:
a. Pick any edge (u, v) from E'
b. Add both u and v to C
C = C ∪ {u, v}
c. Remove from E' every edge incident to u or v
4. return C
Key Properties
- Time Complexity: O(V + E)
- Approximation Ratio: This algorithm is a 2-approximation, meaning:
|C| ≤ 2 × |C*|
where C* is the optimal (minimum) vertex cover.
Reason: Each edge picked in step 3(a) belongs to an optimal cover (at least one endpoint must be in C*). Since both endpoints are added, we add at most twice the optimal number of vertices.
Example
Consider the following graph:
Vertices: {1, 2, 3, 4, 5, 6, 7}
Edges: {(1,2), (1,3), (2,4), (3,4), (4,5), (4,6), (5,7)}
Step-by-step execution:
| Step | Edge Picked | Vertices Added to C | Edges Removed |
|---|---|---|---|
| 1 | (1, 2) | {1, 2} | (1,2), (1,3), (2,4) |
| 2 | (3, 4) | {1, 2, 3, 4} | (3,4), (4,5), (4,6) |
| 3 | (5, 7) | {1, 2, 3, 4, 5, 7} | (5,7) |
Result: C = {1, 2, 3, 4, 5, 7} → size = 6
Optimal cover: C* = {1, 4, 5} or {2, 3, 4, 7} → size = 3 or 4
Here |C| = 6 ≤ 2 × 3 = 6, which satisfies the 2-approximation guarantee.
Conclusion
The approximation algorithm for vertex cover guarantees a solution no worse than twice the optimal. It is efficient and practical because finding the exact minimum vertex cover is NP-hard, while this approximation runs in polynomial time O(V + E).
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.