Parameterized Algorithms & Kernelization
Fixed-parameter tractability, bounded search trees and kernels.
Vertex cover is NP-hard, yet with a budget of vertices it is solved on graphs with millions of edges, because the exponential part of the work depends on alone. -clique looks just as innocent, and nobody expects an algorithm of that shape for it. Parameterized complexity explains the difference, with a toolbox (search trees, kernels, color coding, treewidth) and lower bounds that match it.
What you’ll learn
- Define FPT, XP and kernels, and prove that a decidable problem is FPT exactly when it has a kernel.
- Analyze branching algorithms through their recurrences, from to for vertex cover, and state the current bounds.
- Build kernels for vertex cover (Buss's edges, and vertices from the half-integral LP), and state why quadratically many edges is essentially optimal.
- Solve -path by color coding in times polynomial time, and explain dynamic programming over tree decompositions and Courcelle's theorem.
- Use W[1]-hardness and the Exponential Time Hypothesis to argue that -clique is not FPT and that is essentially optimal for it.
FPT, XP and kernels
| Problem (parameter) | Status | Best known |
|---|---|---|
| Vertex cover (cover size ) | FPT; kernel with vertices | (Chen, Kanj & Xia, 2010); (Harris & Narayanaswamy, 2024) |
| -path (a simple path on vertices) | FPT; no polynomial kernel unless coNP ⊆ NP/poly | by color coding; randomized (Williams, 2009) |
| -clique, -independent set | W[1]-complete | with fast matrix multiplication (Nešetřil & Poljak, 1985) |
| Dominating set (size ) | W[2]-complete | about |
| Graph coloring (number of colors) | NP-hard already for 3 colors | not even in XP unless P = NP |
| Any MSO-definable property (treewidth ) | FPT by Courcelle's theorem |
Kernel ⇒ FPT. Compute the kernel in polynomial time, then decide it by any algorithm. Its size is at most , so that costs for some computable , and the total has the FPT form:
FPT ⇒ kernel. Let an algorithm run in time. If , it runs within , polynomial time: run it, and output a fixed small yes- or no-instance. Otherwise , and is itself a kernel of size below .
So the real question is never whether an FPT problem has a kernel, but how small it can be. Polynomial kernels are the gold standard of provable preprocessing.
Branching numbers
A branching algorithm splits an instance into subinstances with smaller parameters. If every branching splits into , the number of leaves obeys , so , where the branching number is the largest real root of:
Branching on an edge , taking or taking , has the vector : , the of the Optimized lesson. Branching on a vertex of degree at least 3, taking or else all of , has a vector at least as good as . When no vertex has degree 3 or more, every component is a path or a cycle, and those are solved directly.
def without(adj, S):
return {v: ns - S for v, ns in adj.items() if v not in S}
def vc_branch(adj, k):
"""adj: {vertex: set of neighbors}. Is there a vertex cover of size <= k?"""
if k < 0:
return False # the budget is overspent
adj = {v: ns for v, ns in adj.items() if ns} # isolated vertices never help
if not adj:
return True
if k == 0:
return False
v = max(adj, key=lambda x: len(adj[x]))
if len(adj[v]) <= 2: # paths and cycles: solve directly
need, seen = 0, set()
for s in adj:
if s in seen:
continue
comp, stack = {s}, [s]
while stack:
for w in adj[stack.pop()] - comp:
comp.add(w)
stack.append(w)
seen |= comp
edges = sum(len(adj[w]) for w in comp) // 2
need += len(comp) // 2 if edges < len(comp) else (len(comp) + 1) // 2
return need <= k
return (vc_branch(without(adj, {v}), k - 1) # v in the cover
or vc_branch(without(adj, adj[v]), k - len(adj[v]))) # or all of N(v)Correct because a cover that omits must contain all of . A path on vertices needs cover vertices, a cycle on vertices . Checked against brute force on 1,500 random graphs; an early draft that tested the budget after the empty-graph case wrongly accepted overspent budgets, which is exactly what such tests catch.
Taking lowers by 1; taking lowers it by at least 3:
Substituting and dividing by :
For , about 2,100 leaves instead of :
A branching rule always creates two subproblems, with parameters and . What is its branching number ?
Show the answer
1.618
gives , the golden ratio: the leaves count like Fibonacci numbers. Every extra unit of guaranteed decrease in a branch pulls further below 2.
Refined case analyses push further: (Chen, Kanj & Xia, 2010), which stood for more than a decade, and (Harris & Narayanaswamy, 2024), which branches while tracking the gap between and the LP bound. Below all of them lies a floor: if the Exponential Time Hypothesis holds, no algorithm exists, since and vertex cover has no algorithm under that hypothesis.
Kernels: k², 2k, and no smaller
Buss's rule (Optimized lesson) leaves at most edges and vertices. Linear programming does better on vertices.
Compute a half-integral optimum ; a maximum-matching computation in a bipartite double cover of finds one in polynomial time. By the theorem, has a cover of size at most if and only if has one of size at most :
The LP value of is a lower bound on its optimum:
So if the answer is no; otherwise is an equivalent instance with few vertices:
Not every FPT problem has a polynomial kernel. Using OR-compositions, Bodlaender, Downey, Fellows and Hermelin (2009) and Fortnow and Santhanam (2011) showed that -path has none unless coNP ⊆ NP/poly, which would collapse the polynomial hierarchy.
For vertex cover, Dell and van Melkebeek (2010) proved that kernels with bits are impossible under the same assumption, so no kernel has edges either: Buss's quadratic number of edges is essentially optimal.
The LP kernel leaves at most vertices, yet kernels with edges are ruled out (unless coNP ⊆ NP/poly). Do these results contradict each other?
- Yes, so one of them must be wrong
- No: the LP kernel cannot actually be computed in polynomial time
- No: the lower bound applies only to planar graphs
- No: a graph on vertices can still have about edges, so a linear number of vertices allows a quadratic number of edges
Show the answer
D. No: a graph on vertices can still have about edges, so a linear number of vertices allows a quadratic number of edges
vertices span up to edges. Encoding such a kernel takes bits in the worst case, which is exactly what the lower bound says cannot be beaten by a polynomial factor.
Color coding and treewidth
Is there a simple path through exactly vertices? Trying all vertex sequences is XP. Alon, Yuster and Zwick (1995) found a beautiful randomized trick, color coding: color the vertices at random with colors and look only for colorful paths, whose vertices all have different colors. A colorful path is automatically simple, and finding one is a DP over sets of colors, of them, instead of sets of vertices.
import math, random
def has_k_path(adj, k, trials):
"""True if a random coloring reveals a simple path on k vertices; never a false 'yes'."""
n = len(adj)
for _ in range(trials):
color = [random.randrange(k) for _ in range(n)]
ends = [{1 << color[v]} for v in range(n)] # color sets of colorful paths ending at v
for _ in range(k - 1): # extend every path by one vertex
nxt = [set() for _ in range(n)]
for u in range(n):
for S in ends[u]:
for v in adj[u]:
if not S >> color[v] & 1: # v's color unused: still colorful
nxt[v].add(S | 1 << color[v])
ends = nxt
if any(ends):
return True
return False
path5 = [{1}, {0, 2}, {1, 3}, {2, 4}, {3}]
print(has_k_path(path5, 5, trials=int(5 * math.e ** 5) + 1)) # TrueOne trial is a DP over (vertex, set of colors used): time. Run against brute force on 800 random graphs with trials each, it gave no false answers. On the 5-vertex path a single trial succeeds with probability , so 743 trials miss with probability below .
A fixed path on vertices gets distinct colors with probability , and :
After independent colorings, it has stayed non-colorful with probability:
Total time, with one-sided error: a yes is always correct. Perfect hash families derandomize it to deterministic time.
A tree decomposition of is a tree whose nodes carry bags of vertices, such that every edge of lies inside some bag and the bags containing any one vertex form a connected subtree. Its width is the largest bag size minus 1, and the treewidth of is the smallest width possible: 1 for a tree with an edge, for the grid.
Dynamic programming runs up the decomposition with a table per bag, indexed by the states of the bag's vertices. For maximum independent set the state is which vertices of the bag are in the set, at most entries per bag, giving time from a decomposition of width with nodes.
Lower bounds: W[1] and the Exponential Time Hypothesis
NP-hardness cannot tell vertex cover from clique: both are NP-complete. Parameterized complexity uses parameterized reductions, maps computable in time with , which carry FPT algorithms backward. The class W[1] is the closure of -clique under such reductions (Downey & Fellows, 1995), and is the standard conjecture, the parameterized analogue of P ≠ NP.
| Problem | Algorithm | Ruled out under ETH |
|---|---|---|
| Vertex cover | ||
| -clique | ||
| Planar vertex cover | ||
| Independent set on treewidth | ; SETH even rules out (Lokshtanov, Marx & Saurabh, 2011) |
Why does ETH rule out a algorithm for vertex cover?
- Because vertex cover is W[1]-hard
- Because the cover size is at most , so such an algorithm would solve vertex cover in time, which ETH forbids via the linear-size reduction from 3-SAT
- Because every branching algorithm needs at least leaves
- Because kernels cannot be smaller than vertices
Show the answer
B. Because the cover size is at most , so such an algorithm would solve vertex cover in time, which ETH forbids via the linear-size reduction from 3-SAT
On graphs from the sparsified 3-SAT reduction, , so would be , contradicting ETH. The lower bound concerns all algorithms, not just branching.
Key takeaways
- FPT means , XP means ; a decidable problem is FPT exactly when it has a kernel, so the real question is how small a kernel can be.
- Branching algorithms run in , with the largest root of the characteristic equation: for , for ; the best vertex-cover bounds are (2010) and (2024).
- Vertex cover has kernels with edges (Buss) and vertices (Nemhauser–Trotter LP); edges is impossible unless coNP ⊆ NP/poly, and -path has no polynomial kernel at all.
- Color coding finds -paths in expected time; DP over tree decompositions and Courcelle's theorem make MSO-definable problems linear for bounded treewidth.
- -clique is W[1]-complete, and under ETH it has no algorithm, nor does vertex cover have a one.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
-clique can be solved in time by checking every set of vertices. What does this say about its parameterized complexity?
- It is FPT, since the running time is polynomial for each fixed
- It is in XP; it is FPT only if the degree of the polynomial could be made independent of , which W[1]-hardness makes unlikely
- It is not even in XP
- It has a polynomial kernel
Show the answer
B. It is in XP; it is FPT only if the degree of the polynomial could be made independent of , which W[1]-hardness makes unlikely
is XP: polynomial for each fixed , with degree growing with . FPT demands with a fixed . -clique is W[1]-complete, and under ETH not even is possible.
Why does branching on a vertex of degree at least 3 give leaves rather than ?
- Because it branches three ways instead of two
- Because high-degree vertices are always in the cover
- Because one of its two branches puts at least 3 vertices into the cover, lowering by at least 3
- Because paths and cycles are solved by brute force
Show the answer
C. Because one of its two branches puts at least 3 vertices into the cover, lowering by at least 3
The recurrence grows like with , so . Branching on an edge lowers by only 1 in each branch: .
Which statement about kernels is true?
- Every FPT problem has a polynomial kernel
- A kernel must have size
- A decidable parameterized problem is FPT if and only if it has a kernel
- Computing a kernel solves the problem
Show the answer
C. A decidable parameterized problem is FPT if and only if it has a kernel
An FPT algorithm can be turned into a kernel of size , and a kernel plus brute force gives an FPT algorithm. Whether a polynomial kernel exists is a finer question: -path has none unless coNP ⊆ NP/poly.
Why does color coding search for colorful paths, whose vertices all have different colors, instead of simple paths?
- Because colorful paths are shorter
- Because a colorful path is automatically simple, and the DP only needs to remember the set of colors used, possibilities, instead of the set of vertices used
- Because random colors make the graph sparser
- Because every simple path is colorful
Show the answer
B. Because a colorful path is automatically simple, and the DP only needs to remember the set of colors used, possibilities, instead of the set of vertices used
Repeated vertices would repeat a color, so colorful implies simple. Tracking colors costs states per vertex rather than vertex sets, and a fixed -path is colorful with probability , so random colorings suffice.
Further reading
- M. Cygan, F. V. Fomin, Ł. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk & S. Saurabh, Parameterized Algorithms (Springer, 2015).
- R. G. Downey & M. R. Fellows, Fundamentals of Parameterized Complexity (Springer, 2013).
- N. Alon, R. Yuster & U. Zwick, "Color-coding," Journal of the ACM 42(4) (1995), 844–856.
- J. Chen, I. A. Kanj & G. Xia, "Improved upper bounds for vertex cover," Theoretical Computer Science 411(40–42) (2010), 3736–3756.
- G. L. Nemhauser & L. E. Trotter, "Vertex packings: structural properties and algorithms," Mathematical Programming 8 (1975).