Advances in Graph Algorithms Desconocido
Advances in Graph Algorithms Desconocido
Z Y
<
y
<
<
X z
Preface
We prepared this book as a course textbook for our students in Taiwan. Our
aim was to write a book about some currently popular topics such as expo-
nential algorithms, fixed-parameter algorithms and algorithms using decom-
position trees of graphs. Especially for this last topic we found it necessary
to include a chapter on graph classes. The chapter on decomposition trees
includes some basics of the graph minor theory and such topics as tree de-
compositions and rank decompositions. To explain these concepts we found
it beneficial to include a chapter which explains the classes of chordal graphs
and distance-hereditary graphs.
After each chapter we included some basic exercises. For experienced stu-
dents these exercises are probably too easy. We made the decision to concen-
trate on elementary exercises in order not to distract the student too much
from the main topics. The exercises are primarily meant as a check for the
students that they understand the material of the chapter.
One of us, Ton Kloks, taught this course during the spring semester of 2012
at the Department of Computer Science of National Tsing Hua University. We
are indebted to our students for their enthusiasm. Special thanks go to Ching-
Hao Liu, who operated as a teaching assistant. He spotted numerous typos in
the original manuscript. Thanks to him this text has greatly improved.
Ton Kloks also wishes to express his gratitude towards the Department of
Computer Science of National Tsing Hua University for their hospitality and
for giving him the opportunity to teach this course. He is indebted to the
National Science Council of Taiwan for their financial support.
Ton Kloks
Department of Computer Science
National Tsing Hua University
Hsinchu, Taiwan.
Yue-Li Wang
Department of Information Management
National Taiwan University of Science and Technology
No. 43, Sec. 4, Keelung Rd., Taipei, 106, Taiwan
[email protected]
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Exponential Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Independent set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Chromatic number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.1 Three-coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Domatic partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 The traveling salesman problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.5 Set cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.6 Dominating set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6.1 Dominating set in bipartite graphs . . . . . . . . . . . . . . . . . . . 21
2.7 Inclusion – exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.7.1 Triangle partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.7.2 An improved algorithm for triangle partition . . . . . . . . . . 27
2.8 Subset sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.9 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3 Graph Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1 Perfect graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2 Comparability graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2.1 Recognition of comparability graphs . . . . . . . . . . . . . . . . . 47
3.3 Cographs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.3.1 Cotrees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.3.2 Finding cliques in cographs . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.4 Distance-hereditary graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.4.1 Decomposition trees for DH-graphs . . . . . . . . . . . . . . . . . . 60
3.4.2 Feedback vertex set in DH-graphs . . . . . . . . . . . . . . . . . . . . 62
3.5 Chordal graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.5.1 Clique trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.5.2 Algorithms for independent set, clique and vertex
coloring in chordal graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 71
VIII Contents
4 Fixed-parameter Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.1 Vertex cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.2 A kernel for vertex cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.3 A better search-tree algorithm for vertex cover . . . . . . . . . . . . . . . 98
4.4 Minimum fill-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.5 Odd cycle transversals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
4.5.1 Feedback vertex set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.6 Homogeneous coloring of perfect graphs . . . . . . . . . . . . . . . . . . . . 114
4.7 Color coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
4.8 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
1
Introduction
We expect that our students are familiar with the basic notions of graphs
and algorithms. In this chapter we review some of our notations.
A graph G is an ordered pair of sets, G = (V, E). The elements of the set V
are called the vertices of G. Sometimes we call the vertices ‘points.’ We require
that the set V is nonempty. The elements of the set E are called the edges of
G. Sometimes we call an edge a ‘line.’ An edge is a set of two vertices. When
the graph G is not clear from the context we use V(G) and E(G) to denote its
set of vertices and its set of edges. The two vertices of an edge are called the
endpoints of the edge. Two vertices x and y are adjacent in G if {x, y} ∈ E;
they are nonadjacent if {x, y} ∈ / E. When e = {x, y} ∈ E we say that e is an
edge which runs between x and y or, simpler, we say that e is an edge between
x and y.
All our graphs will be finite, that means that V is a finite set. A graph
G = (V, E) is called empty if E = ∅.
with
P = [x1 , . . . , xt ] (1.1)
in it. If the cycle is chordless then the length is also the number of edges in it.
When the set of vertices of a chordless path or a chordless cycle is the set of
vertices V of G, we say that G is a path or a cycle. Notice that we call a graph
a path or cycle only when it is chordless.
In our book we won’t go into complexity theory. We assume that our reader
is familiar with the basic notion of NP-completeness. Primarily, we will be con-
cerned with the question whether there exists a polynomial-time algorithm for
a problem or whether the problem is NP-complete.
We won’t go into many details about data structures. Usually it will be
sufficient to assume that the graph is represented by adjacency lists, or an
adjacency matrix, or a mix of these. The adjacency matrix of a graph G =
(V, E) with n vertices is an n × n matrix. The rows and columns are indexed
by the vertices. A matrix entry with row x and column y is 1 if {x, y} ∈ E
and otherwise the entry is 0. The adjacency matrix needs O(n2 ) space. The
advantage of the adjacency matrix is that one can test in O(1) time if two
vertices are adjacent or not. Adjacency lists require only linear space, that
is O(n + m) space. A clever mix of the two data structures, which uses the
adjacency matrix without initializing it, makes it possible to test if two vertices
are adjacent in O(1) time while using only linear space.
Many other concepts will pass the revue. We will explain them when we
meet them, as clearly as we can. Let’s just get started. We hope the reader will
enjoy the choice of our topics and the way we present them in this book.
2
Exponential Algorithms
Let’s face it: lots of interesting problems on graphs are NP-complete. In this
chapter we have a look at exponential algorithms.
An easy way to solve the problem is as follows. First, make a list of all sub-
sets of vertices. Next, check which subsets are independent sets. Then count
the number of vertices in each independent set and take the largest one.
time. (Of course, we can construct the adjacency matrix A in O(n2 ) time and
then proceed as before.)
If we use the O∗ -notation then we don’t need to worry about such details.
Let p(n) be some polynomial, for example p(n) = 10 · n5 . Suppose we can
check if any subset M is an independent set in at most p(n) time. Then the
algorithm described above runs in O(p(n) · 2n ) = O∗ (2n ) time.
There are algorithms that list all the maximal independent sets with poly-
nomial delay. That means that there exists some polynomial p(n) such that
the algorithm spends at most p(n) time before it generates the next (or the
first) independent set. For example, the algorithm of Tsukiyama, et al., takes
O(nm) time per maximal independent set, where n and m are the num-
ber of vertices and edges in the graph.2 These two results yield the following
theorem.
Theorem 2.1. There exists an O∗ (1.4422n ) algorithm that solves the maximum
independent set problem on a graph G, where n is the number of vertices in G.
Of course, this algorithm is much better than the O∗ (2n ) algorithm that
we started with. In the rest of this section we show that we can still do a little
bit better.
1
J. W. Moon and L. Moser, On cliques in graphs, Israel Journal of Mathematics 3
(1965), pp. 23–28.
2
S. Tsukiyama, M. Ide, H. Ariyoshi and I. Shirakawa, A new algorithm for generating
all the maximal independent sets, SIAM Journal on Computing 6 (1977), pp. 505–
517.
2.1 Independent set 7
Let x be a vertex of G. As usual we use the notation N(x) for the set of
neighbors of a vertex x. The degree of x is |N(x)|. We also use the notation
N[x] for the closed neighborhood of x, which is
In other words, Lemmas 2.2 and 2.3 show that, for any vertex x, a maxi-
mum independent set M can be derived from a maximimum independent set
in G − x or from a maximum independent set in G − N[x].
The algorithm builds a rooted binary tree T as follows. The root of T cor-
responds with the graph G. If the graph has only one vertex, then T consists
of the root only. Otherwise, choose a vertex x in G. The root has two children.
8 2 Exponential Algorithms
G
G-x G-N[x]
Fig. 2.1. This figure illustrates the search tree for maximum independent set.
The left child is the root of a binary tree which corresponds with the graph
G − x. The right child is the root of a binary tree which corresponds with the
graph G − N[x].
Lemma 2.4. Let G be a graph and assume that every vertex of G has degree at
most 2. Then a maximum independent set in G can be computed in linear time.
Proof. Since every vertex has degree at most 2, the graph is the union of a
collection of paths and cycles.
To compute the maximum independent set of G we can compute the maxi-
mum independent set in each of the (connected) components of G and add
them up. We leave it as an exercise to check the following claims, for example
by using (2.1).
The length of a path or cycle is the number of edges in the path or the cycle.
We now change the algorithm a little bit, as follows. As long as there exists
a vertex x in the graph with degree at least three, then the algorithm chooses
such a vertex to grow the tree T . When, at some point, a reduced graph H
has no more vertices of degree more than two then the algorithm uses the
linear-time algorithm described in Lemma 2.4 to compute α(H).
Let T (n) be the worst-case timebound that the algorithm needs to com-
pute α(G) for a graph G with n vertices. Then, by the Formula (2.1) and by
Lemma 2.4 we have the following recurrence relation for T (n).
i>3 ⇒ T (n − i − 1) 6 T (n − 4).
ω4 = ω3 + 1.
Some calculations (or a calculator) yield ω ≈ 1.3803. This proves the follow-
ing theorem.
10 2 Exponential Algorithms
Theorem 2.5. There exists an O∗ (1.3803n ) algorithm which solves the maxi-
mum independent set problem on a graph G, where n is the number of vertices
in G.
Remark 2.6. The technique that we used is sometimes called a ‘pruned search
tree technique.’ Pruning means that the search tree is cut short. In our case
the leaves of the search tree are graphs in which every vertex has degree at
most two. There are many ways to prune the search tree further (see, e.g.,
Exercise 2.2). It is one of the well-known techniques that are used in the
design of exponential algorithms.
Remark 2.7. Very often the timebound for an exponential algorithm follows
from a recurrence relation like Formula (2.2). If you want to study exact al-
gorithms it’s a good idea to obtain some basic knowledge about solving recur-
rence relations.
Remark 2.9. The best time-bound for an algorithm that solves the maximum
independent set problem seems to be Robson’s algorithm.4 This algorithm
uses exponential space. Robson claims that he improved his algorithm such
that, nowadays, it runs in O∗ (1.1844n ). This algorithm uses a computer-
generated case analysis with thousands of different cases. Jian designed an
algorithm for maximum independent set which runs in O(1.2346n ).5 This
algorithm uses only polynomial space.
the problem to color a planar graph with three colors is NP-complete. (By
the 4-color theorem every planar graph can be colored with four colors, but
checking if a planar graph can be colored with three colors is NP-complete.) In
this section we look at an exact algorithm for the chromatic number problem.
Recall the result of Moon and Moser: every graph with n vertices has at
most 3n/3 maximal independent sets and these can be listed in O(p(n) · 3n/3 )
time, where p(n) = nc is some polynomial (in Tsukiyama’s algorithm c 6 3).
When G has n vertices, then there are n` subsets S with ` vertices. This
X
n
n X
n
n `/3
p(`) 3 `/3
6 p(n) 3 = p(n)(1 + 31/3 )n .
` `
`=0 `=0
An easy calculation shows that 1 + 31/3 ≈ 2.4422 and this proves the
following theorem.
12 2 Exponential Algorithms
2.2.1 Three-coloring
Remark 2.15. Until now, the best algorithm for solving the 3-coloring problem
is an algorithm by Eppstein.8 This algorithm runs in O∗ (1.3289n ).
6
A. Björklund, T. Husfeldt and M. Koivisto, Set partitioning via inclusion-exclusion,
SIAM Journal on Computing 39 (2009), pp. 546–563.
7
E. L. Lawler, A note on the complexity of the chromatic number problem, Informa-
tion Processing Letters 5 (1976), pp. 66–67.
8
D. Eppstein, Improved algorithms for 3-coloring, 3-edge-coloring, and constraint
satisfaction, Proceedings of the 12th ACM-SIAM Symposium on Discrete Algorithms
SIAM, 2001.
2.3 Domatic partition 13
The dominating set problem asks for a dominating set of minimal cardi-
nality. Usually, one denotes the minimal cardinality of a dominating set in G
by γ(G).
Remark 2.17. It is easy to see that the dominating set problem can be solved
in O∗ (2n ) time, by simply testing every subset of V. In Section 2.6 we show
that the problem can be solved in O∗ (1.7088n ). In their recent book, Fomin
and Kratsch improve this. They show that the dominating set problem can be
solved in O∗ (1.5259n ) time.9
{ D1 , . . . , Dk }
a a
f e f e
b d c b d c
Fig. 2.2. This figure shows two domatic partitions; on the left {{a, b, c}, {d, e, f}} and on
the right {{a, d}, {b, e}, {c, f}}. The one on the right is a solution for the domatic partition
problem.
The domatic partition problem asks for a domatic partition of the graph with
a maximal number of dominating sets.
If X is a dominating set in G then let f(X) denote the maximal ` for which
there is an X-partition into ` dominating sets. If X is not a dominating set then
let f(X) = 0. Notice that f(V) solves the domatic partition problem.
t
u
Remark 2.21. Notice that the algorithm described above uses exponential
space. The result can be improved to O∗ (2.8718n ) time and polynomial
space.10
For each subset S ⊆ {2, . . . , n} and for each i ∈ S let f(S, i) denote the
length of a shortest tour that starts in city 1, then visits the cities in S \ {i} in
some order and then stops in city i.
We now have
d(1, i) if S = {i} and
f(S, i) = (2.5)
min { f(S \ {i}, j) + d(j, i) | j ∈ S \ {i} } otherwise.
The following theorem was proved by Held and Karp, and, independently,
by Bellman.11 12
10
Proposition 8 in: A. Björklund, T. Husfeldt and M. Koivisto, Set partitioning via
inclusion-exclusion, SIAM Journal on Computing 39 (2009), pp. 546–563.
11
R. Bellman, Dynamic programming treatment of the traveling salesman problem,
Journal of the Association for Computing Machinery 9 (1962), pp. 61–63.
12
M. Held and R. Karp, A dynamic programming approach to sequencing problems,
Journal of the Society for Industrial and Applied Mathematics 10 (1962), pp. 196–
210.
16 2 Exponential Algorithms
Theorem 2.22. There exists an O∗ (2n ) algorithm which computes the mini-
mum length of a traveling salesman tour.
There are O(n · 2n ) pairs (S, i) where S is a subset of {2, . . . , n} and i ∈ S. The
computation of each f(S, i) takes O(n) time and so the overall complexity is
bounded by O(n2 · 2n ) = O∗ (2n ) time. t
u
Remark 2.23. As far as we know, there is no algorithm that solves the traveling
salesman problem in time O∗ (cn ) for c < 2.
S = { S1 , . . . , Sm }
The set cover problem asks for a cover S0 such that |S0 | is minimal.
Si = {S1 , . . . , Si } for i = 1, . . . , m.
Let U0 ⊆ U and let f(U0 , i) for i > 1 be the minimal cardinality of a cover
for U0 with subsets from Si . Let f(∅, i) = 0 and
[
if U0 6= ∅ and U0 6⊆ S then define f(U0 , i) = ∞.
S∈Si
2.6 Dominating set 17
Here is the proof that Formula (2.8) is correct. Either the set Si+1 is used
to cover U0 and then U0 \ Si+1 has to be covered with sets from Si , or the set
Si+1 is not used in the cover, and then U0 has to be covered with elements
from the set Si .
Theorem 2.25. There exists an O∗ (m · 2n ) algorithm for the set cover problem.
The dominating set problem asks for a dominating set of minimal cardi-
nality. Recall that we use γ(G) to denote the cardinality of a minimum domi-
nating set. Thus,
The dominating set problem can be reduced to the set cover problem as
follows. Let U = V and let
S = { N[x] | x ∈ V }.
A solution for this set cover problem corresponds to a solution for the domi-
nating set problem. This can be seen as follows.
Assume that
S0 = { N[x] | x ∈ V 0 },
is a solution for the set cover problem, for some V 0 ⊆ V. Then V 0 is a domi-
nating set in G because every vertex y ∈ V \ V 0 is covered by some set in S0
and so y ∈ N[z] for some z ∈ V 0 .
S0 = { N[x] | x ∈ D }.
Notice that, when we have an extension for every D0 ⊆ W, then this solves
the domination problem, namely by taking the set D0 ⊆ W which minimizes
0 f(U0 , `) if |f(U0 , `)| < 1 + |f(U0 \ N(s`+1 ), `)|
f(U , `+1) =
f(U0 \ N(s`+1 ), `) ∪ {s`+1 } otherwise.
(2.14)
It follows that the time for solving the dominating set problem is bounded
by some polynomial factor times
|W| |W|
X X X |W|
|W| |W|
2 + 1=2 + = 2|W|+1 . (2.16)
k
k=0 D0 ⊆W k=0
|D |=k
0
Theorem 2.26. There exists an O∗ (1.7088n ) algorithm which solves the domi-
nating set problem on graphs with n vertices.
Proof. Let β = 0.2271. We consider two cases.
In the first case, assume that |I| > β · n. Then, according to Formula (2.16), a
minimum dominating set can be computed in
O∗ (2(1−β)n ) = O∗ (1.7088n ). (2.17)
Now assume that |I| 6 βn. Then γ(G) 6 |I| 6 βn. In that case we test every
subset of V with cardinality at most βn.
By Stirling’s formula one can obtain that, since 0 < β < 21 ,
X
bβnc
n
6 2h(β)n where h(β) = −β log2 β − (1 − β) log2 (1 − β). (2.18)
i
i=0
The function h(β) is the binary entropy function. (See Figure 2.3.) Some cal-
culations show that 2h(β)n 6 1.7088n .
h(x)= -xlog2x-(1-x)log2(1-x)
0.2271
Fig. 2.3. This figure shows the binary entropy function; the value β ≈ 0.2270922 is
where h(β) = 1 − β.
Remark 2.27. Notice that we chose β such that h(β) = 1 − β to obtain the
best bound (see Figure 2.3). If the maximal independent set I is small then
the domination number γ(G) 6 |I| is small as well. In that case it is better to
try all subsets of cardinality at most |I|. This gives us the bound in terms of
the entropy function (2.18). When |I| is large, then the ‘universe’ W = V \ I is
small. Then it is better to use the set cover method. By the choice of β we get
the same timebound in both cases.
2.7 Inclusion – exclusion 21
Theorem 2.26 produces a nice timebound for the dominating set problem on
bipartite graphs.13
13
M. Liedloff, Finding a dominating set on bipartite graphs, Information Processing
Letters 107 (2008), pp. 154–157.
14
J. Edmonds, Paths, trees and flowers, Canadian Journal of Mathematics 17 (1965),
pp. 449–467.
15
A. Björklund, T. Husfeldt and M. Koivisto, Set partitioning via inclusion-exclusion,
SIAM Journal on Computing 39 (2009), pp. 546–563.
22 2 Exponential Algorithms
Y
t
∀x∈U (f(x) − fi (x)) = 0. (2.22)
i=1
To see this, first assume that x ∈ A. Then x ∈ Ai for some i ∈ {1, . . . , t}. Then
the ith term in the product f(x) − fi (x) = 1 − 1 = 0 and so the whole product
is zero.
Now assume that x ∈ / Ai for any i ∈ {1, . . . , t}, and so every term
/ A. Then x ∈
in the product f(x) − fi (x) = 0.
Write this product as follows.
X
t X
(−1)k · f(x)t−k · fi1 (x) · fi2 (x) · · · fik (x) = 0. (2.23)
k=0 16i1 <i2 <···<ik 6t
This implies
X
t X
t
f(x) = (−1)k−1 fi1 (x) · · · fik (x). (2.24)
k=1 16i1 <···<ik 6t
X X
t X
f(x)t = |A| = (−1)k−1 |Ai1 ∩ · · · ∩ Aik |. (2.25)
x∈U k=1 16i1 <···<ik 6t
A similar formula can be obtained for the number of elements that lie in
none of the Ai . We give a different proof.
Then
t X
(−1)|I| | ∩i∈I Ai |.
\
| Ai | = (2.27)
i=1 I⊆{1,...,t}
Proof. Give each element x ∈ U a weight, say w(x), and sum the weights
over the sets on the left and right hand side of (2.27). Consider x ∈ U. If
x lies in none of the Ai then it contributes w(x) on the left hand side and
it also contributes w(x) on the right hand side, namely for I = ∅ (by the
convention).
Now assume that x lies in Ai for i ∈ I, and assume that I 6= ∅. Then it is
counted zero times on the left. On the right hand side it is counted for all
I0 ⊆ I. Its total contribution is zero because, by the binomial theorem,
|I|
X X |I|
|I0 |
(−1) w(x) = w(x) · (−1)k = 0 because I 6= ∅. (2.28)
k
I0 ⊆I k=0
t
u
Observe the following. When S is the set of all independent sets in G then
Definition 2.33. For X ⊆ V, define a(X) as the number of sets in S that avoid
X, that is,
a(X) = | { S ∈ S | S ∩ X = ∅ } |. (2.30)
U = { (S1 , . . . , Sk ) | Si ∈ S }. (2.32)
For the subset Ai ⊆ U, i ∈ V, we take the set of k-tuples that avoid {i}, that
is,
k
[
Ai = { (S1 , . . . , Sk ) | i ∈
/ S` }. (2.33)
`=1
The number of k-covers is exactly the number of k-tuples that lie in none of
the Ai . Thus ck is the left hand side of (2.27). For X ⊆ V, ∩i∈X Ai contains
those k-tuples that avoid all elements of X. This number is of course a(X)k .
Thus \
| Ai | = a(X)k . (2.34)
i∈X
Proof. Let G = (V, E) be a graph with n vertices. Let V = {1, . . . , n}. Let
S be the collection of all nonempty, independent sets in G, not necessarily
maximal.
By Formula (2.31) it is sufficient to compute a(X), for all subsets X ⊆ V.
Of course, we have that a(V) = 0. Assume that X 6= V. Fix some v ∈ V \ X.
We claim that
2.7 Inclusion – exclusion 25
To prove (2.35) we partition the sets S ∈ S that avoid X into two types, the
sets S that contain v and the sets S that do not contain v.
First consider sets S that avoid X and that do not contain v. Those sets S are
counted in a(X ∪ {v}).
Consider sets S that avoid X and that contain v. Since S is an independent set
which contains v, S contains no neighbors of v. Thus
Either S = {v}, which accounts for the +1-term, or S \ {v} 6= ∅. By (2.36), the
number of sets S with S \ {v} 6= ∅ is exactly a(X ∪ N[v]). This proves (2.35).
The recurrence relation (2.35) shows that the numbers a(X) can be computed
in O(n2n ) = O∗ (2n ) time. This proves the theorem. t
u
Remark 2.36. The algorithm of Theorem 2.35 uses exponential space. The pa-
per of Björklund, et al., shows that the chromatic number of a graph can be
computed in O∗ (2.2461n ) time and polynomial space.
The triangle partition problem is NP-complete (even for graphs with max-
imal degree four).16
Theorem 2.37. There exists an O∗ (2n ) time and polynomial space algorithm
that checks if G has a triangle partition.
16
J. van Rooij, M. van Kooten Niekerk and H. Bodlaender, Partitioning sparse graphs
into triangles – relations to exact satisfiability and very fast exponential time algo-
rithms. Technical Report UU-CS-2010-005, Utrecht University, 2010.
26 2 Exponential Algorithms
A k-cover is a k-tuple of S:
each Si is a triangle in G, and
(S1 , . . . , Sk ) such that (2.38)
∪ki=1 Si = V.
where a(X) is the number of triangles that avoid X, that is, the number of
triangles contained in V \ X.
Notice that we can easily count the number of triangles that are contained in
V \ X in polynomial time. Thus the numbers a(X) can be computed in O∗ (2n )
time and polynomial space.
To compute a(X)q we need O(log q) multiplications and we can represent
this number in O(q log n) bits. This shows that we can compute the For-
mula (2.40) in O∗ (2n ) time and polynomial space. t
u
Remark 2.38. There is an O∗ (1.7693n ) algorithm that solves the triangle par-
tition problem.17
17
M. Koivisto, Partitioning into sets of bounded cardinality, Proceedings of the 4th
International Workshop on Parameterized and Exact Computations, IWPEC 2009,
Springer-Verlag, LNCS 5917 (2009), pp. 258–263.
2.7 Inclusion – exclusion 27
Write q = n3 and let V = {1, . . . , n}. Order the triangles of G into lexico-
graphic order. Then the first triangle in any partition must contain the first
vertex, which is 1. In general, we have the following lemma.
Lemma 2.39. Consider the lexicograph ordering of the triangles in a triangle
partition P of G. Then, for j ∈ {1, . . . , q}, the first j triangles in P must contain
the vertices of {1, . . . , j}.
Proof. Since the triangles of P partition V each element of V is in some trian-
gle of P. Since the triangles are lexicographically ordered, the first j triangles
of P must contain all vertices of {1, . . . , j}. t
u
j
[
T` ∈ R j .
`=1
t
u
28 2 Exponential Algorithms
Lemma 2.41.
X
q
|Rk | = O∗ (1.7549n ).
k=1
Proof. By Lemma 2.39, the first j triangles must contain {1, . . . , j}. The rest of
the vertices of these j triangles are in {j + 1, . . . , n}. Thus,
Xq Xq
n−k
|Rk | 6 .
2k
k=1 k=1
Consider the case where 13 < β < 23 , that is, 17 < α < 41 . Write β = 1+ 2 .
Then − 13 < < 13 . With Stirling’s formula we obtain (neglecting polynomial
factors)
n−k 2n
∼ exp ( 2 ln(2) − (1 − )ln(1 − ) − (1 + ) ln(1 + ) ) .
2k 5+
(2.42)
Now write γ = 1− 1 2
2 . Then 3 < γ < 3 and (2.42) becomes
n−k 2n 1 − 3α k
∼ exp f(γ) where γ = and α = (2.43)
2k 3−γ 1−α n
and where f(γ) = −γ ln(γ) − (1 − γ) ln(1 − γ) is the entropy function. (See
Figure 2.4.)
Define
1
g(γ) = · f(γ). (2.44)
3−γ
The function g(γ) has its maximum at γ 6 0.56985 and with this value (2.43)
becomes
n−k
= O∗ (1.7549n ). (2.45)
2k
t
u
2.7 Inclusion – exclusion 29
2
Fig. 2.4. This figure shows the function 3−x
f(x) where f(x) is the entropy function.
where we write
1 if P is true, and
[P]=
0 otherwise.
Thus fk (S) counts the number of ordered partitions of S into k triangles. No-
tice that
fk (S) = 0 if S ∈/ Rk .
30 2 Exponential Algorithms
X
q
|Rk | · n3 = O∗ (1.7549n ).
k=1
t
u
Remark 2.43. The O∗ (2n ) algorithm of section 2.7.1 on page 25 uses polyno-
mial space. The algorithm of Theorem 2.42 uses exponential space.
Remark 2.44. For the partitioning into general (constant) subsets of size r this
method gives
n−k n(r − 1) 1 − rk/n
∼ exp · f(x) where x = (2.46)
(r − 1)k r−x 1 − k/n
and where f(x) = −xln(x) − (1 − x)ln(1 − x). To maximize one would need
to solve
(1 − x)r−1 = xr .
1+
When we write x = 2 we get a first approximation
1 3r − 1
≈ and x≈ .
3r − 2 2(3r − 2)
For r = 3 this gives x ≈ 4/7 ≈ 0.571 while the actual value, which we found
in the proof of Lemma 2.41, is x ≈ 0.5699.
n2
n−k 1 n ln(2)
∼ 22n(r−1)/(2r−1) = 2n(1− 2r ) (1 − 2
+ O( 3 )). (2.47)
(r − 1)k 4r r
Theorem 2.45. There exists an O(K · n) algorithm which solves the subset sum
problem.
Proof. Define
Si = { 1, . . . , i } for i = 1, . . . , n.
Thus Ωi contains the sums that can be made with numbers from {a1 , . . . , ai }
and which are at most K.
First consider i = 1. Then,
{ 0, a1 } if a1 6 K, and
Ω1 = (2.48)
{0} if a1 > K.
Next, the set Ωi+1 can be computed via the following formula.
2.9 Problems
2.1. In the maximum independent set algorithm we used a linear-time algo-
rithm for the case where every vertex in G has degree at most two. Suppose
that, instead, we keep branching until no remaining vertex has any neigh-
bor, that is, until the graph is an independent set. Show that this changes
Formula (2.2) on Page 9 into
Show that the solution of Formula (2.50) is the nth Fibonacci number times
some polynomial. Use the exact formula for the Fibonacci numbers to show
that this gives
T (n) = O∗ (1.6181n ).
Now assume that we branch until every vertex has degree at most one. This
changes Formula (2.50) into
ω3 = ω2 + 1. (2.52)
N[x] ⊆ N[y].
Notice that this implies that x and y are adjacent. Show that
This is one of the prunings that is used in the algorithm of Fomin and Kratsch.
2.3. Let T (n) be the worst-case time-bound for any algorithm which solves the
maximum independent set problem on graphs with n vertices. In this exercise
we show that
T (n − 1) 6 T (n) for all n > 1.
α(G0 ) = α(G) + 1.
(b) Show that this proves that the maximum independent set problem for
G can be determined in T (n) time. This contradicts the assumption that
T (n − 1) > T (n).
2.4. Design a linear-time algorithm which checks if a graph is bipartite.
2.5. Design an exact algorithm for 4-coloring.
Hint: The 4-coloring problem can be solved in O∗ (1.7504n ).18
18
J. M. Byskov, Enumerating maximal independent sets with applications to graph
colouring, Operations Research Letters 32 (2004), pp. 547–556.
2.9 Problems 33
(b) A Hamiltonian path is a path in G which contains all vertices. The differ-
ence with the Hamiltonian cycle problem is that the two endpoints of the
path are not necessarily adjacent. Design an O∗ (2n ) algorithm that solves
the Hamiltonian path problem on graphs with n vertices.
2.9. Check the Formulas (2.13) and (2.14) and show that the sets f(X, `), as
defined by these formulas, can be computed in O∗ (2|W| ).
2.10. Design an O∗ (2n ) algorithm that solves the domatic partition problem.
Hint: Use the inclusion-exclusion method described in Section 2.7. You need
to derive a recurrence relation similar to (2.35) on Page 25.
2.11. Design an O∗ (2n ) algorithm that solves the triangle packing problem.
The triangle packing problem asks for the maximal number of vertex-disjoint
triangles in a graph.
Hint: Use the inclusion-exclusion method as in Section 2.7.1. For the set S
take the set of all triangles and all subsets that contain one vertex. Show that
there is a triangle packing with k triangles if and only if cn−2k > 0.
2.12. The subset sum problem described in Section 2.8 is NP-complete. The-
orem 2.45 on Page 31 shows that it can be solved in O(K · n) time. Does this
prove that P = NP?
3
Graph Classes
In this chapter we have a close look at a few important graph classes and we
look at some NP-complete problems that become polynomial when the graphs
are restricted to these.
is the class of all planar graphs. A class of graphs may be finite or infinite. The
class above, of all planar graphs, is of course infinite (it contains an infinite
number of elements).
When one studies some graph class G then the membership of graphs in
G is an important issue. One refers to this as the recognition problem for the
class G:
Input: A graph G.
Question: Is G ∈ G?
36 3 Graph Classes
For example, the planar graphs are recognizable in linear time,1 but there
are many classes of graphs for which the recognition problem is not clear. For
example, consider the class
where χ(H) is the chromatic number of H and ω(H) is the clique number of H.
If one wants to color a graph G such that adjacent vertices have different
colors, then all vertices of a clique in G must receive different colors. Thus for
all graphs we have
The complement of a graph G is the graph Ḡ with the same set of vertices
as G, and with two vertices in Ḡ adjacent if and only if they are not adjacent
in G. Concerning perfect graphs one of the first and most important theorems
was proved by Lovász in 1972.23
where κ(H) = χ(H̄) is the smallest number of cliques that partition the set of
vertices and α(H) = ω(H̄) is the cardinality of a largest independent set in H.
In Exercise 3.3 we ask you to prove that bipartite graphs are perfect. By
Theorem 3.2 also the complements of bipartite graphs are perfect. (Can you
prove this without using Theorem 3.2?)
Proof. First of all, it is sufficient to prove Equation (3.4) for L(G), since re-
moving an edge from a bipartite graph leaves it bipartite. (That is, the class
of linegraphs of bipartite graphs is hereditary.)
graphs.7 The proof of the conjecture sent a shock wave through the graph
theory community.8
Fig. 3.1. The figure shows some holes and antiholes. Notice that the complement of
C5 is C5 . The complement of C6 is planar but the complement of C7 is not (and also
not the complements of longer cycles).
Theorem 3.5 (The strong perfect graph theorem). A graph is perfect if and
only if it has no odd hole and no odd antihole.
Theorem 3.5 was proved using a certain decomposition of the graph into
four basic classes of perfect graphs, namely,
(1) bipartite graphs,
(2) complements of bipartite graphs,
(3) linegraphs of bipartite graphs, and
(4) complements of linegraphs of bipartite graphs.
7
C. Berge, Färbung von Graphen, deren sämtliche bzw. deren ungerade Kreise starr
sind, Wiss. Zeitschr. Martin-Luther Univ. Halle-Wittenberg 10 (1961), pp. 114–115.
8
M. Chudnovsky, N. Robertson, P. Seymour and R. Thomas, The strong perfect graph
theorem, Annals of Mathematics 164 (2006), pp. 51–229.
40 3 Graph Classes
Theorem 3.6. There exists an O(n9 ) algorithm which tests if a graph with n
vertices is perfect.
One of the reasons for the popularity of perfect graphs is the following
theorem.11
The theorem above was proved by showing that the Lovász number ϑ(G) of a
graph G is computable in polynomial time.1213
9
M. Chudnovsky, G. Cornuéjols, X. Liu, P. Seymour and K. Vušković, Recognizing
Berge graphs, Combinatorica 25 (2005), pp. 143–186.
10
P. Seymour, How the proof of the strong perfect graph conjecture was found, Gazette
des Mathématiciens 109 (2006), pp. 69–83.
11
M. Grötschel, L. Lovász and A. Schrijver, Polynomial algorithms for perfect graphs.
In (Berge, Chvátal eds.): Topics on perfect graphs, North-Holland Mathematics Stud-
ies 88 (1984), pp. 325–356.
12
L. Lovász, On the Shannon capacity of a graph, IEEE Transactions on Information
Theory 25 (1979), pp. 1–7.
13
M. Grötschel, L. Lovász and A. Schrijver, The ellipsoid method and its consequences
in combinatorial optimization, Combinatorica 1 (1981), pp. 169–197.
3.2 Comparability graphs 41
Obviously, not every graph can be oriented transitively. For example, con-
sider an odd cycle C of length at least five. In any orientation of C there will
be two edges {x, y} and {y, z} that are oriented in the same direction, that is,
either −
→ and −
xy → or ←
yz − and ←
xy − If the orientation were transitive then in both
yz.
cases we would have an edge {x, z}, but since C has length at least 5, {x, z} is
not an edge of C.
Lemma 3.14. Let G be a graph and assume that G has a transitive orientation.
Then every clique in G corresponds with a chain in any transitive orientation of
the graph G.
ω(G) = χ(G).
Consider a transitive orientation of G. For each vertex x let ∆(x) be the maxi-
mal number of vertices in a chain that ends in x. Now define
Ni = { x | ∆(x) = i }.
Notice that N1 6= ∅, since there is a vertex without any incoming edge. This
follows, in the same manner as in the proof of Lemma 3.14, from the fact that
there are no directed cycles.
Also notice that, for any i > 1,
Ni+1 6= ∅ ⇒ Ni 6= ∅.
α(G) = κ(G).
17
R. Dilworth, A decomposition theorem for partially ordered sets, Annals of Mathe-
matics 51 (1950), pp. 161–166.
44 3 Graph Classes
In the following figures, Figure 3.2 (Table I) and Figure 3.3 on the facing
page (Table II), we show Gallai’s list of forbidden induced subgraphs for com-
parability graphs. Some care is needed, since the complements of the graphs
in Figure 3.3 are forbidden. By the way, the circled vertices in this figure form
asteroidal triples. We’ll talk about those in Section 3.6.
Theorem 3.18 (Gallai). A graph is a comparability graph if and only if it has
none of the graphs in Figure 3.2 and none of the complements of the graphs in
Figure 3.3 as an induced subgraph.
a0 a0
a1 a2n a1 a2n
a2 a2 a2n-1
_
n>2 _
n>2
a0 a0
a2n a1
a1 a2n
a2 a2n-1 a2 a2n-1
_
n>2 _
n>2
Fig. 3.2. Table I.
c1 c2 cγ
_
γ>3
_
n-cycle, with n>6
c1 c2 cγ c1 c2 cγ
_
γ>1 _
γ>1
fx : [0, 1] → R
19
M. Golumbic, D. Rotem and J. Urrutia, Comparability graphs and intersection
graphs, Discrete Mathematics 43 (1983), pp. 37–46.
46 3 Graph Classes
such that two vertices x and y are adjacent if and only if the functions fx and fy
intersect each other. By that we mean that there exists a point 0 6 r 6 1 such
that
fx (r) = fy (r).
Dushnik and Miller show that every partial order has a realizer. A finite poset
has a finite realizer. The dimension of the poset is the minimal cardinality of
a realizer.20
Consider a realizer {61 , . . . , 6k } of a poset P = (V, ). Let V = {1, . . . , n}.
Draw k vertical lines, L1 , . . . , Lk , next to each other. On each line Li label n
points {1, . . . , n} in the order of 6i . Now connect any point on line Li by a
straight line segment with the point that has the same label on line Li+1 , for
i ∈ {1, . . . , k − 1}. See Figure 3.4 on the next page.
Now we have that, for any two elements x and y in V, that x y if and
only if x 6i y for all i ∈ {1, . . . , k}. That is, x y if and only if the functions
fx and fy , defined as the concatenation of the straight line segments, do not
intersect.
The converse is easy. If a graph G has an intersection model by continuous
functions, as above, then the ordering (x, y), defined by “fx lies below fy ,” is
a transitive orientation of Ḡ.
This proves the theorem. t
u
Remark 3.21. In Section 3.7 we have a look at the posets of dimension two.
The corresponding comparability graphs are called permutation graphs.
1
6 6 4
>
>
3 1
6 2 2 4 2
>
> 1 5 3
5
4 2 6
2
5 3
5 1 1
> >
4 6 4 3 3 5
Fig. 3.4. This figure shows the complement of C6 . Notice that C6 is a comparability
graph. The figure shows the intersection model. The dimension of the poset is three.
The picture on the right shows the three total orders of the realizer.
Let F be a set of directed edges of a graph G. Define the sets F−1 , F2 and F̂
as follows.
1.
F−1 = { ←−|−
xy →∈F}
xy (3.7)
2.
F2 = { →
−
xz | ∃y∈V −
→ ∈ F and −
xy →∈F}
yz (3.8)
3.
F̂ = F ∪ F−1 . (3.9)
22
M. Golumbic, Comparability graphs and a new matroid, Journal of Combinatorial
Theory, Series B 22, (1977) pp. 68–90.
23
M. Golumbic, The complexity of comparability graph recognition and coloring,
Computing 18 (1977), pp. 199–208.
48 3 Graph Classes
→
−
Definition 3.23. Let G = (V, E) be a graph and let E ⊆ E. A set F ⊆ E of
directed edges is an orientation of E if
→
−
F ∪ F−1 = E and F ∩ F−1 = ∅. (3.10)
If E = E then F is an orientation of G.
→
−
Definition 3.25. Define a binary relation Γ on E of a graph G = (V, E) as
follows.
→ −−
− → a = a0 and {b, b0 } ∈/ E, or
ab Γ a0 b0 ⇔ (3.11)
b = b0 and {a, a0 } ∈/ E.
Notice that the relation Γ is reflexive and symmetric. Its transitive closure
→
−
Γ is an equivalence relation on E . We call the equivalence classes of Γ ∗ the
∗
→
−
implication classes of E .
→
−
The Γ relation on E captures the fact that, for any transitive orientation F
of G,
→ −−→
− −→ −−→
ab Γ a0 b0 and ab ∈ F ⇒ a0 b0 ∈ F. (3.12)
is a transitive orientation of E.
By Theorem 3.27, we can test whether a graph G is a comparability graph,
and give G a transitive orientation if it is a comparability graph, by computing
→
−
a G-decomposition of E . Golumbic describes an O(n3 ) algorithm to compute
a G-decomposition.
Let
−
→∈Z
xy and →
−
xz ∈ Y and −
→ ∈ X.
yz (3.18)
Then −−0→0 −→0 −→0
yz ∈X ⇒ xy ∈ Z and xz ∈ Y. (3.19)
Proof. By definition, there exists a chain
−
→=−y−→ −−→ −−→ −−−→ with yk = y0 and zk = z0 .
yz 0 z 0 Γ y1 z 0 Γ y1 z 1 Γ . . . Γ yk z k (3.20)
Y3−→ 6Γ −
xz i y−−−→
i+1 zi ∈ X ⇒ {x, yi+1 } ∈ E
{yi+1 , yi } ∈
/E ⇒ −−−→ Γ −
xy →∈Z
xy
i+1 i
Z−1 −−−→ −−− −− −
→
3 yi+1 x 6 Γ yi+1 zi+1 ∈ X ⇒ {x, zi+1 } ∈ E
{zi , zi+1 } ∈
/E ⇒ −−−→ Γ −
xz → ∈ Y.
xz
i+1 i
Z Y
<
y
<
<
X z
Fig. 3.5. The figure illustrates the Triangle Lemma.
is a transitive orientation of E.
Proof. Assume that G is a comparability graph. We show that (i) implies (ii).
Let A be an implication class. We show that A ∩ A−1 = ∅.
Let F be a transitive orientation. By applying (3.12) inductively, either
A∩F=∅ or A ⊆ F.
The removal of B̂1 causes some implication classes to merge into one. Assume
that D is the union of t implication classes and assume that t > 2. Then there
exists a triangle {x, y, z} with −
→ ∈ B̂ and either
yz 1
(→
−
xz ∈ C1 and −
→∈C )
xy 2 or (←
−∈C
xz 1 and ←− ∈ C ).
xy 2 (3.23)
is transitive.
Let −→ and −
xy → be two elements of B ∪ F. If both are in B or if both are in F
yz 1 1
then we are done. Assume that −→ ∈ B and −
xy 1
→ ∈ F. Then
yz
−
→ 6 Γ∗ −
xy →
zy ⇒ {x, z} ∈ E. (3.26)
Assume that →
− / B1 ∪ F. Then →
xz ∈ −
zx ∈ B1 ∪ F. Now
52 3 Graph Classes
(a) →
−
zx ∈ B1 and −
→ ∈ B imply −
xy → ∈ B which is a contradiction, and
zy
1 1
(b) →
− −
→ −
→
zx ∈ F and yz ∈ F imply yx ∈ F, which is also a contradiction.
Thus →
−
xz ∈ B1 ∪ F. Similarly, −
→ ∈ F and −
xy → ∈ B imply →
yz 1
−
xz ∈ B1 ∪ F.
This proves that ∪ki=1 Bi is a transitive orientation of G.
This proves the theorem. t
u
Proof. An edge is put into an implication class at most one time. Whenever an
edge e is put in an implication class, all the neighbors of the two endpoints
are examined. For all the neighbors that are adjacent to exactly one endpoint
of e, the edges are put in the same implication class as e.
A flag on each edge is used to detect when an arc − → is detected for which
xy
←−
xy is in the same implication class. When this happens, the graph is not a
comparability graph and otherwise, by Theorem 3.27 it is.
Each edge is put into an implication class only once. When an edge e is put
in an implication class O(n) vertices are examined to see which edges are
Γ -related to e. This shows that the algorithm can be implemented to run in
O(nm) time. t
u
24
M. Golumbic, The complexity of comparability graph recognition and coloring,
Computing 18 (1977), pp. 199–208.
3.3 Cographs 53
3.3 Cographs
One of the most elegant classes of graphs is the class of cographs.
s s s s
Theorem 3.34. A graph G = (V, E) is a cograph if and only if for every induced
subgraph H of G one of the following properties holds.
(a) H has only one vertex, or
(b) H is disconnected, or
(c) H̄ is disconnected.
Proof. Notice that P¯4 is isomorphic to P4 . This implies that if G is a cograph
then Ḡ is a cograph.
A graph with less than four vertices is a cograph. Therefore, since the class
of cographs is hereditary, it is sufficient to prove that G or Ḡ is disconnected
when G is a cograph with at least two vertices.
It is easy to check that the claim holds true when G has at most three vertices.
Assume that G has at least four vertices. Assume also that G is connected.
Let x be a vertex of G. By induction G − x or the complement of G − x is
disconnected.
54 3 Graph Classes
α(H) 6 κ(H)
3.3 Cographs 55
for any graph H and κ(H) is of course at most the number of maximal cliques,
which is α(H) by the property.25 26
3.3.1 Cotrees
Let G be a cograph. Theorem 3.34 shows us how we can build a decompo-
sition tree for the graph G. For cographs, this decomposition tree is called a
cotree.27
Notice that a graph G is a cograph if and only if it has a cotree (see Exer-
cise 3.9). Corneil, Perl and Stewart proved the following theorem.28
25
E. Wolk, A note on the comparability graph of a tree, Proceedings of the American
Mathematical Society 16 (1965), pp. 17–20.
26
M. Golumbic, Trivially perfect graphs, Discrete Mathematics 24 (1978), pp. 105–
107.
27
D. Corneil, H. Lerchs and L. Stewart-Burlingham, Complement reducible graphs,
Discrete Applied Mathematics 3 (1981), pp. 163–174.
28
D. Corneil, Y. Perl and L. Stewart, A linear recognition algorithm for cographs, SIAM
Journal on Computing 14 (1985), pp. 926–934.
56 3 Graph Classes
2 7
×
+ +
3 6
1 × × 6 7
4 5 2 3 4 5
(a) a cograph (b) a cotree
Fig. 3.7. The figure shows a cograph and a cotree. Notice the difference with the binary
cotree described above. When a cotree is built by creating a child for each component
of the subgraph or its complement, the labels alternate on every path from a leaf to
the root. For algorithmic purposes one usually prefers the binary cotree.
One appreciates cotrees when one looks at some examples. Let’s use it for the
computation of the clique number.
Theorem 3.38. There exists a linear-time algorithm that computes the clique
number ω(G) of a cograph G.
Gp = G[V1 ∪ V2 ].
Now assume that the label of p is ⊕. Then Gp is the union of G1 and G2 , that
is, no vertex of G1 is adjacent to any vertex of G2 . Now
Assume that p is the root of T . The algorithm recursively computes ω(G1 ) and
ω(G2 ). Since p is the root, Gp = G and ω(G) follows from Formulas (3.27)
and (3.28).
The amount of work in each internal node takes O(1) time. So, in total the
algorithm runs in time O(n), where n = |V|, since the depth of the cotree is at
most n. In other words, when the cotree is a part of the input this algorithm
runs in O(n) time.
This proves the theorem. t
u
It follows that also γ(G) can be computed in linear time for cographs.
s s s s s s
s @@s B @
s s s s s B @s
@ bb B " "
s s @s s s s s
b "
bB"
Fig. 3.8. A graph is distance hereditary if it has no induced house, hole, domino or
gem.
Theorem 3.42. Let G = (V, E) be a graph. The following statements are equiv-
alent.
(1) The graph G is distance hereditary.
(2) Every induced subgraph of G has an isolated vertex, or a pendant vertex or
a twin.
(3) The graph G has no induced house, hole, domino or gem.
Proof. We prove
V 00 = (V 0 \ {x}) ∪ {y}.
Remark 3.44. Notice the difference with the labels in cotrees. The ⊕- or ⊗-
operator in the decomposition tree for distance-hereditary graphs works on
the twinsets, and not, as in the cotrees, on all the vertices of We1 and We2 .
Let p be an internal vertex of T which is not the root. Let e be the line
that connects p with its parent. Let Qe be the twinset of e. Let c1 and c2 be
the two children of p in T . Let e1 = {p, c1 } and let e2 = {p, c2 }. Let Qi be the
twinset of ei , for i ∈ {1, 2}. The third, and final, property is that
Qe = ∅ or Qe = Q1 or Qe = Q2 or Qe = Q1 ∪ Q2 .
The vertex p in T has an extra label that indicates which of these four opera-
tions that define Qe occur.
1 {1, 2}
× {3, 5}
2
3
× ×
5 {1} {2} {3, 5} {4}
4 1 2
+ ×
{3} {5} {4} {6}
6 3 5 4 6
Fig. 3.9. An example of a distance-hereditary graph and a decomposition tree for it.
The labels at the edges are the twinsets. The ⊕- and ⊗-labels at the nodes represent
the union- and join-operation on the twinsets of the two children.
62 3 Graph Classes
Proof. Let G = (V, E) be distance hereditary. We use the property that G has
an isolated vertex, a pendant vertex or a twin.
Let x be an isolated vertex, a pendant vertex with neighbor y, or a twin of a
vertex y. Let G0 = G − x. By induction G0 has a decomposition tree (T 0 , f0 ) as
described above. We now show how to construct a decomposition tree (T , f)
for G.
First assume that x is a twin of a vertex y. The vertex y is mapped by f0 to
some leaf ` of T 0 . Create two leaves `1 and `2 and let ` be the parent of `1
and `2 in T . Let f map x to `1 and y to `2 , and let f be the same as f0 for
all other vertices z ∈ V \ {x, y}. If x and y are adjacent, then the new internal
node ` receives an ⊗-operator and otherwise it receives an ⊕-operator. Finally,
update the twinsets by adding x to all twinsets that contain y. The edges {`, `1 }
and {`, `2 } have twinsets {x} and {y}.
Assume that x is a pendant vertex with a neighbor y. The tree T and the map
f are obtained in the same manner as described above. The internal node `
receives an ⊗-operator since x and y are adjacent. Finally, x appears in only
one twinset, namely in the twinset of the new edge {`, `1 } in T .
Assume that x is isolated in G. Choose an arbitrary vertex y in V \ {x}. Create
the tree T and the map f as above. In this case, the vertex x appears in no
twinset.
Assume that a graph G has a decomposition tree as described above. You can
use the technique of Exercise 3.10 to show that every induced subgraph has
an isolated vertex, a pendant vertex or a twin. We leave it as an exercise. t
u
Let G be a graph. The feedback vertex set problem asks for a feedback
vertex set in G of minimal cardinality. The feedback vertex set problem is
NP-complete.
Recall (from Section 3.3.2) that a graph G is a join of two graphs G1 and
G2 , if G is obtained from G1 and G2 by making every vertex of G1 adjacent to
every vertex of G2 .
Lemma 3.47. Assume that G is the join of two graphs G1 and G2 . For i ∈ {1, 2},
let Vi be the vertex set of Gi . Let F be a feedback vertex set of G. Then
Lemma 3.48. Let G be a cograph which is the join of cographs G1 and G2 . Let
V1 and V2 be the vertex sets of G1 and G2 . Let F be a feedback vertex set of G.
Assume that |V1 \ F| = 1. Then G2 − F is an independent set.
Theorem 3.49. There exists a linear-time algorithm that solves the feedback
vertex set problem on distance-hereditary graphs.
Let p be an internal vertex of T which is not the root r0 and let c1 and c2 be the
two children of p. Let W1 and W2 be the two sets of vertices that are mapped
to the leaves in the subtrees at c1 and c2 respectively and let W = W1 ∪ W2 .
Let Q1 ⊆ W1 and Q2 ⊆ W2 be the two twinsets of {p, c1 } and {p, c2 }. The ⊗
or ⊕ label at p indicates whether there is a join or a union of the two twinsets
Q1 and Q2 .
Let e be the edge in T that connects p with its parent p0 (possibly p0 = r0 ) and
let ei = {p, ci } for i ∈ {1, 2}. The twinset Qe is either one of Q1 or Q2 , or it is
Q1 ∪ Q2 , or it is the empty set.
In our dynamic programming algorithm we maintain the following four values
for each edge e in T with twinset Q:
(1) the minimal cardinality of a feedback vertex set of G[W];
(2) the minimal cardinality of a feedback vertex set F of G[W] such that no
two vertices of Q − F are in one component of G[W] − F;
(3) the minimal cardinality of a feedback vertex set F of G[W] such that
|Q − F| = 1 and
Q ⊆ F.
It is easy to see that these four values for an edge e = {p, p0 } in T can be
obtained from the values at the edges {p, c1 } and {p, c2 } (see Exercise 3.18).
The minimal cardinality of a feedback vertex set for G can be read from
the first value i.e., Item (1) above, at the root-edge {r, r0 } of the binary tree-
decomposition.
This completes the proof. t
u
One of the oldest classes of graphs that have been studied in great detail is
the class of chordal graphs.33 We’ll give you a crash course in chordal graphs
in the next section. Brace yourselves!
Notice that the class of chordal graphs contains, for example, all trees. It
may be helpful to keep this in mind; chordal graphs look a lot like ordinary
trees.
By definition, the class of chordal graphs is hereditary. Let’s first prove that
chordal graphs are perfect.
Remark 3.55. Notice that one minimal separator may properly contain an-
other minimal separator. For example, consider a 4-cycle [a, b, c, d]. Add a
pendant vertex e adjacent to c. Then {a, c} is a minimal b, d-separator and
{c} is a minimal a, e-separator. So, both {a, c} and {c} are minimal separators
(separating different pairs of vertices) and
(See Figure 3.10.) By the way, {b, d} is another minimal a, e-separator (dis-
joint from {c}, that is, {c} ∩ {b, d} = ∅). Minimal separators for the same pair
do not have to be disjoint, but one cannot properly contain another one.
66 3 Graph Classes
a b
d c
Fig. 3.10. This graph has a minimal separator contained in another one.
34
Theorem 1 in: G. Dirac, On rigid circuit graphs, Abhandlungen aus dem Mathema-
tischen Seminar der Universität Hamburg 25 (1961), pp. 71–76.
35
D. Rose, R. Tarjan and G. Lueker, Algorithmic aspects of vertex elimination of
graphs, SIAM Journal on Computing 5 (1976), pp. 266–283.
3.5 Chordal graphs 67
Theorem 3.58. A graph is chordal if and only if every induced subgraph has a
simplicial vertex.
Proof. Let G = (V, E) be a graph. First assume that every induced subgraph
of G has a simplicial vertex. Let Ω be a subset of vertices such that G[Ω] is a
cycle of length at least four. Then G[Ω] is an induced subgraph of G without
simplicial vertex. This is a contradiction.
Now assume that G is chordal. Let x be a vertex such that the largest compo-
nent C of G − N[x] is as large as possible. Let S ⊆ N(x) be the set of neighbors
of x that have a neighbor in C. Then S is a minimal x, y-separator for any
y ∈ C. Thus S is a clique.
We claim that every vertex of
V \ (C ∪ S)
is adjacent to all vertices in S.
Clearly, x is adjacent to every vertex in S since S ⊆ N(x). Assume that there
exists a vertex
z ∈ V \ (S ∪ C ∪ {x})
which is not adjacent to some vertex s ∈ S. Then C ∪ {s} is contained in a
component of G − N[z] since G[C] is connected and s has a neighbor in C.
Thus G − N[z] has a component which is larger than C. This contradicts the
choice of x.
Let
G0 = G − (S ∪ C).
By induction we may assume that G0 has a simplicial vertex z. Let N0 (z) be
the neighborhood of z in G0 . Then N0 (z) is a clique. Notice that
N(z) = N0 (z) ∪ S.
Lemma 3.61. Every chordal graph has at most n maximal cliques, where n is
the number of vertices in the graph.
In other words, a clique tree for G is a tree of which the vertices represent
the maximal cliques in G such that, for every vertex x in G, the maximal
cliques that contain x form a subtree of T .
Proof. First assume that the graph G = (V, E) has a clique tree (T , S). Let ` be
a leaf in T and let S` ∈ S be the maximal clique in G which is assigned to `.
We claim that S` contains a vertex which is simplicial in G.
Let p be the neighbor of ` in T . The cliques S` and Sp are maximal cliques in
G, so there must be a vertex
z ∈ S` \ Sp .
The maximal cliques that contain z form a subtree of T , by definition of the
clique tree. Since z ∈
/ Sp , the vertex z is contained only in one maximal clique
S` in G. Thus z is simplicial.
Assume that G = (V, E) is a chordal graph. We may assume that G is not a
clique, otherwise we are done. Let S be a minimal separator in G such that |S|
is as small as possible.
Let C1 , . . . , Ct be the components of G − S. Since S is a minimal separator,
there are at least two components. We claim that every vertex in S has a
neighbor in each Ci . Assume that s ∈ S has no neighbors in C1 .
Let
S0 = S \ {s}.
Then C1 is a component of G − S0 . Thus S0 is an x, y-separator for a pair
x ∈ C1 and y ∈ ∪ti=2 Ci .
1 2 6 1 2 6
2
3 7
2 2
3 7 3 7
5 5
3 7
5 5
4 8
4 5 8
Fig. 3.11. This figure shows a chordal graph and a clique tree.
{ Tx | x ∈ V }
such that two vertices x and y of G are adjacent if and only if Tx and Ty have at
least one vertex of T in common.
Proof. First assume that G is chordal. Consider a clique tree (T , S) for G. Let
x be a vertex of G. By definition of the clique tree, the maximal cliques in G
that contain x form a subtree Tx of T .
Assume that two vertices x and y are adjacent in G. The edge {x, y} is con-
tained in some maximal clique in G. So Tx ∩ Ty 6= ∅.
Assume that x and y are two vertices and assume that p ∈ Tx ∩ Ty . The
maximal clique Sp which is assigned to the vertex p in T contains x and y.
Thus x and y are adjacent.
Now assume that G is the intersection graph of a collection of subtrees of a
tree T . Consider a leaf ` of T . If ` is not in any subtree Tx , then we may remove
the leaf from T .
If every subtree that contains ` contains also the neighbor of ` in T , then we
may remove ` from T .
3.5 Chordal graphs 71
Finally, assume that there is a tree Tx which consists of the single vertex `. If
y and z are two neighbors of x, then Ty and Tz both contain `, and so y and
z are adjacent. That means that x is a simplicial vertex. Now remove x from
the graph and Tx from the collection of subtrees. It follows by induction that
G has a perfect elimination ordering. By Theorem 3.60, G is chordal.
This proves the theorem. t
u
N(s) ∩ I = ∅,
|N(s) ∩ I| = 1.
I0 = (I \ {u}) ∪ {s}.
G0 = G − N[s].
Then G0 is chordal, and by induction there exists a linear time algorithm that
computes α(G0 ). Then
α(G) = 1 + α(G0 ).
This proves the theorem. t
u
Theorem 3.66. There exists a linear-time algorithm that computes ω(G) for
chordal graphs G.
72 3 Graph Classes
Proof. Let G = (V, E) be a chordal graph. Then, by Theorem 3.60 on Page 68,
G has a perfect elimination ordering
π = [x1 , . . . , xn ].
Let
Ni = |N[xi ] ∩ {xi , . . . , xn }|.
Then
ω(G) = max { Ni | i ∈ {1, . . . , n} }.
This proves the theorem. t
u
To see that this is possible, notice that the set in Formula (3.29) contains at
most ω(G) − 1 vertices. Thus there is a color in Ω available to color xi .
The claim follows by induction. t
u
In this section we have a short look at the definition and some of the most
important properties of interval graphs.
3.6 Interval graphs 73
1 4
2 7
3 5
2 4
3 7
1 5 6
Remark 3.69. We only look at finite graphs. Then it is easy to see that we
can have intervals such that no two endpoints coincide. Thus the question
whether the intervals are closed or open is not an issue. Also, we may assume
that all intervals are finite, that is, they have finite length.
Proof. Consider an interval model for interval graph G = (V, E). Scan the
real line from left to right. At each point w on the real line, consider all the
intervals that contain w. Let
M(w) = { x ∈ V | w ∈ Ix }.
{ M(w) | w ∈ R }.
This defines the linear order of the maximal cliques in G: For each maximal
clique M fix a real number w such that w is in each interval which represents
a vertex of M. By the finiteness of the system, we can choose the real numbers
such that no two maximal cliques are represented by the same real number. If
M(w1 ) and M(w2 ) are two maximal cliques, then M(w1 ) precedes M(w2 ) if
and only if w1 < w2 . Obviously, since Ix is an interval, for every vertex x the
maximal cliques that contain x are consecutive in this ordering. t
u
Definition 3.73. An asteroidal triple {x, y, z}, AT for short, in a graph G is a set
of three pairwise nonadjacent vertices in G such that for every pair of them there
is a path connecting them that avoids the neighborhood of the third.
3.6 Interval graphs 75
Remark 3.75. For example, consider a 6-cycle. Let x, y and z be three ver-
tices that are pairwise not adjacent. Then {x, y, z} is an asteroidal triple. More
examples can be found in Figure 3.3 on page 45.
Actually, Gallai found those graphs that contain asteroidal triples (and that
are minimal with respect to the induced subgraph relation) and which do not
contain C5 . Ekkehard Köhler completed the list.38 The remaining graphs are
depicted in Figure 3.13.
Fig. 3.13. This figure shows the remaining minimal graphs that contain asteroidal
triples. These remaining ones are those that contain a C5 . The set of all minimal graphs
that contain asteroidal triples consists of the graphs in Figure 3.3 on page 45 plus the
ones in this figure.
Lemma 3.76. Interval graphs are AT-free, that is, they have no asteroidal triple.
38
Ekkehard Köhler, Graphs without asteroidal triples, PhD Thesis, TU-Berlin, 1999.
76 3 Graph Classes
Proof. Assume that G is chordal and that it has no asteroidal triple. We prove
that G has a consecutive clique arrangement.
By Theorem 3.63 on page 69, G has a clique tree. We prove that this tree can
be turned into a path. We use induction on the number of maximal cliques.
When G is a clique then we are done. Assume that G has k+2 maximal cliques
and assume that for all AT-free chordal graphs with less maximal cliques the
claim is true.
Consider a clique tree for G. Let C be a maximal clique which is mapped to
a leaf. Remove that leaf from the clique tree. The remaining clique tree is
the clique tree of a chordal graph G0 . The vertices of G0 are the vertices of
G minus the simplicial vertices that appear only in C. Repeating the process,
each time removing a leaf from the clique tree, gives a sequence of cliques, in
reversed order:
C0 , C1 , . . . , Ck , Ck+1 = C. (3.30)
Let H be the graph induced by
k
[
Ci . (3.31)
i=0
Define
Si = (C0 ∪ · · · ∪ Ci−1 ) ∩ Ci , for i ∈ { 1, . . . , k }. (3.33)
We write
S = (C0 ∪ . . . , Ck ) ∩ C.
39
C. Lekkerkerker and J. Boland, Representation of a finite graph by a set of intervals
on the real line, Fundamenta Mathematicae 51 (1962), pp. 45–64.
40
R. Halin, Some remarks on interval graphs, Combinatorica 2 (1982), pp. 297–304.
3.6 Interval graphs 77
In the first case, assume that Si ⊆ S for at least one i ∈ {1, . . . , k}. Define
S0 = Sk+1 = ∅ and
p = max { i | Si ⊆ S and 06i6m}
q = min {i | Si ⊆ S and m + 1 6 i 6 k + 1 }.
Let
Z = Cp ∪ . . . ∪ Cm ∪ . . . ∪ Cq−1 . (3.35)
Then Z \ S is the component of H − S which contains Cm \ S. Notice that,
Sp ⊆ Cj for j ∈ {p, . . . , m}, and Sq ⊆ Cj for j ∈ {m, . . . , q − 1}. (3.36)
This follows because Sp ⊆ S ⊆ Cm and, by definition also Sp ⊆ Cp . Similarly,
Sq ⊆ S ⊆ Sm and Sq ⊆ Cq , which yields the second series of relations.
Notice that the maximal cliques of Z ∪ C are Cp , . . . , Cq−1 and C, and so
Z ∪ C has less maximal cliques than G. Thus we may assume that Z ∪ C has a
consecutive clique arrangement. Let this consecutive clique arrangement be
[ Z0 , . . . , Zt ]. (3.37)
x ∈ C0 \ S1 y ∈ Ck \ Sk z ∈ C \ S. (3.42)
_
IVn(n+4 points; n>2) _
Vn(n+5 points; n>1)
Fig. 3.14. The forbidden induced subgraphs for interval graphs. Notice that all of
them, except C4 and C5 are contained in Gallai’s table Figure 3.3 on page 45. The C5
appears in Figure 3.2 on page 44. The C4 is a comparability graph and so it does not
appear in Gallai’s list.
41
C. Lekkerkerker and J. Boland, Representation of a finite graph by a set of intervals
on the real line, Fundamenta Mathematicae 51 (1962), pp. 45–64.
3.6 Interval graphs 79
Proof. By Lemma 3.80 we only need to prove one direction. Assume that G is
a graph without induced C4 and assume that Ḡ has a transitive orientation.
We first prove that G is chordal.
Assume that G has a hole H, that is, H is an induced cycle in G of length at
least five. First notice that a transitive orientation of Ḡ induces a transitive
orientation of H.
Number the vertices of H consecutively [x1 , . . . , xt ]. First consider the neigh-
bors of x1 in Ḡ, that is
{x3 , . . . , xt−1 }.
Without loss of generality, assume that the edge {x1 , x3 } is directed from x1 to
x3 . Then, by transitivity, the edge {x1 , x4 } is directed from x1 to x4 , otherwise
42
P. Gilmore and A. Hoffman, A characterization of comparability graphs and of in-
terval graphs, Canadian Journal of Mathematics 16 (1964), pp. 539–548.
80 3 Graph Classes
there would have to be an edge {x3 , x4 } in Ḡ. Repeating the argument we find
that all edge {x1 , xi } for i ∈ {3, . . . , t − 1} are directed from x1 to xi .
Consider the neighbors of x2 in Ḡ, that is the set {x4 , . . . , xt }. Since {x1 , xt−1 }
is directed from x1 to xt−1 and since {x1 , x2 } is not an edge in G, by transitivity
the edge {x2 , xt−1 } in Ḡ is directed from x2 to xt−1 . (Notice that here we use
the fact that t > 4.) As above, we find that all edges {x2 , xi } for i ∈ {4, . . . , t}
are directed from x2 to xi .
We can repeat the argument, and we find that for all vertices xi of H, all the
edges {xi , xj } of Ḡ are directed from xi to xj , which is of course a contradic-
tion.
We conclude that G is chordal. From Theorem 3.20 on page 45 it follows
easily that G has no asteroidal triple. (See Exercise 3.36.) By Theorem 3.77
we conclude that G is an interval graph. t
u
43
A. Pnueli, A. Lempel and S. Even, Transitive orientation of graphs and identification
of permutation graphs, Canadian Journal of Mathematics 23 (1971), pp. 160–175.
3.7 Permutation graphs 81
1 1 2 3 4 5
5 3
4 2 3 5 1 4 2
Fig. 3.15. A permutation graph and its permutation diagram
Let G be a graph such that G and Ḡ are both comparability graphs. We show
that G is a permutation graph by constructing a permutation diagram.
Let F1 and F2 be transitive orientations of G and Ḡ. We claim that F1 ∪ F2 is
an acyclic orientation of the complete graph. Otherwise there is a directed
triangle, and so two edges in the triangle are directed according to one of F1
and F2 and the third is directed according to the other one of F1 and F2 . But
this contradicts the transitivity of F1 or the transitivity of F2 .
Likewise, F−1
1 ∪ F2 is acyclic. Order the vertices on the topline according to
F1 ∪ F2 and the vertices on the bottom line according to F−1
1 ∪ F2 . It is easy to
check that this yields the permutation diagram. t
u
Dushnik and Miller proved that classes of interval containment graphs and
permutation graphs are the same.45
Two vertices i and j with i < j are adjacent if i appears to the right of j on
the bottom line. Thus a clique in G corresponds with a decreasing sequence
in π.
This shows that finding ω(G) is equivalent to finding the longest decreas-
ing subsequence in π. Given the sequence π this can be done very efficiently.49
3.8 Problems
3.1. Let G be a 5-cycle. Is G perfect?
3.4. Prove that a graph G is bipartite if and only if all cycles in G are even. Is
it also true that G is bipartite if and only if all induced cycles are even?
3.10. Let G = (V, E) be a graph. Two vertices x and y are twins if either
(a) Show that every cograph with at least two vertices has a twin.
(b) Show also the converse: If every induced subgraph of a graph G has either
only one vertex, or else has a twin, then G is a cograph.
Hint: Consider a cotree (T , f) of G. Let x and y be two vertices in G that are
mapped by f to two leaves in T that have the same parent in T . Prove that x
and y are twins in G.
3.11. Show that a cograph with n vertices can have 3n/3 maximal cliques.
Hint: Show that the complement of the union of n3 disjoint triangles is a
cograph.
50
M. Golumbic, Algorithmic graph theory and perfect graphs, Elsevier, Annals of Dis-
crete Mathematics 57, Amsterdam, 2004.
3.8 Problems 85
3.13. Check that the house, hole, domino and gem depicted in Figure 3.8 on
Page 58 are not distance hereditary.
3.14. Let G = (V, E) be distance hereditary and let G0 be the graph obtained
from G by adding one vertex x to G which is either isolated, or a pendant
vertex with a neighbor y ∈ V, or a twin of some vertex z ∈ V. Show that G0 is
distance hereditary.
3.17. Let G be distance hereditary. Prove that, for every vertex x and every
integer k, the set of vertices at distance k from x induces a cograph.
3.18. Finish the proof of Theorem 3.49 on Page 63 by showing how the four
values, that are mentioned in the proof, are computed for an edge e in the
decomposition tree T .
3.20. Finish the proof of Theorem 3.56 by showing that the paths Px and Py
exist.
Hint: There is an a, b-path Px with internal vertices in Cx since a and b both
have a neighbor in Cx and G[Cx ] is connected. You need to show how to get
rid of all the shortcuts.
3.21. Let G be a chordal graph and let S be a minimal x, y-separator for non-
adjacent vertices x and y. Let Cx be the component of G − S that contains the
vertex x. Then Cx contains a vertex x0 such that
S ⊆ N(x0 ).
3.23. Consider a tree T . If T is not a clique then T has two simplicial vertices
which are not adjacent. Prove the analogue for chordal graph: If G is a chordal
graph and if G is not a clique, then G has two nonadjacent simplicial vertices.
86 3 Graph Classes
3.25. The proof of Theorem 3.66 is perhaps a bit sketchy. Rub the sleep out
of your eyes and make sure that you agree with all the details.
3.26. Show that the coloring algorithm of Theorem 3.67 on Page 72 can be
implemented to run in linear time.
3.28. Consider three intervals I1 , I2 and I3 on the real line. If any two have a
nonempty intersection then
I1 ∩ I2 ∩ I3 6= ∅.
3.29. Prove that the Helly property also holds for a collection of subtrees of a
tree. That is the following. Let T be a tree, and let S be a collection of subtrees
of T such that
3.31. Let G = (V, E) be a chordal graph. By Theorem 3.64 there exist a tree
T and a collection of subtrees
T = { Tx | x ∈ V }
such that any two vertices x and y in G are adjacent if and only if Tx ∩ Ty 6= ∅.
We say that G is the intersection graph of T.
Make a subtree Te for every edge e = {a, b} ∈ E in G by defining
3.8 Problems 87
T e = Ta ∪ Tb .
E = { Te | e ∈ E }.
Prove that G∗ is the square of the linegraph L(G) of G. By that we mean that
the vertices of G∗ are the edges of G, and two vertices e1 and e2 of G∗ are
adjacent if and only if
∃e∈E e1 ∩ e 6= ∅ and e2 ∩ e 6= ∅.
3.33. Check that the circled vertices in Figure 3.3 on page 45 form asteroidal
triples.
3.34. Point out an asteroidal triple in each graph in Figure 3.13 on page 75.
4 1 2
1 4 7 3
6
4
1
7 6 2 3
5
5 3
5 7 6
2
For most NP-complete problems one can attach a parameter to the problem
and consider the parameterized version of the problem.
For example, consider the clique number ω(G) of a graph G. The clique
number problem asks to find the maximal value ω for which the graph G has
a clique with ω vertices.
Just coming up with some parameter like that doesn’t help much, of
course. Well, maybe it does, a little bit. Suppose that ω(G) is at most two.
For example, any bipartite graph has clique number at most two, so there are
lots of them.
The above algorithm shows that for each CONSTANT k, the algorithm
to check if ω(G) > k runs in polynomial time. So we have a polynomial
algorithm to check if a graph G has a clique with three vertices, or a clique
with 10 vertices, or even if G has a clique with one million vertices. In fact,
for each CONSTANT k, the algorithm to check if ω(G) > k runs in polynomial
time.
Of course, we can say that the algorithm is polynomial only for constant
√ k.
An algorithm that runs in O(nn ), or an algorithm that runs in O(n n ) is not
polynomial. Even an algorithm that runs in O(nlog log(n) ) is not polynomial.
The inverse Ackermann function α(n) is one of the slowest growing, un-
bounded functions that exist. For example, when n is the number of atoms in
the universe, then α(n) < 5 (at least, that’s what people think). No computer
can ever be built that contains more components than the number of atoms
in the universe. An algorithm that runs in O(nα(n) ) is not polynomial, since
α(n) is an unbounded, growing function of n. For any practical situation this
algorithm runs in O(n5 ), but it is not polynomial. That’s where the ‘theoret-
ical’ in ‘theoretical computer science’ kicks in; it takes us where no man has
gone before.
When we really want to run that algorithm to check if ω(G) > 106 then
6
we run into trouble. I mean, a polynomial-time algorithm that runs in O(n10 )
is not very appetizing! So, “Big Deal!” you say, and you’re right, so far it is not
a big deal.
Here’s a definition.
f(k) = 2k and c = 2
To compare them, let’s fix k = 10. The fixed parameter algorithm runs in
time O(210 · n2 ), so actually it is a quadratic algorithm. The other algorithm
runs in O(100 · n10 ). I think everybody agrees, the fixed-parameter algorithm
is better, unless we are fooled, for example by some crazy constant that is
hidden in the big O.
Notice that you have to be a bit careful with the sign; sometimes you
want to maximize the cardinality of some subset and sometimes you want to
minimize it. The question whether there is a vertex coloring of G with at least
k colors makes little sense. If a graph has n vertices and if n > k then the
graph has a coloring with at least k colors.
In this chapter we look at some problems for which there are fixed-
parameter algorithms. Not every problem is like that. For example, it is
unlikely that the parameterized clique number problem (ω(G), k) is fixed-
parameter tractable. It can be shown that,
Unless P=NP, any algorithm that solves (ω(G), k) will have a running time
where the k appears in some way in the exponent of n.
92 4 Fixed-parameter Algorithms
The book by Downey and Fellows examines which problems have a fixed-
parameter algorithm.1 The book contains a list of problems that are fixed-
parameter tractable, and a list of problems that are not fixed-parameter
tractable (unless P=NP).
It is not always easy to tell. As in the usual NP-completeness theory one can
show that some parameterized problem (P, k) is not fixed-parameter tractable
by reducing some other parameterized problem (Q, k0 ), which is hard for
fixed-parameter tractability, to (P, k).
The vertex cover problem asks for a vertex cover of smallest cardinality.
Lemma 4.3. Let G = (V, E) be a graph. Then S is a vertex cover if and only if
V \ S is an independent set.
1
R. Downey and M. Fellows, Parameterized complexity, Springer-Verlag, 1999.
4.1 Vertex cover 93
Proof. Let S be a vertex cover. By definition, there is no edge with both ends
in V \ S. So V \ S is an independent set.
Suppose I is an independent set. Then every edge must have at least one end
in V \ I. So V \ I is a vertex cover. t
u
Let’s introduce some fancy notation for the vertex cover number of a
graph. Denote the smallest cardinality of a vertex cover in a graph G by ζ(G).
(That greek letter is “zeta,” or “z,” the last letter in the English alphabet. The
greek α is “a,” the first letter in the English alphabet.) Then, by Lemma 4.3,
Theorem 4.4. The vertex cover problem is fixed-parameter tractable. The prob-
lem (ζ(G), k) can be solved in O(2k · n2 ) time.
( G − (Z ∪ {x}), Z ∪ {x} )
94 4 Fixed-parameter Algorithms
|Z0 | = k
then we don’t need to grow it any further. We let the algorithm check if G − Z0
is an independent set or not. If so, then Z0 is a vertex cover with k vertices.
Otherwise, we let the algorithm backtrack to its parent, and continue the
search from there.
In this way, the binary tree has a depth at most k, since each branching adds
one vertex to the set Z. Any full binary tree of depth k has 2k leaves and 2k −1
internal nodes.
In each vertex (G − Z∗ , Z∗ ) of the binary tree we have to check if there is an
edge {x, y} with both ends in G − Z∗ . This we can do in O(n2 ) time. The total
time complexity is therefore O(2k · n2 ). t
u
Remark 4.5. We have seen that (α(G), k) is not fixed-parameter tractable and
that (ζ(G), k0 ) is. Furthermore, we have that
ζ(G) = n − α(G)
Remark 4.6. The technique used in Theorem 4.4 is called a bounded search-
tree technique. In this technique you build a search-tree of a size which is
some function of the parameter k. The bounded search-tree technique is one
of the most successful techniques that one can use to prove that some problem
is fixed-parameter tractable.
4.2 A kernel for vertex cover 95
Lemma 4.7. Let G be a graph and assume that ζ(G) 6 k. Let Z be a vertex
cover for G with |Z| 6 k. If a vertex x in G has at least k + 1 neighbors then
x ∈ Z.
Every edge must have one endvertex in Z, thus if x ∈ / Z then yi ∈ Z, for all
i ∈ {1, . . . , k + 1}. But then |Z| > k, which is a contradiction. t
u
Lemma 4.8. Let G be a graph and assume that every vertex in G has degree at
most k. Furthermore, assume that G has no isolated vertices. Assume that G has
a vertex cover Z with at most k vertices. Let n and m be the number of vertices
and edges in G. Then
n 6 k + k2 and m 6 2k2 .
Proof. Let Z be a vertex cover in G. Since G has no isolated vertices, and since
Z is a vertex cover, every vertex of V \ Z has at least one neighbor in Z.
Since the degree of any vertex in G is at most k, any vertex in Z has at most
k neighbors in V \ Z. This proves that the number of vertices is at most
Any edge has either two ends in Z or exactly one end in Z. Thus the number
of edges in G satisfies
Lemmas 4.7 and 4.8 can be used to reduce the graph G in polynomial time
to a graph H of which the number of vertices is bounded by some function
of the parameter k. Such a graph H is called a kernel for the parameterized
problem. Notice that the exponential part of the algorithm runs only on the
kernel. (You could say that the kernel is ‘the heart of the problem.’)
96 4 Fixed-parameter Algorithms
Theorem 4.9. Let G be a graph with n vertices. The parameterized vertex cover
problem (ζ(G), k) is fixed-parameter tractable. There exists an algorithm for
(ζ(G), k) which runs in O(n2 + 2k · k4 ) time.
n2 + 2k · k4 6 (2k + 1) · n4 .
Proof. Assume that there exists an algorithm that runs in O(f(k)·nc ) for some
function f and some constant c. We use this algorithm to reduce the input to
a kernel as follows.
1. When f(k) 6 n then the algorithm above runs in time proportional to
f(k)nc 6 nc+1 , i.e., it is polynomial. This part of the algorithm is the
reduction to the kernel.
2. Otherwise, when f(k) > n, then we have a kernel of size n < f(k).
This proves the theorem. t
u
ν(G) 6 k,
Theorem 4.13. Let G = (V, E) be a graph and assume that G has no isolated
vertices. There exists a kernel with at most 3k vertices for (ζ(G), k).
ζ(B) = ν(B).
Via the maximum matching algorithm we can find in polynomial time, a max-
imum matching M0 in B and a minimum vertex cover Z0 for B with endvertices
in V(M0 ).
We now consider two cases.
First assume that Z0 has at least one vertex in V(M). Define
U = V(M) ∩ Z0 .
Define I0 as the set of other endvertices of edges in M0 that have one endvertex
in U. Notice that, if U 6= ∅, then U separates I0 and V \ (U ∪ I0 ).
We claim that there exists a minimum vertex cover Z in G which contains U.
To see this, notice that each edge e ∈ M0 must have an endvertex in Z. If this
endvertex is in I0 , then we may replace it with the other endvertex of e in U.
Then the new set of vertices is also a vertex cover.
2
J. Edmonds, Paths, trees, and flowers, Canadian Journal of Mathematics 17 (1965),
pp. 449–467.
98 4 Fixed-parameter Algorithms
So, in this case we can reduce the graph by removing the vertices of
U ∪ I0
and put the vertices of U in Z. The algorithm proceeds to look for a vertex
cover with at most k − |U| vertices in
G − (U ∪ I0 ).
In the second case we assume that Z0 has no vertices in V(M). Then the
minimum vertex cover Z0 has only vertices in I. Since there are no isolated
vertices,
Z0 = I.
Then the number of vertices is at most
|I| + |V(M)| 6 k + 2k = 3k.
In other words, this set is a kernel. t
u
Lemma 4.16. Let G be a graph and let x be a vertex with two neighbors, say y
and z. Then there exists a minimum vertex cover Z for G such that either
(i) {y, z} ⊆ Z and x ∈
/ Z, or
(ii) x ∈ Z and
(N(y) ∪ N(z)) \ N(x) ⊆ Z.
Proof. Let G = (V, E) be a graph and let Z be a minimum vertex cover for G.
Let x be a vertex with two neighbors, say y and z.
Obviously, when y ∈ Z and z ∈ Z then x ∈
/ Z, since Z is minimum.
Assume that x ∈ Z, y ∈ Z and z ∈
/ Z. Then
Z0 = (Z \ {x}) ∪ {z}
Theorem 4.17. There exists an O(1.39k · n2 ) algorithm that solves the param-
eterized vertex cover problem (ζ(G), k).
Proof. The algorithm builds a search-tree as follows. The root of the search-
tree is the pair (G, ∅).
At each vertex (G0 , Z0 ) in the search tree the algorithm proceeds as follows.
(1) If there is an isolated vertex x in G0 , then remove it from G0 .
(2) If G0 has a vertex x with one neighbor y, then put y in Z0 and remove x
and y from the graph G0 .
(3) If G0 has a vertex x with at least three neighbors, then the algorithm
branches; the vertex in the search tree gets two children. In one child the
vertex x is put in Z0 and it is removed from G0 . In the other child, all the
neighbors of x are put in Z0 and all vertices of N[x] are removed from the
graph G0 .
(4) Assume that G0 has a vertex x with two neighbors, y and z. Assume that
neither y nor z has a neighbor which is not a neighbor of x. If y and z are
not adjacent then put x in Z0 and remove x, y and z from G0 . If y and z
are adjacent then put two of x, y and z in Z0 and remove x, y and z from
G0 .
Otherwise, when at least one of y and z has a neighbor which is not a
neighbor of x, the algorithm branches. In one child both y and z are put
100 4 Fixed-parameter Algorithms
in Z0 and the three vertices x, y and z are removed from G0 . In the other
child, x and all vertices of
(N(y) ∪ N(z)) \ N(x)
are put in Z0 . In this case all vertices of
N[y] ∪ N[z]
are removed from G0 . By the assumption that y or z has at least one
neighbor which is not a neighbor of x, this removes at least four vertices.
The correctness of this step follows from Lemma 4.16.
Notice that each vertex in the search tree is a leaf or it has two children.
Let T (n) be the amount of work done by the algorithm. In the first and second
case, the algorithm is greedy. We may assume that these cases do not occur.
In the third case, the branching gives the recurrence
T (n) 6 T (n − 1) + T (n − 4) + O(n2 ). (4.1)
In the fourth case, we have, apart from two greedy cases,
T (n) 6 T (n − 3) + T (n − 4) + O(n2 ). (4.2)
This is so because in one branch x, y and z are removed, and in the other
branch the vertices of N[y] ∪ N[z] are removed (and this set contains at least
four vertices).
The search tree has depth at most k. The solution for the Recurrence (4.1)
is T (k) = O(1.39k · n2 ). The solution for the Recurrence (4.2) is T (k) =
O(1.23k · n2 ). (In Exercise 4.5 we ask you to check that.) Clearly, the worst
case occurs when the algorithm branches all the time as in the third case. tu
Remark 4.18. The best algorithm that we know of for the parameterized ver-
tex cover problem (ζ(G), k) runs in O∗ (1.28k ) and polynomial space. Here we
suppressed the polynomial in n.5 This algorithm does a more extensive case
analysis. No better timebound is known, even when one allows exponential
space.6
Remark 4.19. The Exponential Time Hypothesis assumes that k-SAT cannot
be solved in O(2o(k)n ) time. It can be shown that, if (ζ(G), k) can be solved
in O(2o(k) · nO(1) ) time then the Exponential Time Hypothesis fails.7 8
5
J. Chen, I. Kanj, and G. Xia, Improved upperbounds for vertex cover, Theoretical
Computer Science 411 (2010), pp. 3736–3756.
6
L. Chandran, F. Grandoni, Refined memorisation for vertex cover, Information Pro-
cessing Letters 93 (2005), pp. 125–131.
7
R. Impagliazzo and R. Paturi, On the complexity of k-SAT, Journal of Computer and
System Sciences 62 (2001), pp. 367–375.
8
D. Marx, Fixed parameter algorithms. Open lectures for PhD students in computer
science, 2010, Warsaw, Poland.
4.4 Minimum fill-in 101
Of course, when a graph G = (V, E) is not chordal then we can add some
edges to the graph such that it becomes chordal. For example, if we add all
edges between any pair of vertices x and y that are not adjacent in G, then
the new graph is a clique, and a clique is obviously chordal.
In the minimum fill-in problem one wants to add as few edges as possible
to make it chordal.
Definition 4.21. The minimum fill-in problem asks for a chordal embedding H
of a graph G such that the number of edges in H is minimal.
Fig. 4.1. The figure shows the different triangulations of C6 . The number of these is
the Catalan number C4 = 14.
2(2n + 1)
Cn+1 = Cn and C1 = 1.
n+2
Notice that the bound Cn 6 4n−1 follows easily by induction from the recur-
rence relation:
2(2n + 1) 4n + 2 n−1 4(n + 2) n−1
Cn+1 = Cn 6 4 6 4 = 4n .
n+2 n+2 n+2
t
u
4.4 Minimum fill-in 103
So, to look for an induced cycle of length at least four, we try all possible
triples {x, y, z} as above. For each such triple the algorithm finds a path from
y to z in
G − (N[x] \ {y, z}).
Adding the vertex x yields the chordless cycle of length at least four.
Notice that the number of these triples is bounded by
X X
d(x)(d(x) − 1) 6 n d(x) = 2nm.
x∈V x∈V
Lk 6 4k .
Lk 6 4t−3 · Lk−(t−3) 6 4k .
We claim that the search-tree T has at most 2 · 4k + 1 vertices. To see this, first
note that it has at most one vertex of degree two, namely the root. All other
internal vertices have one parent and at least two children, since every cycle
of length at least four has at least two possible minimal embeddings.
Let n0 and m0 be the number of vertices and edges in T . We write L instead
of Lk for the number of leaves in T . For a vertex x in T we write dT (x) for the
number of neighbors of x in T . Then we have
104 4 Fixed-parameter Algorithms
X X X
2m0 = 2(n0 − 1) = 1+ 2+ 3 + ...
x,dT (x)=1 x,dT (x)=2 x,dT (x)=3
X X
> L+ 3+ 4 + ...
x,dT (x)=3 x,dT (x)=4
X X
> L + 3( 1+ 1 + . . .)
x,dT (x)=3 x,dT (x)=4
At each vertex in the search-tree we spend at most O(n3 ) time to look for a
suitable triple {x, y, z} and O(n2 ) time to find the y, z-path. Thus, a cycle of
length at least four is found in O(n5 ) time, if it exists. The total time that is
used by this algorithm is therefore bounded by O((2·4k +1)·n5 ) = O(4k ·n5 ).
This proves the theorem. t
u
The problem to remove a minimal number of vertices from the graph such
that the remaining graph is bipartite is of course equivalent to finding a set
of vertices of minimal cardinality such that each odd cycle in the graph has
at least one vertex in this set. The problem is called the odd cycle transversal
problem.
The odd cycle transversal problem asks to find a minimum set F of vertices
in G such that G − F is bipartite. The odd cycle transversal problem is NP-
complete. In this section we show that it is fixed-parameter tractable.9
9
B. Reed, K. Smith and A. Vetta, Finding odd cycle transversals, Operations Research
Letters 32 (2004), pp. 299–301.
4.5 Odd cycle transversals 105
Lemma 4.25. Let G be a graph and let x be a vertex of G. Let F be an odd cycle
transversal in G − x. Then F0 = F ∪ {x} is an odd cycle transversal in G.
Proof. This is obvious. Any odd cycle in G which contains no vertex of F must
contain x, otherwise it would be an odd cycle in (G − {x}) − F. Thus F0 is an
odd cycle transversal in G. t
u
|F0 | = k + 1.
{B1 , B2 }
V 0 = (V \ T ) ∪ { t1 , t2 | t ∈ T }. (4.4)
(iii) Assume e = {f, g} with {f, g} ⊆ T . The graph B contains one edge for
each edge e of this type. Either, arbitrarily, {f1 , g2 } or {f2 , g1 }.
This completes the description of the bipartite graph B. Thus the vertices of B
are partitioned into two color classes
Y 0 = { y1 , y2 | y ∈ Y }, (4.6)
Theorem 4.27. An odd cycle transversal T is minimum if and only if for every
valid partition
{ Yα , Yβ } (4.8)
of Y 0 , for any Y ⊆ T , there are |Y| vertex-disjoint paths from Yα to Yβ in
B0 = B[Yα ∪ Yβ ∪ B1 ∪ B2 ] (4.9)
B0 = B[Yα ∪ Yβ ∪ B1 ∪ B2 ].
By the max flow – min cut theorem, or Menger’s theorem, there exists a
separator S in B0 which separates Yα from Yβ with cardinality less than |Y|.
Define a set of vertices Ω ⊆ V as follows. A vertex w ∈ V is in Ω if, either
T ∗ = Ω ∪ (T \ Y). (4.11)
To see that this is an odd cycle transversal, assume that G − T ∗ has an odd
cycle O. Then O must have a vertex y ∈ Y. The set Ω separates Yα from Yβ in
B0 , where B0 is defined as in (4.9). One copy of y is in Yα and the other copy
4.5 Odd cycle transversals 107
For the converse, assume that G has an odd cycle transversal U which is
smaller than T . That is, we assume |U| < |T |. Let { B̃1 , B̃2 } be a partition of
the vertices of G − U into two color classes.
Let Y = T \ U, and let the valid partition {Yα , Yβ } be defined by
B[Yα ∪ Yβ ∪ B1 ∪ B2 ]. (4.14)
Y 0 = (Yα ∪ Yβ ∪ B1 ∪ B2 ) \ (U \ T ). (4.16)
Theorem 4.28. For any k ∈ N there exists an O(4k k · mn) algorithm which
determines if a graph G can be made bipartite by deleting at most k vertices.
108 4 Fixed-parameter Algorithms
Proof. For a given odd cycle transversal F0 of size k + 1 we can check if there
exists a smaller one by solving a maximum flow problem for each choice of
Y ⊆ F0 and each valid partition {Yα , Yβ } of Y 0 as defined in (4.6). There are
O(2k ) choices for Y and O(2k ) choices for a valid partition.
The Ford-Fulkerson algorithm takes time O(km), since the value of the flow
is O(k). Since the subroutine is called for at most n vertices x, this proves the
theorem. t
u
Remark 4.29. The method illustrated in this section is sometimes called itera-
tive compression. Given a solution of small size k + 1 one tries to ‘compress’
it to a solution of size k or decide that no such solution exists.
10
J. Guo, J. Gramm, F. Hüffner, R. Niedermeier and S. Wernicke, Compression-based
fixed-parameter algorithms for feedback vertex set and edge bipartization, Journal
of Computer and System Sciences 72 (2006), pp. 1386–1396.
4.5 Odd cycle transversals 109
Problem 1.
Instance: A graph G = (V, E) and a feedback vertex set F in G of cardi-
nality at most k + 1.
Task: Find a minimum feedback vertex set F0 such that F0 ∩ F = ∅.
X = F̂ ∩ F and Y = F̂ \ F. (4.19)
In our algorithm we try all subsets X ⊆ F. Remove X from the graph and
find a minimum feedback vertex set Y in G − X disjoint from F \ X. Since there
are 2k+1 possible subsets X ⊆ F, it is sufficient to solve the problem stated
above.
We first get rid of some vertices that are unimportant for solving the prob-
lem. We present four reduction rules which reduce an instance of Problem 1
to an instance in which all vertices of V \ F have degree at least three in G.
Lemma 4.30. Let {G, F} be a problem instance of Problem 1 and let x be a vertex
in G of degree at most one. Then a solution to Problem 1 with instance
{G − x, F \ {x}}
Proof. If x has degree at most one then it is not contained in any cycle. Thus
any feedback vertex set in G − x is a feedback vertex set in G. Thus, a solution
of Problem 1 for instance {G−x, F\{x}} is a solution to Problem 1 with instance
{G, F}. t
u
{G0 , F \ {x}}.
Then Y is a solution to Problem 1 with instance {G, F}. If there is no solution to
Problem 1 with instance {G0 , F \ {x}} then there is no solution to Problem 1 with
instance {G, F}.
Proof. Let Y be a solution to Problem 1 with instance {G0 , F\{x}}. We first show
that Y is a feedback vertex set in G, disjoint from F. Assume that G − Y has a
cycle C. If x ∈ C then C contains y and z since x has two neighbors in C and
y and z are the only two neighbors of x in G. Since y and z are not adjacent
C must contain at least one vertex of V \ {x, y, z}. But then C \ {x} is a cycle in
G0 − Y, which is a contradiction.
Let Ỹ be a feedback vertex set which solves Problem 1 with instance {G, F}.
Since x ∈ F and Ỹ ∩ F = ∅, x ∈ / Ỹ. We show that Ỹ is a feedback vertex set
in G0 . If C were a cycle in G0 − Ỹ then C had to contain the edge {y, z}, since
otherwise C would also be a cycle in G − Ỹ. But then C ∪ {x} would be a cycle
in G − Ỹ, which is a contradiction.
Now assume that there is no solution to problem 1 with instance {G0 , F \ {x}}.
Then there is a cycle C in G0 with all vertices in F. If C is a cycle in G then
{G, F} has no solution. Otherwise, C contains the edge {y, z} in G0 . Then C∪{x}
is a cycle in G with all vertices in F. Thus {G, F} has no solution. t
u
{G − x, F \ {x}}. (4.20)
Lemma 4.34. Let G = (V, E) be a graph and let F be a feedback vertex set in
G. Assume that every vertex of V \ F has degree at least three in G. If G has a
feedback vertex set F0 with
If GA is a forest then |EA | 6 |F| + |A| − 1. Each vertex of A has at least two
neighbors in F, thus
|EA | > 2|A|. (4.23)
Hence, if GA is a forest then |A| 6 |F| − 1. If |A| > 2|F| then it is clearly
impossible to remove at most |F| vertices from A such that GA is acyclic.
We now show that |B| 6 2|F|. Since F is a feedback vertex set in G, G[V 0 ] is a
forest. All vertices of V 0 that have degree at most one in G[V 0 ] are in A, since
every vertex of G − F has degree at least three. All vertices of B have degree
at least three in G[V 0 ] and since G[V 0 ] is a forest
Each vertex of C has degree two in G[V 0 ]. Thus it has at least one neighbor
in F. Since C ∩ A = ∅, every vertex of C has exactly one neighbor in F. The
graph G[C] consists of paths and isolated vertices. We first bound the number
of isolated vertices. Each isolated vertex connects two components of G[A∪B]
and no two components of G[A ∪ B] are connected by more than one isolated
vertex in C. Since G[V 0 ] is a forest, the number of isolated vertices in C is at
most
|A ∪ B| − 1 < 4|S|. (4.25)
We now bound the number of vertices in C that are in paths of length at least
one. We claim that the number of vertices in G[C] that are not isolated is
at most 6|F|. First notice that each edge of G[C] creates a path between two
vertices in F. Thus, if there are at least |F| edges in G[C] then there is a cycle
in G[C ∪ S].
Assume that G[C] has more than 3|F| edges. Each vertex of G[C] is incident
with at most two edges of G[C]. If we remove at most |F| vertices from G[C]
then at least |F| edges remain and then there is a cycle by the argument above.
Thus G[C] can have at most 3|F| edges, that is, at most 6|F| vertices of G[C] are
in paths of length at least one.
In total, we find that |V 0 | is bounded by
Lemma 4.35. Let G be a graph and let F be a feedback vertex set in G of cardi-
nality k + 1. There exists an O(ck · n2 ) algorithm, for some constant c, which
decides if there exists a feedback vertex set F0 with cardinality at most k.
Proof. The algorithm tries all 2k+1 subsets X ⊆ F and tries to find a feedback
vertex set in G − X which is disjoint from F \ X.
Let G∗ = G − X and reduce G∗ by repeated application of the reduction rules
implied by Lemmas 4.30, 4.31, 4.32 and 4.33. This takes at most linear time.
By Lemma 4.34, the remaining graph G0 has at most 14 · |F| vertices in V 0 \ F,
where V 0 is the set of vertices of G0 and where F is a feedback vertex set in G0
with at most k + 1 vertices. Hence, the algorithm needs to try at most
X
k
14(k + 1)
< 214·(k+1) (4.27)
i
i=0
subsets of V 0 \ F.
In total, the time complexity is bounded by O(215·k · n2 ). t
u
By lemma 4.35 the compression step takes O(ck · n2 ) time. Since this step
is performed at most n times, namely for the graphs Gi where i = 1, . . . , n,
the overall time complexity is bounded by O(ck · n3 ) time. This proves the
following theorem.
Theorem 4.36. The parameterized feedback vertex set problem (f(G), k) can be
solved in O(ck · n3 ) time, for some constant c.
Remark 4.38. Thomassé proved that (f(G), k) can be reduced to a kernel with
at most 4k2 vertices.12
11
F. Dehne, M. Fellows, M. Langston, F. Rosamund and K. Stevens, An O(2O(k) · n3 )
FPT algorithm for the undirected feedback vertex set problem, Theory of Computing
Systems 41 (2007), pp. 479–492.
12
S. Thomassé, A 4k2 kernel for feedback vertex set, ACM Transactions on Algorithms
6 (2010), pp. 32:1–8.
114 4 Fixed-parameter Algorithms
We refer to the sets of the partition as color classes. Each color class is
either a clique or an independent set. The homogeneous coloring problem
asks for a homogeneous coloring with a minimum number of color classes.
Recall that a graph G is perfect when ω(H) = χ(H) for every induced
subgraph H of G. By the perfect graph theorem, when G is perfect, also Ḡ is
perfect. Recall also Theorem 3.7 on Page 40 which shows that the coloring
and clique number problem can be solved in polynomial time for G, and also
for Ḡ, when G is a perfect graph.
Recently, it was shown that classes of graphs that do not contain all com-
plete multipartite graphs nor their complements have a (k, k)-coloring for
some fixed k. Chudnovsky and Seymour proved the following result.14
13
K. Wagner, Monotonic coverings of finite sets, Elektronische Informationsverar-
beitung und Kybernetik 20 (1984), pp. 633–639.
T. Feder and P. Hell, Matrix partitions of perfect graphs, Discrete Mathematics 306
(2006), pp. 2450–2460.
A. Kézdy, H. Snevily and C. Wang, Partitioning permutations into increasing and
decreasing subsequences, Journal of Combinatorial Theory, Series A 73 (1996),
pp. 353–359.
14
M. Chudnovsky and P. Seymour, Extending the Gyárfás-Sumner conjecture.
Manuscript 2012.
4.6 Homogeneous coloring of perfect graphs 115
In the following theorem we show that the (k, `)-coloring problem is fixed-
parameter tractable on perfect graphs.15
Theorem 4.41. There exists an O(f(k, `)nc ) algorithm which solves the (k, `)-
coloring problem on perfect graphs. Here
15
P. Heggernes, D. Kratsch, D. Lokshtanov, V. Raman and S. Saurabh, Fixed-parameter
algorithms for cochromatic number and disjoint rectangle stabbing, Proceedings
SWAT’10 , Springer, LNCS 6139 (2010), pp. 334–345.
116 4 Fixed-parameter Algorithms
The algorithm runs as follows. Let P be a partition of Gi−1 . Add the vertex
xi as a separate clique to P and let L be the bitvector of this partition. Let
X be the set of vertices that have a 1 in L and let Y be the set of vertices
with a 0 in L. First check if Gi [X] has a clique cover with at most k cliques
and if Gi [Y] has chromatic number at most `. If that is the case, then we are
done; the algorithm outputs a clique cover and a coloring with k cliques and
` independent sets for the graph Gi .
Now assume that the clique cover number of Gi [X] is at least k + 1. Since
Gi is perfect, it has an independent set S with k + 1 vertices. Since Gi is a
perfect graph it can find a maximum independent set S in polynomial time
and reduce this, if necessary, to k + 1 vertices.
If there is a partition Q of Gi with k cliques and ` independent sets, then, by
Equation (4.28),
H(L, LQ ) 6 µ = 2k · ` + `. (4.29)
If there exists an independent set S with k + 1 vertices in Gi [X], then there is a
vertex z ∈ S of which the corresponding bit is 0 in LQ . For each bit in L which
corresponds with a vertex z of S the algorithm does the following. It switches
the bit of z in L to 0. Let L0 be this bitvector. Then the algorithm recurses and
tries to find a partition Q which is at distance at most µ − 1 from L0 .
The case where Gi [Y] has chromatic number at least ` + 1 is similar.
To analyze the time complexity, observe that we may assume that k > 1 and
` > 1, since otherwise we can just check if there is a clique cover or coloring
with k or ` sets. The recursion tree has depth at most 2k · ` + ` since each time
the algorithm is recursively called the Hamming distance µ is decreased by
one. Each node in the recursion tree corresponds with a clique of cardinality
` + 1 or an independent set of cardinality k + 1. Since
k + 1 6 k + ` and ` + 1 6 k + ` (4.30)
every node in the recursion tree has at most k + ` children. Thus the total
number of recursions is bounded by
(k + `)2k·`+` . (4.31)
small cardinality.16 The technique has become a popular technique for obtain-
ing good fixed-parameter algorithms.
The trick to solve this problem is very easy. First, randomly color the ver-
tices of the graph with k colors. Say the colors are {1, . . . , k}. Now search for
a path
P = [p1 , . . . , pk ] (4.32)
where s = p1 and t = pk such that pi has color i for all i ∈ {1, . . . , k}.
When G is equipped with a k-coloring then the search algorithm for a path
P as above is very easy. Namely, first delete all edges from G except those that
connect vertices with colors i and i + 1, for i ∈ {1, . . . , k − 1}. Direct the
remaining edges, {x, y} as − → if x has color i and y has color i + 1. This makes
xy
G into a directed, acyclic graph. Next, the algorithm searches for an s, t-path
in this acyclic digraph. This takes linear time using dynamic programming;
simply maintain the subset of vertices with color i that can be reached from s
by a colored path [p1 , . . . , pi ].
Lemma 4.42. Assume that G has an s, t-path. Consider the algorithm which
tries all permutations of the k colors and which runs the algorithm described
above for each permutation. This algorithm finds an s, t-path with probability
at least e−k .
Theorem 4.43. Assume that G has an s, t-path. When the algorithm described
in Lemma 4.42 is ran at least T · ek times, then the probability that it does not
find an s, t-path is at most e−T .
16
N. Alon, R. Yuster and U. Zwick, Color-coding, Journal of the ACM 42 (1992),
pp. 844–856.
118 4 Fixed-parameter Algorithms
Proof. The probability that the algorithm of Lemma 4.42 does not find an
s, t-path is at most
1 − e−k . (4.34)
Thus, after T · ek trials, the probability that the algorithm fails to find the
s, t-path is at most
t
u
Remark 4.44. using derandomization techniques like hashing schemes this al-
gorithm can be made deterministic.17
4.8 Problems
4.1. Let’s start with a problem from elementary school. Which function grows
faster.
klog(k) or (log(k))k .
How about
2 log(k)+log(k2 )
2k or 22 .
A tricky one:
4.2. Show that the parameterized chromatic number problem (χ(G), k) is not
fixed-parameter tractable.
Hint: Recall that 3-coloring is NP-complete.
S = { S1 , . . . , Sn }
be a collection of n subsets of S such that |Si | = 3 for all i ∈ {1, . . . , n}. The
3-hitting set problem asks for a subset S0 ⊆ S of minimal cardinality such
that every triple Si of S contains at least one element of S0 . Use the bounded
search-tree technique to show that the parameterized 3-hitting set problem
can be solved in O(3k · n2 ) time.
Hint: Build a search-tree in which every vertex which is not a leaf has degree
at most three.
17
M. Fredman, J. Komlós and E. Szemerédi, Storing a sparse table with O(1) worst
case access time, Journal of the ACM 31 (1984), pp. 538–544.
4.8 Problems 119
4.4. Find a kernel for the 3-hitting set that we defined in Exercise 4.3.
Hint: Consider an element x ∈ S that appears in at least k2 + 1 subsets Si .
Design a proof, similar to the proof of Lemma 4.8, which shows that x is in
any 3-hitting set with at most k elements.
4.6. Check that there are 14 minimal chordal embeddings of a labeled 6-cycle.
4.8. Let G be a graph and let k ∈ N, k > 3. Design an algorithm that checks
if G has a chordless cycle of length at least k and that out-puts one if it has. Is
your algorithm a fixed-parameter algorithm?
4.9. Can we use the linear-time recognition algorithm for chordal graph of
Tarjan and Yannakakis to find an induced cycle of length at least four?
4.13. Given a graph G = (V, E). The k-maximum cut problem asks if there is a
partition {A, B} of V such that at least k edges have one endpoint in A and the
other endpoint in B. Design a fixed-parameter algorithm for the k-maximum
cut problem.
Hint: This is a difficult exercise. The following paper describes a reduction to
120 4 Fixed-parameter Algorithms
We look at two kinds of decomposition trees. The first one is based on the
clique trees for chordal graphs and the second one is based on the decompo-
sition trees for distance-hereditary graphs.
Research on decomposition trees really took off with the graph minor the-
ory. We review some of that theory in the next section.
n1 , n2 , n3 , . . . (5.1)
Proof. Define
I = { i ∈ N | ∀j>i nj < ni }. (5.2)
The subsequence of (5.1) of the numbers ni with i ∈ I is strictly decreasing.
Since it is bounded from below by 1, it is finite.
Now let
0 if I = ∅, and
k= (5.3)
max { i | i ∈ I } if I 6= ∅.
Since I is finite this maximum exists. Consider the sequence
nk+1 , nk+2 , . . .
For each element n` with ` > k, there exists some element nm with m > ` and
nm > n` , since ` ∈
/ I. Then it is easy to construct an infinite nondecreasing
subsequence. t
u
G1 , G2 , . . . (5.4)
Let ni be the number of vertices of the graph Gi , for all i. By lemma 5.1,
there exists an infinite subsequence of (5.4) in which the number of vertices
is nondecreasing. A similar proof shows that there is also an infinite subse-
quence of graphs of which the number of vertices and edges is nondecreasing.
So we may assume that the sequence of graphs is ‘nondecreasing,’ if we order
them by their numbers of vertices and edges.
Can we take a different ordering? Suppose that we order the set of all
graphs by the induced subgraph relation. For two graphs G and H define
G H if the graph G is an induced subgraph of H. Notice that this relation is
transitive, that is,
if F G and G H then F H.
Question:
Is it true that there always exist some integers i and j with i < j such
that Gi Gj ?
Notice that, by Lemma 5.1 this is true for a sequence (5.1) of natural
numbers; just take two elements of a (infinite) nondecreasing subsequence.
Thus, if is the ordering of graphs by numbers of vertices and edges, then
the answer to the question is yes.
No; for the sequence of graphs this is not true if is the ordering by
induced subgraphs. An easy counterexample is
C3 , C4 , C5 , . . . ,
P1 , P2 , P3 , . . . ,
where Pi is the path with i vertices, the statement is true of course, since
any path Pi is an induced subgraph of a path Pj with j > i. But for general
sequences of graphs we cannot have that.
The way to make the statement true is to look at graph minors. To define
graph minors we need the concept of an edge contraction.
Definition 5.2. Let G = (V, E) be a graph. Let e = {x, y} be an edge in G. Con-
tracting the edge e in G is the following operation which transforms G into a
graph G0 . Replace the two vertices x and y by one vertex, say xy. The neighbor-
hood of xy in G0 is the set
Thus, contracting the edge e = {x, y} squeezes the edge down to a single
vertex xy. When z is a vertex that is adjacent to both x and y, then squeezing
the edge {x, y} to a single vertex xy, creates two edges {xy, z} in G0 . The double
edge {xy, z} is then replaced in G0 by a single edge.
G1 , G2 , . . .
It took Robertson and Seymour more than ten years to prove this theorem.
They finished the proof in 2004, and they wrote it down in a sequence of 20
papers. The total length of the proof is more than 500 pages; so we skip it.
5.1 Graph minors 125
x1 x2 x3
G
H X1
X2
X3
Fig. 5.1. The graph G is a minor of the graph H. Each induced subgraph H[Xi ] con-
tracts to the vertex xi . If we only contract the subsets Xi , without removing other
edges, then we end up with a ‘paw,’ that is a triangle {x1 , x2 , x3 } with one pendant
vertex adjacent to x1 . The graph G is a subgraph of the paw.
The first step in the proof is Kruskal’s theorem. Kruskal proved the theorem
in 1960 for the case where G1 , G2 , . . . is a sequence of trees.1 Of course, for
trees it is sufficient to consider only edge contractions; if T1 and T2 are trees
then T1 is a minor of T2 if and only if T1 can be obtained from T2 by a sequence
of edge contractions.
An important consequence of the graph minor theorem is
The Finite Basis Theorem.
Theorem 5.5. Let G be a class of graphs which is closed under taking minors.
That is, if G ∈ G and if H is a minor of G, then H ∈ G. There exists a finite set of
graphs Ω such that G ∈ G if and only if no element of Ω is a minor of G.
Proof. Let Ω be the set of graphs that are not in G but for which every proper
minor is in G. So, if G ∈ Ω then G ∈/ G, but if we delete a vertex or an edge,
or if we contract an edge in G, then the new graph is in G.
Suppose that Ω is not finite. Then we can construct an infinite sequence
G1 , G2 , . . . ,
of graphs in Ω. Furthermore, we may assume that no two graphs Gi and Gj
are the same (isomorphic). By Theorem 5.4, there exist i < j such that Gi is
a minor of Gj . Since Gi and Gj are not the same, Gi is a proper minor of Gj .
But this is a contradiction; every proper minor of Gj is in G, so Gi ∈
/ Ω. t
u
1
J. Kruskal, Well-quasi-ordering, the tree theorem, and Vazsonyi’s conjecture, Trans-
actions of the American Mathematical Society 95 (1960), pp. 210–225.
126 5 Decomposition Trees
Let’s look at an example. Let G be the class of all planar graphs. Let G ∈ G.
If we delete a vertex x from G, then the remaining graph G − x is also planar.
It is also easy to see that, if we delete an edge from G, then the remaining
graph is planar. Finally, if we contract an edge in G, then it is fairly easy to
see that the new graph G0 is still planar. Thus the class G of planar graphs is
closed under taking minors. By Theorem 5.5 there is a finite obstruction set
Ω. For the class of planar graphs this set is
Ω = { K5 , K3,3 }.
In the next section we illustrate the power of the graph minor theorem
by another example. We end this section with another important result of
Robertson and Seymour.
Theorem 5.6 (The Minor Test Theorem). Let H be a graph. There exists an
O(n3 ) algorithm that tests if H m G for graphs G, where n is the number of
vertices of G.
In other words, the parameterized graph minor problem (m (G), H),
which asks if the fixed graph H is a minor of a graph G, is fixed-parameter
tractable. Notice that, when H is not fixed the problem is NP-complete. For
example, when we take H a cycle with n vertices and G is a graph on n ver-
tices, then H m G if and only if G has a Hamiltonian cycle. To test if G is
Hamiltonian is NP-complete.
2
K. Wagner, Über eine Erweiterung eines Satzes von Kuratowski, Deutsche Mathe-
matik 2 (1937), pp. 280–285.
5.2 Parameterized feedback vertex set 127
Theorem 5.7. Let G be a class of graphs which is closed under taking minors.
There exists an O(n3 ) algorithm to test if a graph G ∈ G.
Proof. By Theorem 5.5 the class G has a finite obstruction set. By Theorem 5.6
we can test for each element in Ω whether it is a minor of a graph G or not.
Since Ω is finite we only need to perform a constant number of these tests.
This proves the theorem. t
u
For a graph G let f(G) denote the minimal cardinality of a feedback ver-
tex set in G. In this section we show that the parameterized feedback vertex
set problem (f(G), k) is fixed-parameter tractable. We already proved that in
Section 4.5.1 on page 108 but in this section we give a much easier argument.
Lemma 5.10. Let k ∈ N ∪ {0}. Let G(k) be the class of graphs G with f(G) 6 k.
The class G(k) is closed under taking minors.
3
K. Kawarabayashi and P. Wollan, A shorter proof of the graph minor algorithm –
The unique linkage theorem, proceedings STOC’10, ACM (2010), pp. 687–694.
4
K. Kawarabayashi, Y. Kobayashi and B. Reed, The disjoint paths problem in
quadratic time, Journal of Combinatorial Theory, Series B 102 (2012), pp. 424–435.
128 5 Decomposition Trees
Let e = {x, y} ∈ E. Let G0 be the graph obtained from G by deleting the edge
from E. Then F is a feedback vertex set in G0 , since G0 − F is a forest.
Let e = {x, y} ∈ E and let G0 be the graph obtained from G by contracting the
edge {x, y} to a single vertex xy. First assume that x ∈ / F and that y ∈/ F. Then
F is a feedback vertex set in G0 since the class of forests is closed under taking
minors.
Assume that x ∈ F and that y ∈ / F. Define
F0 = (F \ {x}) ∪ {xy}.
Proof. Let k ∈ N ∪ {0}. Let G(k) be the class of graphs that have a feedback
vertex set with at most k vertices. By Lemma 5.10 the class G(k) is minor
closed. By Theorem 5.5 there is a finite obstruction set Ω(k) such that
5.3 Treewidth
Recall Definition 4.20 on Page 101. Let G = (V, E) be a graph. A chordal
embedding of G is a chordal graph H = (V, E0 ) with E ⊆ E0 .
Robertson and Seymour came up with the graph parameter treewidth dur-
ing their research on graph minors.5 It turns out that, if G is a class of graphs
which is closed under taking minors, and if G does not contain all planar
graphs then there exists a k ∈ N ∪ {0} such that all graphs in G have treewidth
at most k.
For example, let G(`) be the class of graphs that have a feedback vertex
set with at most ` vertices. By Lemma 5.10 this class is closed under taking
minors. Furthermore, G(`) does not contain all planar graphs. For example, if
we take a sequence of larger and larger grids then it is easy to see that these
have an increasing number of vertices in a minimum feedback vertex set. The
result of Robertson and Seymour mentioned above now says that there exists
a k (which is a function of `) such that all graphs in G(`) have treewidth at
most k.
For example, let T be a tree. Then T has no cycles. Thus T is chordal, since
it has no induced cycles of length more than three. Any chordal embedding
of T has a clique number at least equal to the clique number of T . Therefore,
0 if T has only one vertex
tw(T ) = (5.6)
1 if T has at least two vertices.
Thus any nontrivial tree has treewidth one. This explains why we sub-
tract one from ω(H) in Definition 5.12. Namely, in this way we have that any
nontrivial tree has treewidth one, which is nice. In the following example we
show the converse, that is, if the treewidth of a graph G is at most one then
G is a forest.
Recall Theorem 3.60 on page 68. Since H is chordal it has a perfect elimi-
nation ordering, say
[x1 , . . . , xn ].
By Theorem 3.66 on page 71, every maximal clique in H is one of the sets
Thus the perfect elimination ordering removes vertices one by one, and at
each step the vertex has at most one neighbor in the remaining graph. But
this shows that H is a forest! Since C is a subgraph of H, also C is a forest,
which is a contradiction because C is a cycle. Thus the treewidth of C is at
least two.
In the following theorem we prove that the class of graphs with treewidth
at most k is closed under taking minors. For k = 1 this is true, since the class
of graphs with treewidth at most one is the class of all forests.
tw(G0 ) 6 tw(G).
Lemma 5.13 shows that the class of graphs with treewidth at most k is
closed under taking subgraphs. To prove that this class is also closed under
edge contractions, we prove this first for the class of chordal graphs.
By the way, of course the class of chordal graphs is not closed under mi-
nors, since it is not even closed under taking subgraphs. Every graph is a
subgraph (and thus also a minor) of a large enough clique!
5.3 Treewidth 131
Lemma 5.14. The class of chordal graphs is closed under edge contractions.
Txy = Tx ∪ Ty . (5.8)
Lemma 5.15. Let G = (V, E) be a chordal graph and let e = {x, y} be an edge
in G. Let G0 be the graph obtained from G by contracting the edge e to a single
vertex xy. Then
ω(G0 ) 6 ω(G). (5.9)
Theorem 5.16. Let k ∈ N ∪ {0}. Let T(k) be the class of graphs G with
tw(G) 6 k.
Then T(k) is minor closed.
Proof. Let G = (V, E) be a graph and assume that tw(G) 6 k. Let G0 be a
minor of G. We prove that tw(G0 ) 6 k.
When G0 is a subgraph of G then the claim follows from Lemma 5.13.
Let e = {x, y} be an edge in G. Assume that G0 is obtained from G by contract-
ing the edge e to a single vertex xy.
By definition, there exists a chordal embedding H of G with ω(H) = k + 1.
Since H is a chordal embedding of G, e is also an edge in H.
By Lemma 5.14 the graph H0 , obtained from H by contracting the edge e in H
to a single vertex xy, is chordal. Then H0 is a chordal embedding of G0 .
By Lemma 5.15 ω(H0 ) 6 ω(H).
This proves the theorem. t
u
Via the theory on graph minors we immediately obtain the following the-
orem.
Theorem 5.17. The parameterized treewidth problem (tw(G), k), which asks
if a graph G has treewidth at most k, is fixed-parameter tractable. For each
k ∈ N ∪ {0} there exists an O(n3 ) algorithm which checks if the treewidth of a
graph G is at most k.
Proof. By Theorem 5.16 the class T(k) of graphs with treewidth at most k is
minor closed. By Theorem 5.5 there exists a finite obstruction set Ω(k) and,
by Theorem 5.6 we can test for each element H ∈ Ω(k) in O(n3 ) time if it is
a minor of G. Now tw(G) 6 k if and only if none of the graphs in Ω(k) is a
minor of G. t
u
Remark 5.18. The theorem above only shows that there exists an O(n3 ) al-
gorithm which checks if a graph has treewidth at most k. The graph minor
theory does not provide the algorithm since the obstruction set is unknown.
However, for each k ∈ N ∪ {0} there is an explicit linear-time algorithm which
checks if a graph has treewidth at most k.6 7 In Section 5.3.3 we show that
there exists an O(nk+2 ) algorithm which checks if the treewidth of a graph
is at most k. Although this is not a fixed-parameter algorithm, it is useful for
small values of k.
6
T. Kloks, Treewidth - Computations and Approximations, Springer-Verlag, Lecture
Notes in Computer Science 842, 1994.
7
L. Perković and B. Reed, An improved algorithm for finding tree decompositions of
small width, International Journal of Foundations of Computer Science 11 (2000),
pp. 365–371.
5.3 Treewidth 133
Remark 5.19. The obstruction set for the class of graphs with treewidth one
has only one element, namely the triangle. This is so because a graph is a
forest if and only if it has no cycle. Therefore, a graph is a forest if and only if
it has no triangle as a minor. The obstruction set for graphs of treewidth two
also has only one element, namely K4 . The following Figure 5.2 shows the
obstruction set for the class of graphs with treewidth three.8 9 10
Fig. 5.2. The figure shows the obstruction set for treewidth three.
As you see, in the algorithm we use the fact that every graph with
treewidth at most two has a vertex with at most two neighbors. We prove
that in the following lemma. In Exercise 5.18 we ask you to prove a similar
lemma for the graphs with treewidth at most k.
Lemma 5.20. Let G = (V, E) be a graph and assume that tw(G) 6 2. Then
every subgraph of G has a vertex with at most two neighbors.
Proof. By Lemma 5.13 the class of graphs with treewidth at most two is closed
under taking subgraphs. Therefore, it is sufficient to prove the claim for G.
Let H be a chordal embedding of G with ω(H) 6 3. To avoid confusion,
we use the notation NH (x) to denote the neighborhood of a vertex x in the
chordal graph H.
By Theorem 3.60 on Page 68 there exists a perfect elimination ordering for H,
say
σ = [x1 , . . . , xn ].
The vertex x1 is a simplicial vertex in H and so its neighborhood is a clique.
Since ω(H) 6 3 we have that |NH (x1 )| 6 2, and so x1 has at most two
neighbors in H. Because H is a chordal embedding of G we have that
NG (x1 ) ⊆ NH (x1 ),
Theorem 5.21. There exists an O(n) algorithm which checks if the treewidth of
a graph G is at most two.
Proof. By Lemma 5.20, if G has n vertices and more than 2n edges then
tw(G) > 2. Assume that G has at most 2n edges. Then we can compute
the degree of every vertex x in O(n) time. This shows that the algorithm that
we described can be implemented to run in O(n) time.
Let x be a vertex with at most two neighbors.
First assume that x is isolated. Let G0 = G − x. By Lemma 5.13, if tw(G0 ) > 2
then also tw(G) > 2. Assume that tw(G0 ) 6 2. Let H0 be a chordal embedding
for G0 with ω(H0 ) 6 3. Add the vertex x as an isolated vertex to H0 and let H
be this graph. Then H is a chordal embedding of G and ω(H) 6 2.
Assume that x has one neighbor, say y. Let G0 = G − x. If tw(G0 ) > 2, then
also tw(G) > 2. Assume tw(G0 ) 6 2 and let H0 be a chordal embedding of G0
with ω(H0 ) 6 3. Add the vertex x to H0 and make it adjacent to y. Let H be
this graph. Then H is a chordal embedding of G and ω(H) 6 3.
Assume that x has two neighbors, y and z, and assume that y and z are
adjacent. Let G0 = G−x. If tw(G0 ) > 2 then tw(G) > 2 and so we may assume
that tw(G0 ) 6 2. Let H0 be a chordal embedding of G0 with ω(H0 ) 6 3. Let
σ0 = [x2 , . . . , xn ]
be a perfect elimination ordering for H0 . Let H be the graph obtained from H0
by adding the vertex x to H0 and by making x adjacent to y and z. Consider
σ = [x, x2 , . . . , xn ].
Since x is adjacent to y and z and since {y, z} is an edge in H, the vertex x is a
simplicial vertex in H. This proves that σ is a perfect elimination ordering for
H. Thus, H is a chordal embedding for G and ω(H) 6 2.
Finally, assume that x has exactly two neighbors, say y and z, and assume that
y and z are not adjacent. Let G0 be the graph obtained from G by adding the
edge {y, z} and by removing the vertex x. We claim that G0 is a minor of G. To
see that, observe that contracting the edge {x, y} in G produces the graph G0 .
By Theorem 5.16, if tw(G0 ) > 2 then tw(G) > 2. Assume that tw(G0 ) 6 2
and let H0 be a chordal embedding of G0 with ω(H0 ) 6 3. Notice that {y, z} is
an edge in H0 . Add the vertex x as a simplicial to H0 , by making it adjacent to
y and z. Then H is a chordal embedding of G and ω(H) 6 3.
This proves the theorem. t
u
5.3.2 k-Trees
When a graph G has treewidth k then it has an embedding into a chordal
graph H with clique number k + 1. In this section we show that there is a
special chordal graph embedding for G.
136 5 Decomposition Trees
Theorem 5.23. Let G be a graph and let k = tw(G). Then there exists an em-
bedding of G into a k-tree.
σ = [x1 , . . . , xn ].
{ xi+1 , . . . , xn }.
Ni = NH (xi ) ∩ { xi+1 , . . . , xn }.
H0i = H0 [{ xi+1 , . . . , xn }]
Recall Theorem 3.56 on Page 66 which says that a graph is chordal if and
only if every minimal separator is a clique.
Lemma 5.24. Let G = (V, E) be a chordal graph and let S be a minimal sepa-
rator in G. Let C be a component of G − S. Then C contains a vertex x such that
x is simplicial in G.
Proof. Consider the graph G[S∪C]. Since the class of chordal graphs is heredi-
tary, this induced subgraph is chordal. If G[S ∪ C] is a clique then we are done.
In that case every vertex x ∈ C is simplicial since N(x) ⊆ S ∪ C and so N(x) is
a clique.
Otherwise, there are two nonadjacent vertices a and b in G[S ∪ C]. Let S0 be
a minimal a, b-separator in G[S ∪ C]. We claim that S0 is also a minimal a, b-
separator in G. To see this, assume that there exists an a, b-path P in G − S0 .
Then P must contain at least one vertex which is not in S ∪ C. But then P
contains two vertices from S, and so P has a shortcut. This proves the claim.
Consider the components of G − S0 . Let Ca and Cb be the components of
G − S0 which contain a and b, respectively. Since S is a clique, the set S \ S0
can have vertices in at most one of Ca and Cb . Assume that Ca contains no
vertices from S. Then Ca ⊆ C.
Assume that S0 ⊆ S. Then Ca = C, b ∈ S and |S0 | < |S|. In that case we can
remove vertices of S that have no neighbors in C. By induction there exists a
vertex in Ca which is simplicial in G.
Otherwise, when S0 has at least one vertex of C, then |Ca | < |C|. By induction
Ca contains a vertex x which is simplicial in G. t
u
11
S. Arnborg, D. Corneil and A. Proskurowski, Complexity of finding embeddings in a
k-tree, SIAM Journal on Algebraic and Discrete Methods 8 (1987), pp. 277–284.
138 5 Decomposition Trees
Theorem 5.26. Let G be a graph and let k ∈ N ∪ {0}. There exists an O(nk+2 )
algorithm which checks if the treewidth of G is at most k.
Proof. When G has at most k + 1 vertices then tw(G) 6 k. In that case the
algorithm makes a clique of G and it reports YES. Otherwise, if G has more
than k + 1 vertices, by Theorem 5.23 the graph has tw(G) 6 k if and only if G
has a k-tree embedding. The algorithm that we describe below finds a k-tree
embedding H if tw(G) 6 k.
The algorithm first makes a list of all pairs (S, C) where
(i) S is a separator in G and |S| = k, and
(ii) C is a component of G − S.
Notice that G has at most nk separators S of cardinality k. The number of
components in G − S is at most n for each separator S, so the list contains at
most nk+1 pairs (S, C).
For a pair (S, C) let G∗ (S, C) be the graph obtained from G[S ∪ C] by making
a clique of S.
The algorithm checks if there exists a separator S with |S| = k, such that for
each component C of G − S, G∗ (S, C) has a k-tree embedding. If that is the
case, then the treewidth of G is at most k, and otherwise the treewidth of G
is more than k.
First, the algorithm sorts the pairs (S, C) according to nondecreasing cardi-
nalities |C|. It does that by bucket sort in time O(nk+1 ). It processes the pairs
(S, C) in that order as follows.
When there is a k-tree embedding of G∗ (S, C) then, by Lemma 5.24, there
is a perfect elimination ordering that eliminates the vertices of C first. Let
c ∈ C be the last vertex in this elimination ordering. Then c is adjacent to all
vertices of S in the k-tree embedding. The algorithm tries all vertices c ∈ C as
candidates.
5.3 Treewidth 139
S(c) = S ∪ {c}.
G[C \ S(c)].
For each i ∈ {1, . . . , t} check if there exists a separator Si (c) such that
(i) { y | y has a neighbor in Ci (c) } ⊆ Si (c), and
(ii) |Si (c)| = k, and
(iii) (Si (c), Ci (c)) is a YES instance, that is, there exists a k-tree embedding
of G∗ (Si (c), Ci (c)).
We claim that the pair (S, C) can be processed in O(|C|2 ) time. Notice that a
k-tree has O(kn) edges, which is O(n) since k is fixed. Thus for each choice
of c ∈ C the components Ci (c) can be determined in O(|C|) time (see Exer-
cise 5.18). Since C is connected, the vertex c has a neighbor in each compo-
nent Ci (c). There are |C| choices for c and O(k) candidates for the separators
Si (c) because
c ∈ Si (c) and |S \ Si (c)| = 1.
For each component Ci (c) it can be checked if there is a suitable separator
Si (c) (which reports YES) in constant time. This proves the claim.
Notice that this shows that the overall time complexity of the algorithm is
bounded by O(nk+2 ), since there are O(nk ) separators S of cardinality k and
the summation of |C|2 over all components C of G − S is bounded by O(n2 ).
If there exist a vertex c ∈ C and a collection of separators Si (c) such that
the answer is YES for all G∗ (Si (c), Ci (c)) then the algorithm answers YES for
G∗ (S, C). Otherwise, it answers NO for G∗ (S, C).
If there exists a separator S with |S| = k such that for all components C of
G − S the algorithm above reports a YES for the pair (S, C), then the treewidth
of G is at most k. Otherwise the treewidth is more than k. t
u
For the clique number problem there is an easier algorithm, that we de-
scribe below.
Let k ∈ N ∪ {0} and let G be a graph with treewidth at most k. Then there
exists a chordal embedding H of G with ω(H) 6 k + 1. We mentioned that
there exists a linear-time algorithm to construct the graph H, although we did
not give you the details of this algorithm.
Proof. Let G = (V, E) be a graph and assume that tw(G) 6 k. We assume that
we have a chordal embedding H of G with ω(H) 6 k + 1.
Obviously, if M is a maximal clique in G then M is a clique in H. Let M be the
set of all maximal cliques in H. Then
By Lemma 3.61 on Page 68, H has at most n maximal cliques, where n is the
number of vertices of H.
Let
σ = [x1 , . . . , xn ] (5.13)
be a perfect elimination ordering for H. This can be obtained in linear time by
the algorithm of Tarjan and Yannakakis. Notice that H has at most n · k edges,
and so this algorithm runs in O(n · k) = O(n) time, since k is a constant.
Define
Ni = { xj | j > i and xj ∈ N[xi ] }. (5.14)
Theorem 5.28. Let k ∈ N ∪ {0}. There exists a linear-time algorithm that com-
putes χ(G) for graphs G ∈ T(k).
Proof. Let k ∈ N ∪ {0} and let G = (V, E) be a graph in T(k). There exists
a linear-time algorithm which computes a chordal embedding H of G with
ω(H) 6 k + 1. Since H is perfect χ(H) 6 k + 1 and so, since G is a subgraph
of H also χ(G) 6 k + 1.
Consider a clique tree (T , S) for H. For a vertex p in T let Sp ∈ S be the
maximal clique of H that is assigned to p.
Root T at some arbitrary vertex r. For a vertex p in T let Tp be the subtree of
T which is rooted at p. Thus Tr = T .
For a vertex p in T let
P = { Q1 , . . . , Q` }
x ∈ Si \ Sp and y ∈ Sj \ Sp
are adjacent when i 6= j. (This follows from Definition 3.62 on Page 68 of the
clique tree.)
Let P = {Q1 , . . . , Q` } be a valid partition of Sp . Then bp (P, `) is TRUE if and
only if for each child ci of p there exists a valid partition P0 = {Q01 , . . . , Q0` }
such that
(i) bci (P0 , `) is TRUE, and
(ii) if Q0j ∈ P0 then
Q0j ∩ Sp ⊆ Qj .
The graph G has a coloring with ` colors if and only if there exists a valid
partition P with ` color classes at the root r, such that br (P, `) is TRUE.
This proves the theorem. t
u
As an example of what’s in the magic box, openened by the Finite Basis The-
orem 5.5 and the Minor Test Theorem 5.6, we look at the problem to find k
vertex-disjoint cycles.
(cp(G), k)
Proof. Let H be the graph which is the union of k triangles. We claim that a
graph G has k vertex-disjoint cycles if and only if H is a minor of G.
First assume that G has k vertex-disjoint cycles, C1 , . . . , Ck . Remove all ver-
tices and edges from G except those vertices that appear in the cycles and
except those edges that connect consecutive vertices in one of the cycles.
5.3 Treewidth 143
Now contract edges in the cycles such that each cycle becomes a triangle.
This proves that H is a minor of G.
Now assume that H is a minor of G. Let {h1 , . . . , h3k } be the set of vertices of
H. By the alternative definition of a minor, (see Figure 5.1 on page 125) there
exist a collection of disjoint sets of vertices V1 , . . . , V3k , one for each vertex
in H, such that each G[Vi ] is connected, and such that there is an edge in G
between some vertex in Vi and some vertex in Vj whenever hi is adjacent to
hj in H.
Consider a triangle {h1 , h2 , h3 } in H. Let x1 ∈ V1 and x2 ∈ V1 be two vertices
in V1 which are adjacent to some vertex in V2 and V3 , respectively. Since
G[V1 ] is connected, there is a path P1 in G[V1 ] that connects x1 and x2 . In the
same manner we find paths P2 and P3 in G[V2 ] and G[V3 ] such that the union
P1 ∪ P2 ∪ P3 contains a cycle. Since all sets Vi are vertex-disjoint, this gives a
collection of k vertex-disjoint cycles in G.
Thus, an algorithm to check if G has k vertex-disjoint cycles only needs to test
if H is a minor of G. By Theorem 5.6 on page 126 this can be done on O(n3 )
time. t
u
In the rest of this section we show that the time complexity for solving the
parameterized problem (cp(G), k) can be reduced to linear time.
f:N→N
such that if a graph G has treewidth at least f(k) then G contains a wall of
height k as a subgraph.
5
Remark 5.31. The best-known upperbound for f(k) in Theorem 5.30 is 202k .
12
N. Robertson and P. Seymour, Graph minors. V. Excluding a planar graph, Journal
of Combinatorial Theory, Series B 41 (1986), pp. 92–114.
144 5 Decomposition Trees
r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r r
r r r r r r r r r r r r r r r r r
Theorem 5.32. For each constant k there exists a linear-time algorithm which
checks if a graph has k vertex-disjoint cycles.
Proof (Sketch). Let k ∈ N. We can check in linear time whether the treewidth
of G is at most f(2k) (or, whether it is at most the known upperbound for
f(2k)). If the treewidth is more than f(2k) then, by Theorem 5.30, G con-
tains a wall of height 2k. In that case G has at least k2 disjoint cycles. (See
Remark 5.33 below to see how these cycles can be found in linear time.)
Otherwise, when the treewidth of G is at most f(2k) then one can find the
maximum number of vertex-disjoint cycles in G by standard dynamic pro-
gramming techniques on the tree decomposition of G (that is, the clique tree
of the chordal embedding of G). t
u
Remark 5.33. Assume that the treewidth of a graph G is more than k for some
k ∈ N. Perković and Reed show that there is a linear-time algorithm which
computes a subgraph G0 with treewidth more than k but at most 2k.13
When the treewidth of G is more than f(2k), one can construct the tree
decomposition of a subgraph G0 of G with treewidth more than f(2k) but at
most 2 · f(2k). Then G0 has a wall of height 2k. Since the treewidth of G0 is
bounded by the constant 2 · f(2k) one can construct this wall in linear time
by dynamic programming on the tree decomposition of G0 . This observation
shows that the collection of k vertex disjoint cycles in G can be found in linear
time (if it exists).
13
L. Perković and B. Reed, An improved algorithm for finding tree decompositions of
small width, International Journal of Foundations of Computer Science 11 (2000),
pp. 365–371.
5.4 Pathwidth 145
5.4 Pathwidth
Pathwidth is a graph parameter which is closely related to treewidth. One can
see that right away from the definition.
Proof. If T has only one vertex then, by definition, pw(T ) = 0 since ω(T ) = 1.
Assume that T is a caterpillar with at least two vertices. Then pw(T ) > 1 since
T is a chordal graph and
pw(T ) > tw(T ) = 1. (5.20)
Notice that a caterpillar has no asteroidal triple. Therefore, by Theorem 3.77
on page 76 T is an interval graph. This proves that pw(T ) = 1. t
u
146 5 Decomposition Trees
Theorem 5.38. A graph G has pathwidth one if and only if every component of
G is a caterpillar and at least one component has at least two vertices.
Proof. When G has pathwidth one then its treewidth is also one. Therefore,
G is a tree with at least two vertices. If G is not a caterpillar then it has
an asteroidal triple. We claim that any interval embedding of G has clique
number at least three.
We may assume that G is connected and that G has at least two vertices. Let
H be an interval embedding of G and assume that ω(H) = 2. Then H = G,
since adding any edge to G creates a cycle and the treewidth of a cycle is two.
Since H is an interval graph it has no asteroidal triple. This implies that H is
a caterpillar (see Exercise 5.20). t
u
We know that every cycle C has treewidth two. However, not every chordal
embedding of a cycle is an interval graph. For example, a C6 has a chordal
embedding which has an asteroidal triple. However, consider the following
chordal embedding of C. Take any vertex of C and make it adjacent to all
other vertices. Then this is a chordal embedding without any asteroidal triple,
and so it is an interval embedding with clique number three. This shows that
the pathwidth of cycles is two (see Figure 5.5).
u u u u
HH @ @
H
HH@ @
u @u
H u @u
@ @
@ @
@u
u @u
u
Fig. 5.5. This figure shows a 3-sun, which is a triangulation of C6 which has an as-
teroidal triple. The graph on the right is a triangulation of C6 which is an interval
graph.
We want to prove that, for any integer k, the class of graphs with path-
width at most k is closed under taking minors. For k = 1 this is true, since
any minor of a caterpillar is a caterpillar. To prove the general result, we fol-
low the same trajectory as for treewidth. Let’s start with the following easy
lemma.
5.4 Pathwidth 147
V0 ⊆ V and E0 ⊆ E. (5.22)
pw(G) = ω(H) − 1.
Then H[V 0 ] is an interval graph, since the class of interval graphs is closed
under taking induced subgraph. We claim that H[V 0 ] is an interval embedding
of G0 . Let e = {x, y} be an edge of G0 . Then x and y are both vertices of V 0 and
{x, y} ∈ E. Therefore, {x, y} is an edge of H[V 0 ].
Obviously,
ω(H[V 0 ]) 6 ω(H) = pw(G) + 1. (5.23)
This proves the lemma. t
u
Lemma 5.40. The class of interval graphs is closed under edge contractions.
Following the same path as we did in Section 5.3 we have one more step
to go.
148 5 Decomposition Trees
Lemma 5.41. Let G be an interval graph. Let e = {x, y} be an edge in G and let
G0 be the interval graph obtained from G by contracting the edge {x, y}. Then
Proof. The proof of this lemma is the same as the proof of Lemma 5.15 on
page 131. In that lemma we showed that the clique number of a chordal
graph does not increase under edge contractions. Since interval graphs are
chordal, we are done. t
u
In the following theorem we show that the class of graphs with pathwidth
at most k is closed under taking minors.
Remark 5.43. By Theorem 5.5 on page 125, for any k ∈ N ∪ {0}, the class
of graphs with pathwidth at most k is characterized by a finite collection
of forbidden minors. For k = 1 this set consists of two graphs, the triangle
and the smallest tree which has an asteroidal triple (see Figure 5.6). The
obstruction set for graphs with pathwidth two is also known. It contains 110
graphs.14
14
N. Kinnersley and M. Langston, Obstruction set isolation for the gate matrix layout
problem, Discrete Applied Mathematics 54 (1994), pp. 169–213.
5.4 Pathwidth 149
u
u
J u
J
u Ju u
@
u @u
@
u @u
(pw(G), k)
Theorem 5.47 (Kloks, Möhring). Let G be an AT-free graph. Then every mini-
mal chordal embedding of G is an interval graph. Consequently,
Remark 5.48. There exists an elegant O(n3 ) algorithm which computes the
treewidth of circle graphs.17 When the graph is a permutation graph it is
AT-free and then this algorithm computes the pathwidth. However, for per-
mutation graphs there is also a linear-time algorithm which computes the
pathwidth.
5.5 Rankwidth
For each edge {p, c} in T where c is the child of p, let We be the set of
vertices of G that are mapped to leaves in the subtree of c. The twinset Qe is
the subset of We that have neighbors in V \ We .
17
T. Kloks, Treewidth of circle graphs, International Journal of Foundations of Com-
puter Science 7 (1996), pp. 111–120.
5.5 Rankwidth 151
The binary field GF[2] has two elements, 0 and 1. In this field we can add
elements and multiply elements. The addition in the field GF[2] is defined by
the following rules.
Column vectors with entries in GF[2] can be added by using the addition
rules of GF[2] entrywise. The multiplication of a vector with a scalar α ∈ {0, 1}
is done entrywise, with the rules for multiplication of GF[2].
The rank of a matrix over GF[2] is the maximal number of linearly indepen-
dent columns.
152 5 Decomposition Trees
Since we are only interested in matrices that have small rank, the follow-
ing observation is useful. It shows that, we can avoid the Gaussian elimination
and instead just look at the number of different rows or columns.
Lemma 5.50. Let A be a matrix and let k be its rank over GF[2]. Then A has at
most 2k different columns.
Proof. Since the rank over GF[2] of A is k there is a basis {a1 , . . . , ak }. Then
every column c of A can be written as a linear combination,
c = α1 · a1 + · · · + αk · ak .
The scalars αi ∈ {0, 1}, for all i ∈ {1, . . . , k}. There are at most 2k different
linear combinations and so there are at most 2k different columns in A. t
u
Lemma 5.51. Let G be a graph with rankwidth k. Then the rankwidth of its
complement Ḡ is at most k + 1.
Proof. Let (T , f) be a decomposition tree for G such that the rank over GF[2]
of every edge in T is at most k.
For Ḡ we use the same decomposition tree. We write J for the all-one matrix.
Each cutmatrix Ce changes to J + Ce , which switches the zeroes and ones in
Ce into ones and zeroes.
Since the rank over GF[2] of Ce is k, there is a basis {a1 , . . . , ak } for the
column space of Ce . Then every column of J + Ce can be written as
j + c = j + α1 · a1 + · · · + αk · ak ,
where j is the all-one vector. This shows that the dimension of the columns
space of J + Ce is at most k + 1. Here we use the linear algebra property
that {j, a1 , . . . , ak } contains a basis for the columns of J + Ce , with a minimal
number of elements. t
u
5.5 Rankwidth 153
where the single row represents a. The first set of columns, those with a 1,
are the neighbors of a and the final set of columns, those with a 0, are the
nonneighbors of a. Thus in any decomposition tree, the cutmatrix of an edge
which is incident with a leaf, has the desired shape.
This proves the lemma. t
u
154 5 Decomposition Trees
Remark 5.53. Notice that the class R(k) is closed under creating twins.
In the same manner as in the proof of Lemma 5.52 one can show that
every cutmatrix in the decomposition tree of a distance-hereditary graph, has
a shape
J0
.
00
We ask you to prove that in Exercise 5.21.
We have seen in Theorem 5.16 that the class T(k) of graphs with treewidth
at most k is closed under taking minors. As a consequence, this class of graphs
is characterized by a finite obstruction set.
Unfortunately, this is not true for the class R(k) of graphs with rankwidth
at most k. For example, consider a clique with 5 vertices. This graph has
rankwidth one (it is a cograph). Now remove edges such that a 5-cycle re-
mains. The 5-cycle is not distance-hereditary; its rankwidth is two. Thus the
5-cycle is a minor of the 5-clique but the rankwidth of the 5-cycle is bigger
than the rankwidth of the 5-clique. Actually, this example shows that the class
R(k) is not even closed under taking subgraphs.
Local Complementation.
In Exercise 5.22 we ask you to prove that R(k) is closed under taking
vertex-minors.
G1 , G2 , . . . (5.30)
be an infinite sequence of graphs in R(k). There exist indices i < j such that Gi
is a vertex-minor of Gj .
6k+1 − 1
5
vertices.
This finite obstruction set for R(k) leads to a polynomial recognition algo-
rithm. However, this is non-constructive since the obstruction set is unknown.
Furthermore, the timebound for this algorithm is much worse than the con-
structive O(n3 ) algorithm by Hliněný and Oum, mentioned above. When H
is a fixed graph, then checking if a graph G contains H as a vertex-minor is
quite complicated.
First we show that the property that a graph is connected can be formu-
lated in this logic. A graph is disconnected if the vertex set V has a partition
{V1 , V2 } such that there is no edge between a vertex in V1 and a vertex in V2 .
Note that this property can be formulated in monadic second-order logic.
Next we show that we can formulate the property that a graph has no
induced cycle of length more than three in this logic. A graph has an induced
cycle of length at least four if there exist three vertices w, w1 , and w2 such
that w is adjacent to w1 and w2 , and w1 and w2 are not adjacent, and such
that the following holds. Let
V 0 = (V \ N[w]) ∪ {w1 , w2 }.
Checking for a triangle is easy and so, one can formulate the property that
a graph is a forest in monadic second-order logic. Finally, the fact that a subset
F is a feedback vertex set can be formulated by stating that V \ F induces a
forest.
Another easy example is this. Fix some graph H. Then one can formulate in
monadic second-order logic if a graph G contains H as an induced subgraph.
One more example. It is only a little bit more complicated to show that for
every graph H there is a monadic second-order formula that expresses that a
graph G contains H as a minor. We leave it as an exercise.19
Let k ∈ N ∪ {0} and let Ω(k) be the finite obstruction set for T(k). Then
one can formulate the question if the treewidth of a graph G is at most k
by a finite monadic second-order formula. Namely, write down the monadic
second order formula which checks if some H ∈ Ω(k) is a minor of G.
Theorem 5.57. Let k ∈ N∪{0}. Any problem that can be formulated in monadic
second-order logic can be solved in linear time for graphs in T(k).
A restricted form of this logic is where one does not allow quantification
over subsets of edges.
Remark 5.58. Notice the difference. One can formulate that a graph is Hamil-
tonian by expressing this as the existence of a suitable subset of the edges.
However, this formulation is not valid in C2 MS-logic.
The class of graphs that have rankwidth at most k is much larger than the
class of graphs with treewidth at most k. (There exists a function
f:N→N
such that if a graph has treewidth at most k then its rankwidth is at most
f(k). The converse is of course not true; any clique has rankwidth one, but its
treewidth is the number of vertices minus one.) The set of problems that can
be solved in polynomial time for graphs of bounded rankwidth is consequently
a bit smaller. For example, the Hamiltonian cycle problem can be formulated
in monadic second-order logic but not in C2 MS-logic.
Theorem 5.59. Let k ∈ N ∪ {0}. Any problem that can be formulated in C2 MS-
logic can be solved in O(n3 ) time for graphs in R(k). When a decomposition tree
for the graph is a part of the input, then these algorithms run in linear time.
5.7 Problems
5.1. Consider an infinite sequence of trees
T1 , T 2 , . . . (5.31)
Let denote the induced subgraph relation. Is it true that for any sequence
of trees, as in (5.31) there always exist integers i < j such that Ti Tj ?
Hint: Consider a sequence of paths P1 , P2 , . . . In each path Pi , say with ends
ai and bi , add two leaves, a∗i and b∗i . Make a∗i adjacent to N(ai ) and make
b∗i adjacent to N(bi ) (in other words; create a twin of each end).
5.2. Prove the alternative definition of a minor, which appears after Defini-
tion 5.3.
5.3. Prove that, for two trees T1 and T2 , if T1 m T2 then there exists a se-
quence of edge contractions in T2 that produces T1 .
5.4. Check that the class of all planar graphs is closed under taking minors.
5.6. A graph is outerplanar if it has a plane embedding such that all vertices
are on the outerface. Let O be the class of outerplanar graphs.
(i) Prove that O is closed under taking minors.
(ii) Prove that a graph is outerplanar if and only if it has no K4 nor K2,3 as a
minor. Thus the obstruction set for O is
Ω = { K4 , K2,3 }.
5.8. Consider the class of graphs that you can draw on the surface of a torus
(that is a donut) without crossing lines. The graphs in this class are called
toroidal. Show that this class of graphs is minor closed.
The obstruction set is finite, but it seems that it contains at least 16000 ele-
ments. Can you think of one element?
5.7 Problems 159
Hint: It is not difficult to show that you can draw K5 on a torus. Also, K6 and
K7 are toroidal. In general, if you can draw a graph G in the plane with at
most one crossing then G is toroidal. Toroidal graphs have chromatic number
at most 7; thus K8 is not toroidal.
5.9. Show that K3,3 is a minor of the Petersen graph.
5.10. Let k ∈ N ∪ {0}. Let C(k) be the class of graphs G that have at most k
vertex-disjoint cycles.
(i) Show that C(k) is closed under taking minors.
(ii) What is the obstruction set Ω(k)?
Hint: Consider the graph Q which is the union of k + 1 triangles. Prove
that Ω(k) = {Q}.
(iii) Let G(k) be the class of graphs that have a feedback vertex set with at
most k vertices. Show that G(k) ⊆ C(k). Can you think of a graph that is
in C(k) but not in G(k)?
Hint: Consider the 5-wheel, that is, a 5-cycle plus one vertex adjacent
to all vertices in the cycle. How many vertex-disjoint cycles are there in
the 5-wheel? What is the minimal cardinality of a feedback vertex set?
5.11. Let k ∈ N ∪ {0}. Let K(k) be the class of graphs that have a vertex cover
with at most k vertices.
(a) Show that K(k) is closed under taking minors.
(b) Consider the graph H which is the union of k + 1 edges. Then H ∈/ K(k).
(c) Can you think of another graph than H which is in the obstruction set of
K(k)?
5.12. Let k ∈ N ∪ {0}. Let D(k) be the class of graphs G = (V, E) for which
there is a subset D of vertices with |D| 6 k such that every vertex of G − D
has degree at most two in G − D.
(1) Show that D(k) is minor closed.
(2) Show that there exists an O(n3 ) algorithm to check if G ∈ D(k).
5.13. Let T be a tree and let
{ Tx | x ∈ V } (5.32)
5.16. Let G be a chordal graph. Prove that if G is not a clique then it has two
simplicial vertices that are not adjacent.
Hint: Use Lemma 5.24.
5.17. Let G be a k-tree. Prove that every minimal separator in G is the inter-
section of two maximal cliques of cardinality k + 1.
5.18. Let G be a graph and let k = tw(G). Prove that every induced subgraph
of G has a vertex with at most k neighbors.
5.22. Let k > 1. Prove that the class R(k) of graphs of rankwidth at most k is
closed under taking vertex-minors.
24
J. Gramm, J. Guo, F. Hüffner and R. Niedermeier, Data reduction, exact, and heuris-
tic algorithms for clique cover, proceedings 8th ALENEX06, SIAM (2006), pp. 86–94.
5.7 Problems 161
5.24. Consider the following class G of graphs G for which there is a color-
ing of the vertices with colors black and white, such that for every induced
subgraph H of G, one of the following holds.
(i) H has one vertex (either black or white).
(ii) There exists a partition {V1 , V2 } of the vertices of H such that either
(a) every vertex x of V1 is adjacent to all vertices of V2 that have the
same color as x, or
(b) every vertex x of V1 is adjacent to all vertices of V2 that have the
opposite color of x.
(1) Prove that the graphs in G have rankwidth at most two.
(2) Prove that there exists a polynomial-time algorithm to check if a graph G
is in G.
5.25. Let k ∈ N ∪ {0}. Prove that the chromatic number problem can be solved
in linear time on graphs with treewidth at most k by showing that the problem
can be formulated in monadic second-order logic.
Hint: Use the result of Exercise 5.14, that is,
5.26. Prove that the domatic partition problem can be solved in linear time
on graphs of bounded treewidth.
Hint: First prove that the domatic number of a graph G ∈ T(k) is bounded
by k + 1.
References