Purpose
When a problem is NP-complete, you give up on computing an exact optimum in polynomial time. This note defines the approximation ratio and derives the guarantees for two standard approximation algorithms: the 2-approximation for vertex cover and the greedy approximation for set cover.
Problems where this comes up include set cover, graph coloring, traveling salesman, maximum independent set, vertex cover, and boolean satisfiability. When your problem reduces to one of these, you have two practical options. Solve the problem exactly on specially structured inputs, or compute a solution with a provable bound on how far it can be from optimal, even in the worst case.
Approximation Ratio
An upper or lower bound on turns a heuristic into an algorithm you can reason about. For a minimization problem, an -approximation guarantees .
Bounding against an unknown OPT
Neither proof below ever computes . Each finds a quantity that provably lower-bounds it, the matching size for vertex cover and the -coverage argument for set cover, then compares the algorithm’s output to that bound instead.
2-Approximation for Vertex Cover
Problem: find a minimal subset of vertices in a graph such that every edge has at least one endpoint in .
Algorithm: while some edge has neither endpoint in , add both and to .
The edges the algorithm picks share no endpoints, so they form a matching . Any vertex cover must contain at least one endpoint of every edge in , and those endpoints are distinct across edges of , so . The algorithm outputs vertices, which gives
so .
Both endpoints, not one
Adding a single endpoint of each uncovered edge loses the guarantee. On a star, picking the leaf endpoint every time collects all leaves while the optimum is the single center. Taking both endpoints is exactly what ties to a matching.
ln(n) Approximation for Set Cover
Problem: given sets with and , choose the minimum number of sets that cover all elements of .
Algorithm: while elements remain uncovered, choose the set that covers the most new elements.
Suppose the optimal solution uses sets. Those sets cover every remaining element at any point during the run, so some set always covers at least of the remaining elements. The greedy choice covers at least that many. After steps the number of uncovered elements is at most
Setting drives this below , so greedy selects at most sets.