Introduction to Parametrized Algorithms
Marcin Pilipczuk most slides by Łukasz Kowalik
some slides by Marek Cygan and Michał Pilipczuk
Algorytmika, 18.05.2020
Overview
1 A motivating example, definition of classes FPT, XP.
2 Technique: branching
3 Technique: kernelization
The book
Everything can be found in
http://parameterized-algorithms.mimuw.edu.pl
Motivation
We would like to solve NP-hard problems efficiently.
We are not interested in approximation, heuristics, etc.
We want exact solutions, with provable guarantees.
(Unless P=NP) we cannot solve all instances fast; let us just solve the simple ones fast.
Which istances are simple?
What do we mean by fast?
Parameterized algorithms - example
There were 104 measurements performed, each of them can report wrong output with probability p ≤ 0.1%.
Create a graph G = (V , E ):
I Vertices are measurements.
I u and v adjacent if measurements u and v contradict each other.
We want to find minimum sized subset X of measurements such that measurements in V \ X are non-contradictory.
We expect |X | ≤ 10.
The number 10 can be treated as a measure of hardness of the instance.
Vertex cover
Vertex cover of a graph G = (V , E ) is a set S ⊆ V which touches all edges, i.e. for every uv ∈ E we have u ∈ S or v ∈ S.
Decision problem
Input: Graph G = (V , E ), a number k ∈ N.
Does G admit a vertex cover of size ≤ k?
Vertex cover: algorithm in time O(2
k· (|V | + |E |))
Decision problem
Input: Graph G = (V , E ), a number k ∈ N.
Does G admit a vertex cover of size ≤ k?
Exhaustive search in time O(nk · |E |) VertexCover(G = (V , E ),k)
1: for each X ⊆ V , |X | = k do
2: ifall edges incident to X return YES
3: return NO
Not very good for k = 10.
Greedy improvements (pick vertices of maximum degree) do not help.
Vertex cover: algorithm in time O(2
k· (|V | + |E |))
Decision problem
Input: Graph G = (V , E ), a number k ∈ N.
Does G admit a vertex cover of size ≤ k?
Exhaustive search in time O(nk · |E |) VertexCover(G = (V , E ),k)
1: for each X ⊆ V , |X | = k do
2: ifall edges incident to X return YES
3: return NO
Not very good for k = 10.
Greedy improvements (pick vertices of maximum degree) do not help.
Vertex cover: algorithm in time O(2
k· (|V | + |E |))
Decision problem
Input: Graph G = (V , E ), a number k ∈ N.
Does G admit a vertex cover of size ≤ k?
Branching algorithm in time O(2k· (|V | + |E |)) VertexCover(G = (V , E ),k)
1: if E = ∅ return YES
2: if k = 0 return NO
3: Pick any edge uv ∈ E
4: VertexCover(G − u,k − 1) or VertexCover(G − v ,k − 1) Reasonable running time for k = 10.
Parameterized decision problems
Let Σ be a finite alphabet. Say, Σ = {0, 1}.
(Classical) decision problem
Decision problem is any subset L of words over Σ, i.e., L ⊆ Σ∗. Intuition: L is a set of (binary encodings of) YES-instances.
Example: VertexCover is a set of binary encodings of pairs (G , k) such that G admits a vertex cover of size k.
Parameterized decision problem
Parameterized decision problem is any subset L ⊆ Σ∗× N.
For an instance (x, k) ∈ Σ∗× N, k is called a parameter.
Parameterized decision problems: examples
Vertex cover parameterized by the solution size
L = {(e(G ), k) : G admits a vertex cover of size k}; e is an encoding
Clique parameterized by the maximum degree
L = {((G , k), ∆) : G contains a clique of size k and ∆ = ∆(G )} Independent Set parameterized by treewidth
L = {((G , k), t) :
G admits an independent set of size k and G has treewidth t} The central question of the area:
How does the complexity of a parameterized problem depend on the parameter?
Parameterized decision problems: examples
Vertex cover parameterized by the solution size L = {(G , k) : G admits a vertex cover of size k}
Clique parameterized by the maximum degree
L = {((G , k), ∆) : G contains a clique of size k and ∆ = ∆(G )} Independent Set parameterized by treewidth
L = {((G , k), t) :
G admits an independent set of size k and G has treewidth t} The central question of the area:
How does the complexity of a parameterized problem depend on the parameter?
Parameterized decision problems: examples
Vertex cover parameterized by the solution size L = {(G , k) : G admits a vertex cover of size k}
Clique parameterized by the maximum degree
L = {((G , k), ∆) : G contains a clique of size k and ∆ = ∆(G )}
Independent Set parameterized by treewidth L = {((G , k), t) :
G admits an independent set of size k and G has treewidth t} The central question of the area:
How does the complexity of a parameterized problem depend on the parameter?
Parameterized decision problems: examples
Vertex cover parameterized by the solution size L = {(G , k) : G admits a vertex cover of size k}
Clique parameterized by the maximum degree
L = {((G , k), ∆) : G contains a clique of size k and ∆ = ∆(G )}
Independent Set parameterized by treewidth L = {((G , k), t) :
G admits an independent set of size k and G has treewidth t}
The central question of the area:
How does the complexity of a parameterized problem depend on the parameter?
Parameterized decision problems: examples
Vertex cover parameterized by the solution size L = {(G , k) : G admits a vertex cover of size k}
Clique parameterized by the maximum degree
L = {((G , k), ∆) : G contains a clique of size k and ∆ = ∆(G )}
Independent Set parameterized by treewidth L = {((G , k), t) :
G admits an independent set of size k and G has treewidth t}
The central question of the area:
How does the complexity of a parameterized problem depend on the parameter?
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N and a constant c such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nc
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT)
A is also called FPT algorithm. Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT)
A is also called FPT algorithm. Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Examples: time O(2kn), O(k! · n15), O(10k+ n3), O(22kn3), O(222kn5), O(222
···2
| {z }
k times
n2)
BAD examples: O(2nk), O(nk), O(nlog log k)
Problem L is then called fixed parameter tractable (FPT)
A is also called FPT algorithm. Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm} Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT)
A is also called FPT algorithm. Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT) A is also called FPT algorithm.
Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT) A is also called FPT algorithm.
Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT) A is also called FPT algorithm.
Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
Parameterized algorithm: definition
Let L be a parameterized problem.
Parameterized algorithm
Algorithm A is a parameterized algorithm for L if there is a computable function f : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · nO(1)
where n = |(x, k)| is the size of the instance.
Problem L is then called fixed parameter tractable (FPT) A is also called FPT algorithm.
Class of decision problems:
FPT = {L ⊆ Σ∗× N : L admits an FPT algorithm}
Note: P ⊆ FPT, but FPT 6⊆ NP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k. Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k). BAD examples: O(2nk), O(kn)
Class of decision problems:
XP = {L ⊆ Σ∗× N : L admits an XP algorithm} Note: P ⊆ FPT ⊆ XP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k.
Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k). BAD examples: O(2nk), O(kn)
Class of decision problems:
XP = {L ⊆ Σ∗× N : L admits an XP algorithm} Note: P ⊆ FPT ⊆ XP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k.
Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k).
BAD examples: O(2nk), O(kn) Class of decision problems:
XP = {L ⊆ Σ∗× N : L admits an XP algorithm} Note: P ⊆ FPT ⊆ XP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k.
Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k).
BAD examples: O(2nk), O(kn)
Class of decision problems:
XP = {L ⊆ Σ∗× N : L admits an XP algorithm} Note: P ⊆ FPT ⊆ XP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k.
Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k).
BAD examples: O(2nk), O(kn) Class of decision problems:
XP = {L ⊆ Σ∗× N : L admits an XP algorithm} Note: P ⊆ FPT ⊆ XP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k.
Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k).
BAD examples: O(2nk), O(kn) Class of decision problems:
XP = {L ⊆ Σ∗× N : L admits an XP algorithm}
Note: P ⊆ FPT ⊆ XP.
XP algorithm: definition
Let L be a parameterized problem.
XP algorithm
Algorithm A is an XP algorithm for L if
there are two computable functions f , g : N → N such that
for every (x, k) ∈ Σ∗× N, algorithm A correctly decides if (x, k) ∈ L in timef (k) · ng (k)
where n = |(x, k)| is the size of the instance.
think: polynomial for every fixed k.
Examples: time O(2kn), O(222···2
| {z }
k times
n2), O(nlog log k), O(nk), O(n22k).
BAD examples: O(2nk), O(kn) Class of decision problems:
Technique: branching
Vertex Cover
Branching algorithm in time O(2k· (|V | + |E |)) VertexCover(G = (V , E ),k)
1: if E = ∅ return YES
2: if k = 0 return NO
3: Pick any edge uv ∈ E
4: VertexCover(G − u,k − 1) or VertexCover(G − v ,k − 1) Recursion tree of depth at most k.
Each node in the recursion tree has at most 2 children.
Faster Vertex Cover
Faster branching algorithm VertexCover(G = (V , E ),k)
1: ifmaximum degree ≤ 2, solve in linear time
2: if k = 0 return NO
3: Pick v of maximum degree
4: VertexCover(G − v ,k − 1) or VertexCover(G − N(v ),k − |N(v )|)
T (k) ≤ T (k − 1) + T (k − 3)
T (k) ≤ 1.4656k.
Faster Vertex Cover
Faster branching algorithm VertexCover(G = (V , E ),k)
1: ifmaximum degree ≤ 2, solve in linear time
2: if k = 0 return NO
3: Pick v of maximum degree
4: VertexCover(G − v ,k − 1) or VertexCover(G − N(v ),k − |N(v )|)
T (k) ≤ T (k − 1) + T (k − 3)
T (k) ≤ 1.4656k.
Faster Vertex Cover
Faster branching algorithm VertexCover(G = (V , E ),k)
1: ifmaximum degree ≤ 2, solve in linear time
2: if k = 0 return NO
3: Pick v of maximum degree
4: VertexCover(G − v ,k − 1) or VertexCover(G − N(v ),k − |N(v )|)
T (k) ≤ T (k − 1) + T (k − 3)
T (k) ≤ 1.4656k.
General Idea
A recursive algorithm
At every recursive call, we branch into f (k) cases Depth of the recursion is g (k).
Example:
Vertex Cover, first algorithm: f (k) = 2, g (k) = k.
FVS in tournaments
Feedback Vertex Set (FVS) in Tournaments Input: a tournament (oriented clique) T , integer k Question: is there a subset X ⊆ V (T ) of size at most k,
such that T \ X is acyclic
FVS in tournaments
Feedback Vertex Set (FVS) in Tournaments Input: a tournament (oriented clique) T , integer k Question: is there a subset X ⊆ V (T ) of size at most k,
such that T \ X is acyclic
FVS in tournaments
Lemma
If a tournament contains a cycle, then it contains a 3-cycle.
FVS in tournaments
Lemma
If a tournament contains a cycle, then it contains a 3-cycle.
FVS in tournaments
Lemma
If a tournament contains a cycle, then it contains a 3-cycle.
FVS in tournaments
Lemma
If a tournament contains a cycle, then it contains a 3-cycle.
Branching algorithm in time O∗(3kn3) FVS(G = (V , E ),k)
1: if k < 0 return NO
2: if G has no directed 3-cycle return YES
3: Let abc be a directed 3-cycle
4: return FVS(G − a,k − 1) or FVS(G − b,k − 1) or FVS(G − c,k − 1)
Technique: kernelization
Kernelization: FPT by preprocessing
NP-hard problem instance
k k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k) Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k) Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k) Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k) Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k)
want: f (k) = poly(k) Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k)
Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k) Kernelization algorithm for a parameterized problem L is any polynomial-time algorithm which, given an instance (x, k) returns an instance (x0, k0) such that:
Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’. Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k). Usually, we are interested in polynomial kernels (of size kO(1)).
Kernelization: FPT by preprocessing
NP-hard problem instance k
k
NP-hard problem instance
poly time
size ≤ f (k) want: f (k) = poly(k) Instead of saying ‘L has a kernelization algorithm which returns an instance of size f (k)’ we say shortly ‘L has a kernel of size f (k)’.
Kernel of size f (k) for a problem in NP implies FPT algorithm in time O(exp(poly(f (k))))
One can show that an FPT algorithm implies a kernel of size f (k).
Usually, we are interested in polynomial kernels (of size kO(1)).
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
Why correct?
(G , k) ∈ VertexCover ⇔ (G − v , k − 1) ∈ VertexCover
(⇐) Let X0 be a vertex cover in G − v .
Then X0∪ {v } is a vertex cover of size k in G . (⇒) Let X be a vertex cover in G , |X | ≤ k.
ThenX contains v (why?).
So X \ {v } is a vertex cover of size ≤ k − 1 in G − v .
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v . Why correct?
(G , k) ∈ VertexCover ⇔ (G − v , k) ∈ VertexCover
(⇐) Let X0 be a vertex cover of size k in G − v . Then X0 is a vertex cover of size k in G .
(⇒) Let X be a minimum vertex cover in G , |X | ≤ k.
Thenv 6∈ X (why?).
So X is a vertex cover of size ≤ k in G − v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO. Why correct?
If YES, i.e., exists a vertex cover X , |X | ≤ k then
|E | ≤X
x ∈X
deg(x ) ≤ X
x ∈X
k ≤ k2.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |). Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |).
Theorem
Vertex Cover admits a kernel with at most k2 edges. Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |).
Theorem
Vertex Cover admits a kernel with at most k2 edges.
Theorem
Vertex Cover admits a kernel with at most 2k2 vertices. Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
A simple kernel for vertex cover
Kernelization algorithm:
1 While there is v ∈ V with deg(v ) > k, remove v and decrease k by 1.
2 While there is v ∈ V with deg(v ) = 0, remove v .
3 If now |E | > k2 return NO.
4 return (G , k).
Running time O(|E | + |V |).
Theorem
Vertex Cover admits a kernel with at most k2 edges.
Theorem
Vertex Cover admits a kernel with at most 2k2 vertices.
Proof:
|V | ≤2 X
v ∈V
deg(v ) = 2|E | ≤ 2k2
FPT algorithms from the kernel
Theorem
Vertex Cover admits a kernel with at most 2k2 vertices, and it can be computed in time O(|E | + |V |).
Exhaustive search: 2kk2 = kO(k).
Whole FPT algorithm: O(|E | + |V | + kO(k))
Branching: 2k · k2. Whole FPT algorithm: O(|E | + |V | + 2k· k2).
Compare with O(2k· (|V | + |E |))
Kernel of size 2k vertices for VertexCover
Consider the standard integer linear program for finding minimum vertex cover.
min P
v ∈V xv
xu+ xv ≥ 1 for each uv ∈ E xv ≥ 0 for each v ∈ V . xv ∈ Z for each v ∈ V .
... and its relaxation (a linear program):
min P
v ∈V xv
xu+ xv ≥ 1 for each uv ∈ E xv ≥ 0 for each v ∈ V .
Theorem (Khachiyan 1979)
Linear programming admits a polynomial time algorithm.
Kernel of size 2k vertices for VertexCover
Consider the standard integer linear program for finding minimum vertex cover.
min P
v ∈V xv
xu+ xv ≥ 1 for each uv ∈ E xv ≥ 0 for each v ∈ V . xv ∈ Z for each v ∈ V . ... and its relaxation (a linear program):
min P
v ∈V xv
xu+ xv ≥ 1 for each uv ∈ E xv ≥ 0 for each v ∈ V .
Theorem (Khachiyan 1979)
Vertex Cover LP
cost: n − 1
cost: n/2
Vertex Cover LP
min X
v ∈V (G )
xv
s.t. xu+ xv ≥ 1 ∀uv ∈E (G )
xv ≥ 0 ∀v ∈V (G )
Vertex Cover LP
cost: n − 1
cost: n/2
Vertex Cover LP
min X
v ∈V (G )
xv
s.t. xu+ xv ≥ 1 ∀uv ∈E (G )
xv ≥ 0 ∀v ∈V (G )
Vertex Cover LP
cost: n − 1
cost: n/2
Vertex Cover LP
min X
v ∈V (G )
xv
s.t. xu+ xv ≥ 1 ∀uv ∈E (G )
xv ≥ 0 ∀v ∈V (G )
Vertex Cover LP: vertex classes
xv = 0 ⇐⇒ v ∈ V0
0 < xv < 12 ⇐⇒ v ∈ Vε
xv =12 ⇐⇒ v ∈ V1
2
1
2< xv < 1 ⇐⇒ v ∈ V1−ε
xv = 1 ⇐⇒ v ∈ V1
V<1
2 = V0∪ Vε
V>1
2 = V1∪ V1−ε
Vertex Cover LP: analysis
+ε −ε
1 V<1
2
independent, E (V<1 2, V1
2) = ∅,
⇒ ∀v ∈V
< 12
N(v ) ⊆ V>1
2.
2 |V<1 2
| ≥ |V>1 2
|, otherwise +ε on V<1
2, −ε on V>1
2.
3 ∀X ⊆V
> 12
|X | ≤ |N(X ) ∩ V<1 2
|, otherwise +ε on N(X ) ∩ V<1
2, −ε on X .
4 Hall’s theorem
⇒ matching saturating V>1 2.
5 Greedily take V>1 2
and discard V<1 2
.
Vertex Cover LP: analysis
+ε −ε
1 V<1
2
independent, E (V<1 2, V1
2) = ∅,
⇒ ∀v ∈V
< 12
N(v ) ⊆ V>1
2.
2 |V<1 2
| ≥ |V>1 2
|, otherwise +ε on V<1
2, −ε on V>1
2.
3 ∀X ⊆V
> 12
|X | ≤ |N(X ) ∩ V<1 2
|, otherwise +ε on N(X ) ∩ V<1
2, −ε on X .
4 Hall’s theorem
⇒ matching saturating V>1 2.
5 Greedily take V>1 2
and discard V<1 2
.
Vertex Cover LP: analysis
+ε −ε
1 V<1
2
independent, E (V<1 2, V1
2) = ∅,
⇒ ∀v ∈V
< 12
N(v ) ⊆ V>1
2.
2 |V<1 2
| ≥ |V>1 2
|, otherwise +ε on V<1
2, −ε on V>1
2.
3 ∀X ⊆V
> 12
|X | ≤ |N(X ) ∩ V<1 2
|, otherwise +ε on N(X ) ∩ V<1
2, −ε on X .
4 Hall’s theorem
⇒ matching saturating V>1 2.
5 Greedily take V>1 2
and discard V<1 2
.
Vertex Cover LP: analysis
+ε −ε
1 V<1
2
independent, E (V<1 2, V1
2) = ∅,
⇒ ∀v ∈V
< 12
N(v ) ⊆ V>1
2.
2 |V<1 2
| ≥ |V>1 2
|, otherwise +ε on V<1
2, −ε on V>1
2.
3 ∀X ⊆V
> 12
|X | ≤ |N(X ) ∩ V<1 2
|, otherwise +ε on N(X ) ∩ V<1
2, −ε on X .
4 Hall’s theorem
⇒ matching saturating V>1 2.
5 Greedily take V>1 2
and discard V<1 2
.
Vertex Cover LP: analysis
+ε −ε
1 V<1
2
independent, E (V<1 2, V1
2) = ∅,
⇒ ∀v ∈V
< 12
N(v ) ⊆ V>1
2.
2 |V<1 2
| ≥ |V>1 2
|, otherwise +ε on V<1
2, −ε on V>1
2.
3 ∀X ⊆V
> 12
|X | ≤ |N(X ) ∩ V<1 2
|, otherwise +ε on N(X ) ∩ V<1
2, −ε on X .
4 Hall’s theorem
⇒ matching saturating V>1 2.
5 Greedily take V>1 2
and discard V<1 2
.
Vertex Cover LP: analysis
+ε −ε
1 V<1
2
independent, E (V<1 2, V1
2) = ∅,
⇒ ∀v ∈V
< 12
N(v ) ⊆ V>1
2.
2 |V<1 2
| ≥ |V>1 2
|, otherwise +ε on V<1
2, −ε on V>1
2.
3 ∀X ⊆V
> 12
|X | ≤ |N(X ) ∩ V<1 2
|, otherwise +ε on N(X ) ∩ V<1
2, −ε on X .
4 Hall’s theorem
⇒ matching saturating V>1 2.
5 Greedily take V>1 2
and discard V<1 2
.
Vertex Cover LP: analysis
−ε +ε
+ε −ε
1 E (V0, V1−ε) = ∅,
⇒ N(V1−ε) ∩ V<1
2
⊆ Vε.
2 if |V1−ε| ≤ |Vε|, then
we can +ε on V1−ε, −ε on Vε.
3 if |V1−ε| ≥ |Vε|, then
we can +ε on Vε, −ε on V1−ε.
4 conclusion: there exists LP optimum with V = V0∪ V1
2 ∪ V1.
Vertex Cover LP: analysis
−ε +ε
+ε −ε
1 E (V0, V1−ε) = ∅,
⇒ N(V1−ε) ∩ V<1
2
⊆ Vε.
2 if |V1−ε| ≤ |Vε|, then
we can +ε on V1−ε, −ε on Vε.
3 if |V1−ε| ≥ |Vε|, then
we can +ε on Vε, −ε on V1−ε.
4 conclusion: there exists LP optimum with V = V0∪ V1
2 ∪ V1.
Vertex Cover LP: analysis
−ε +ε
+ε −ε
1 E (V0, V1−ε) = ∅,
⇒ N(V1−ε) ∩ V<1
2
⊆ Vε.
2 if |V1−ε| ≤ |Vε|, then
we can +ε on V1−ε, −ε on Vε.
3 if |V1−ε| ≥ |Vε|, then
we can +ε on Vε, −ε on V1−ε.
4 conclusion: there exists LP optimum with V = V0∪ V1
2 ∪ V1.
Vertex Cover LP: analysis
−ε +ε
+ε −ε
1 E (V0, V1−ε) = ∅,
⇒ N(V1−ε) ∩ V<1
2
⊆ Vε.
2 if |V1−ε| ≤ |Vε|, then
we can +ε on V1−ε, −ε on Vε.
3 if |V1−ε| ≥ |Vε|, then
we can +ε on Vε, −ε on V1−ε.
4 conclusion: there exists LP optimum with V = V0∪ V1
2 ∪ V1.
Vertex Cover LP: analysis
−ε +ε
+ε −ε
1 E (V0, V1−ε) = ∅,
⇒ N(V1−ε) ∩ V<1
2
⊆ Vε.
2 if |V1−ε| ≤ |Vε|, then
we can +ε on V1−ε, −ε on Vε.
3 if |V1−ε| ≥ |Vε|, then
we can +ε on Vε, −ε on V1−ε.
4 conclusion: there exists LP optimum with V = V0∪ V1
2 ∪ V1.
Vertex Cover LP: summary of analysis
1 There exists LP optimum with V = V0∪ V1
2 ∪ V1.
I Half-integrality
2 If V1
2 6= V , then we can reduce something.
I Take V1 into solution, and discard V0.
unique LP optimum
Vertex Cover LP: summary of analysis
1 There exists LP optimum with V = V0∪ V1
2 ∪ V1.
I Half-integrality
2 If V1
2 6= V , then we can reduce something.
I Take V1 into solution, and discard V0.
unique LP optimum
Kernel of size 2k vertices for VertexCover
Theorem (Nemhauser, Trotter 1974) Let {xv}v ∈V be any optimal solution of the vertex cover LP. Partition V :
V0 = {v ∈ V (G ) : xv < 12}, V1/2= {v ∈ V (G ) : xv = 12}, V1 = {v ∈ V (G ) : xv > 12}.
Then there is a minimum vertex cover S of G such that V1 ⊆ S, V0∩ S = ∅.
Vertex Cover LP:
min P
v ∈Vxv
∀ uv ∈ E xu+ xv ≥ 1
∀ v ∈ V xv ≥ 0.
(G , k) ∈ VertexCover ⇔ (G [V1/2], k − |V1|) ∈ VertexCover (⇒) SinceV1 ⊆ S and|S| ≤ k we have |S \ X1|=|S| − |V1|≤k − |V1|.
Also, S \ V1 is a vertex cover in G [V1/2]. (check it!)
0
Kernelization algorithm:
1 Solve the vertex cover LP and get an optimal solution {xv}v ∈V.
2 If |V1/2| > 2k return NO.
3 return (G [V1/2], k − |V1|). Theorem
Vertex cover admits a kernel of vertex size at most 2k.
Kernel of size 2k vertices for VertexCover
Theorem (Nemhauser, Trotter 1974) Let {xv}v ∈V be any optimal solution of the vertex cover LP. Partition V :
V0 = {v ∈ V (G ) : xv < 12}, V1/2= {v ∈ V (G ) : xv = 12}, V1 = {v ∈ V (G ) : xv > 12}.
Then there is a minimum vertex cover S of G such that V1 ⊆ S, V0∩ S = ∅.
Vertex Cover LP:
min P
v ∈Vxv
∀ uv ∈ E xu+ xv ≥ 1
∀ v ∈ V xv ≥ 0.
Kernelization algorithm:
1 Solve the vertex cover LP and get an optimal solution {xv}v ∈V.
2 If |V1/2| > 2k return NO.
3 return (G [V1/2], k − |V1|). Theorem
Vertex cover admits a kernel of vertex size at most 2k.
Kernel of size 2k vertices for VertexCover
Theorem (Nemhauser, Trotter 1974) Let {xv}v ∈V be any optimal solution of the vertex cover LP. Partition V :
V0 = {v ∈ V (G ) : xv < 12}, V1/2= {v ∈ V (G ) : xv = 12}, V1 = {v ∈ V (G ) : xv > 12}.
Then there is a minimum vertex cover S of G such that V1 ⊆ S, V0∩ S = ∅.
Vertex Cover LP:
min P
v ∈Vxv
∀ uv ∈ E xu+ xv ≥ 1
∀ v ∈ V xv ≥ 0.
Kernelization algorithm:
1 Solve the vertex cover LP and get an optimal solution {xv}v ∈V.
2 If |V1/2| > 2k return NO. Why correct?
Then,P
xv > k, so the integral solution has also value > k.
3 return (G [V1/2], k − |V1|). Theorem
Vertex cover admits a kernel of vertex size at most 2k.
Kernel of size 2k vertices for VertexCover
Theorem (Nemhauser, Trotter 1974) Let {xv}v ∈V be any optimal solution of the vertex cover LP. Partition V :
V0 = {v ∈ V (G ) : xv < 12}, V1/2= {v ∈ V (G ) : xv = 12}, V1 = {v ∈ V (G ) : xv > 12}.
Then there is a minimum vertex cover S of G such that V1 ⊆ S, V0∩ S = ∅.
Vertex Cover LP:
min P
v ∈Vxv
∀ uv ∈ E xu+ xv ≥ 1
∀ v ∈ V xv ≥ 0.
Kernelization algorithm:
1 Solve the vertex cover LP and get an optimal solution {xv}v ∈V.
2 If |V1/2| > 2k return NO.
3 return (G [V1/2], k − |V1|).
Theorem
Vertex cover admits a kernel of vertex size at most 2k.
Kernel of size 2k vertices for VertexCover
Theorem (Nemhauser, Trotter 1974) Let {xv}v ∈V be any optimal solution of the vertex cover LP. Partition V :
V0 = {v ∈ V (G ) : xv < 12}, V1/2= {v ∈ V (G ) : xv = 12}, V1 = {v ∈ V (G ) : xv > 12}.
Then there is a minimum vertex cover S of G such that V1 ⊆ S, V0∩ S = ∅.
Vertex Cover LP:
min P
v ∈Vxv
∀ uv ∈ E xu+ xv ≥ 1
∀ v ∈ V xv ≥ 0.
Kernelization algorithm:
1 Solve the vertex cover LP and get an optimal solution {xv}v ∈V.
2 If |V1/2| > 2k return NO.
3 return (G [V1/2], k − |V1|).
Vertex Cover LP branching
Assumption: V1
2 = V is the unique LP optimum.
Pick any vertex v .
Branch 1:
Take v into solution. Force xv = 1 in the LP. LP value goes up by 12. (k − LP) goes down by 12.
Branch 2:
Forbid v to be in the solution. Force xv = 0 in the LP.
LP value goes up by at least 12. (k − LP) goes down by at least 12.
Theorem
Vertex Cover can be solved in 4k−LP · (|V | + |E |)O(1) time.
Vertex Cover LP branching
Assumption: V1
2 = V is the unique LP optimum.
Pick any vertex v . Branch 1:
Take v into solution.
Force xv = 1 in the LP.
LP value goes up by 12. (k − LP) goes down by 12.
Branch 2:
Forbid v to be in the solution. Force xv = 0 in the LP.
LP value goes up by at least 12. (k − LP) goes down by at least 12.
Theorem
Vertex Cover can be solved in 4k−LP · (|V | + |E |)O(1) time.
Vertex Cover LP branching
Assumption: V1
2 = V is the unique LP optimum.
Pick any vertex v . Branch 1:
Take v into solution.
Force xv = 1 in the LP.
LP value goes up by 12. (k − LP) goes down by 12.
Branch 2:
Forbid v to be in the solution.
Force xv = 0 in the LP.
LP value goes up by at least 12. (k − LP) goes down by at least 12.
Theorem
Vertex Cover can be solved in 4k−LP · (|V | + |E |)O(1) time.
Vertex Cover LP branching
Assumption: V1
2 = V is the unique LP optimum.
Pick any vertex v . Branch 1:
Take v into solution.
Force xv = 1 in the LP.
LP value goes up by 12. (k − LP) goes down by 12.
Branch 2:
Forbid v to be in the solution.
Force xv = 0 in the LP.
LP value goes up by at least 12. (k − LP) goes down by at least 12.
Theorem
k−LP O(1)
A few examples of kernels
The problems below ask for a set vertices of size k and k is the parameter.
Size of the kernel = number of vertices.
VertexCover: 2k
Feedback Vertex Set: O(k2) Odd Cycle Transversal: kO(1) For planar graphs:
Dominating Set 67k,
Feedback Vertex Set 13k, Induced Matching 28k,
Connected Vertex Cover 113k,
Thanks and credits
Thanks!
Credits:
Slides mostly compiled from previous lectures of:
I Łukasz Kowalik
I Marek Cygan
I Michał Pilipczuk
Some nice figures by Felix Reidl.
Tikz faces based on a code by Raoul Kessels,
http://www.texample.net/tikz/examples/emoticons/, under Creative Commons Attribution 2.5 license (CC BY 2.5)