Measure difficulty in terms of the input size and a separate parameter — typically the solution size, a structural width, or a bound in the statement.
FPT — fixed-parameter tractable
A problem is FPT if it is solvable in
for some function . The exponential blowup is confined to , so the algorithm is practical whenever is small — regardless of how large is.
Contrast: is not FPT (the exponent depends on ); it is the weaker class XP.
| Complexity | Class | , |
|---|---|---|
| FPT | ✔ | |
| FPT | ✔ | |
| FPT | ✘ (but FPT) | |
| XP | astronomically large ✘ |
The FPT problems
| Problem | Parameter | Best known |
|---|---|---|
| Vertex cover | solution size | |
| Feedback vertex set | ||
| -path (a path of vertices) | (colour coding) | |
| Steiner tree | number of terminals | |
| TSP | number of cities | |
| Anything on bounded treewidth | treewidth | |
| Closest string | number of strings | FPT |
| -hitting set |
The W-hierarchy — what is not FPT
| Problem | Class |
|---|---|
| Independent set / clique (parameter = size) | W[1]-hard |
| Dominating set | W[2]-hard |
| Set cover (parameter = number of sets) | W[2]-hard |
| Graph colouring (parameter = colours) | not FPT (NP-hard for ) |
W[1]-hardness is the parameterized analogue of NP-hardness: no FPT algorithm is expected. Note the striking asymmetry — vertex cover is FPT, but its complement independent set is W[1]-hard.
Kernelization — the defining technique
Reduce the instance in polynomial time to an equivalent one whose size depends only on (the kernel), then solve the kernel by brute force.
Vertex cover kernel — Buss’s rules
- A vertex of degree must be in the cover (else all its neighbours are, exceeding ): take it, decrement .
- Delete isolated vertices.
- If more than edges remain, answer no (each of vertices covers edges).
The result is a kernel with edges and vertices. The Nemhauser-Trotter LP gives a stronger -vertex kernel.
// after kernelization, branch: for an uncovered edge (u,v),
// either u or v is in the cover -> O(2^k) branching, or O(1.28^k) with better rules
bool vc(Graph& g, int k) {
kernelize(g, k);
if (g.edges.empty()) return true;
if (k == 0) return false;
auto [u, v] = g.anyEdge();
return vc(g.remove(u), k - 1) || vc(g.remove(v), k - 1);
}A problem is FPT iff it has a kernel. That equivalence is the central theorem of the field.
Bounded treewidth
Treewidth measures how tree-like a graph is: trees have , series-parallel graphs , planar graphs , and complete graphs .
Almost every NP-hard graph problem is solvable in on graphs of treewidth (Courcelle’s theorem, for anything expressible in monadic second-order logic).
This is why so many problems are easy on trees — treewidth 1. In contests, “the graph is a tree” or “the graph is a cactus” is exactly this escape hatch.
| Structure | Treewidth |
|---|---|
| Tree, forest | 1 |
| Cycle, cactus | 2 |
| Series-parallel | 2 |
| Outerplanar | 2 |
| grid | |
| Planar | |
| Complete graph |
Colour coding
A randomised FPT technique: to find a path of vertices, colour the vertices randomly with colours and look for a colourful path (all colours distinct) — which is a DP over colour subsets. The true path is colourful with probability , so repetitions suffice.
, derandomisable with -perfect hash families. The same idea finds any small subgraph pattern.
In competitive programming
Parameterized thinking is really “read the constraints”:
| Constraint | Intended technique |
|---|---|
| DP | |
| meet in the middle | |
| terminals, large | Steiner tree DP |
| special vertices | subset DP over those |
| ”The graph is a tree” | tree DP (treewidth 1) |
| “The graph is a cactus” | treewidth 2 |
| ”At most removals” | branching, |
| A small alphabet or value range | that is the parameter |
Two independent small numbers in the constraints ( large, tiny) is the signature of an FPT problem — and the exponential factor is meant to be in .
See also: NP-Completeness · Tree DP · Branch and Bound