Memra

Approximation ratios & the vertex-cover 2-approximation

◈ 5 cards

Define 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:

  1. Pick edge . Add and to . Remove every edge touching or — that kills . Remaining: .
  2. 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.

picked40in C1in C523Dashed edges are now covered and deleted; only (2,3)survives.
Round 1: both endpoints of the picked edge enter C — that is what buys the factor 2.
40in C*152in C*3C* = {0,2}, size 2. The algorithm returned {0,1,2,3}, size 4.
The optimum needs only the two hubs — so on this instance the factor-2 bound is tight.
problemcost relationρ(n) isminimizationC ≥ C*C / C*maximizationC ≤ C*C* / Ceither, exactC = C*ρ = 1ρ(n) = max(C/C*, C*/C) — one definition, bothdirections.
The max in the definition is what makes ρ(n) ≥ 1 for both kinds of problem.
NORMAL ~/memra/learn/comp-372/approximation-ratios-and-vertex-cover utf-8 LF