4.6.29 · D1Theory of Computation

Foundations — Approximation algorithms — approximation ratio, examples

1,963 words9 min readBack to topic

This page assumes you have seen none of the notation in the parent note. We build every symbol, one at a time, each resting on the one before it. Read top to bottom.


1. What is a "graph"? (, , )

Before we can talk about Vertex Cover or MST, we need the object they live on.

The picture is everything here — a graph is a picture.

Figure — Approximation algorithms — approximation ratio, examples

The little symbol means "how many dots" and means "how many lines". The two vertical bars always mean size / count of a set. We use it constantly: , below.


2. Sets and the "subset" symbol (, , )

A set is a bag of things with no duplicates and no order. We need three tiny symbols.

The arrow (or ) means "gets assigned": reads "let start as empty."


3. Optimisation: minimise, maximise, and

Every problem here asks for a best number.

Figure — Approximation algorithms — approximation ratio, examples

4. Our algorithm's answer:

So on the number line for a minimisation problem: sits at or below . The question "how much worse is ?" is exactly the approximation ratio.


5. Ratios, inequalities, and

Now the two symbols that carry the whole definition.

For maximisation the ratio is flipped: with , because now and we promise "at least times as good."


6. The trapping trick: lower bound

This is the deepest idea and it needs its own symbol.

Why is a floor useful? Because if we can also show our answer sits at most floors up, we sandwich OPT for free.

Figure — Approximation algorithms — approximation ratio, examples

7. Special sub-objects: matching , tree

Two named lower bounds appear so often they get their own letters.

Figure — Approximation algorithms — approximation ratio, examples

8. Polynomial time — the "fast" we insist on


Prerequisite map

Sets: in, subset, empty, size bars

Graph G = V and E

Matching M

Spanning tree T and cost

OPT the best value

Ratio ALG over OPT and rho

ALG our output

LB-LADDER proof pattern

Lower bound LB below OPT

Polynomial time = fast

Approximation algorithms

NP-hard = why approximate


Equipment checklist

Cover the right-hand side and test yourself before returning to the parent note.

  • What does mean? ::: A graph: is the set of dots (vertices), the set of lines (edges) joining them.
  • What does (vertical bars) mean? ::: The size / count of the set .
  • What does mean? ::: is a subset of — every element of is also a vertex in .
  • What is and what does do? ::: is the empty set; means "gets assigned", e.g. start as empty.
  • What is , and can we usually compute it? ::: The value of the best possible answer; usually no, not in polynomial time — but we can reason about it.
  • What is ? ::: The value our fast algorithm actually outputs; a real computable number.
  • For minimisation, why is ? ::: Because already, so the ratio can never dip below 1.
  • What does promise? ::: Our answer is never worse than times the best possible.
  • What is a lower bound ? ::: A quickly-computable number proven to satisfy — a floor under the optimum.
  • State the LB-LADDER. ::: ; prove the left step directly, get the right step free from .
  • What is a matching ? ::: A set of edges no two of which share a vertex.
  • What is a spanning tree ? ::: A loop-free set of edges connecting all vertices; is the sum of its edge lengths.
  • Why do we demand polynomial time? ::: It is our line for "practically fast"; exponential blows up as input grows.

Connections