Approximation ratios & the vertex-cover 2-approximation
◈ 5 cardsDefine the approximation ratio, PTAS/FPTAS, and prove APPROX-VERTEX-COVER is a 2-approximation via the maximal-matching lower bound.
When optimal is out of reach
In Module 9 you proved problems like VERTEX-COVER are NP-complete: no known polynomial-time exact algorithm exists, and one almost certainly does not unless . But these problems do not go away — we still need some answer. An approximation algorithm runs in polynomial time and returns a solution provably close to optimal.
We measure "close" with the approximation ratio . For any input of size , let be the cost of the algorithm's solution and the optimal cost. The algorithm is a -approximation if
The handles both directions uniformly: for a minimization problem , so the ratio is ; for a maximization problem , so it is . Either way , and means exact.
Two stronger guarantees come as schemes parameterized by an accuracy knob :
- A PTAS (polynomial-time approximation scheme) is a family of -approximation algorithms, polynomial in for each fixed — but the running time may blow up as (e.g. ).
- An FPTAS (fully polynomial-time approximation scheme) is a PTAS whose running time is also polynomial in (e.g. ). This is the strongest practical guarantee.
The vertex-cover 2-approximation
A vertex cover of is a set such that every edge has at least one endpoint in . Minimum vertex cover is NP-complete. Here is a startlingly simple algorithm that is never more than twice optimal:
APPROX-VERTEX-COVER(G)
C = empty set
E' = G.E
while E' is not empty
let (u, v) be an arbitrary edge of E'
C = C union {u, v} // take BOTH endpoints
remove from E' every edge incident on u or v
return C
It runs in with adjacency lists.
Worked example. Take the graph with edges . Vertex is a hub. Process edges in increasing order:
- Pick edge . Add and to . Remove every edge touching or — that kills . Remaining: .
- Pick edge . Add and . Remove . Nothing remains.
Result: , size . Every edge is covered. (A truly minimum cover here is , size — so our answer is exactly optimal, the worst the ratio allows.)
Why the ratio is 2 — the lower-bound trick
The proof is the template for every approximation-ratio argument: you cannot see , so you compare to a computable lower bound on .
Let be the set of edges the loop actually picks (one per iteration). Because every edge incident on a picked endpoint is immediately deleted, no two edges in share a vertex — is a matching, in fact a maximal one.
- Lower bound. Any vertex cover must cover each edge of , and those edges share no endpoints, so needs a distinct vertex for each: .
- Upper bound. Each iteration adds exactly two vertices: .
- Combine. .
The matching is the lower-bound proxy for that makes the whole argument work without ever computing the optimum.