Short Cycles Make W-Hard Problems Hard: FPT Algorithms For W-Hard Problems in Graphs With No Short Cycles
Short Cycles Make W-Hard Problems Hard: FPT Algorithms For W-Hard Problems in Graphs With No Short Cycles
Abstract. We show that several problems that are hard for various
parameterized complexity classes on general graphs, become fixed pa-
rameter tractable on graphs with no small cycles.
More specifically, we give fixed parameter tractable algorithms for Domi-
nating Set, t-Vertex Cover (where we need to cover at least t edges)
and several of their variants on graphs with girth at least five. These
problems are known to be W [i]-hard for some i ≥ 1 in general graphs.
We also show that the Dominating Set problem is W [2]-hard for bipartite
graphs and hence for triangle free graphs.
In the case of Independent Set and several of its variants, we show these
problems to be fixed parameter tractable even in triangle free graphs.
In contrast, we show that the Dense Subgraph problem where one is
interested in finding an induced subgraph on k vertices having at least
l edges, paramaterized by k, is W [1]-hard even on graphs with girth at
least six.
Finally, we give an O(log p) ratio approximation algorithm for the Dom-
inating Set problem for graphs with girth at least 5, where p is the size
of an optimum dominating set of the graph. This improves the previous
O(log n) factor approximation algorithm for the problem, where n is the
number of vertices of the input graph.
1 Introduction
problems we consider in this paper, is the solution size), the goal here
is to design an algorithm with runtime f (k)nO(1) where f is a function
of k alone, as contrasted with a trivial nk+O(1) algorithm. Problems hav-
ing such an algorithm is said to be fixed parameter tractable (FPT),
and such algorithms are practical when small parameters cover practical
ranges. The book by Downey and Fellows [8] provides a good introduc-
tion to the topic of parameterized complexity. For recent developments
see the books by Flum and Grohe [14] and Niedermeier [17].
There is a hierarchy of intractable parameterized problem classes
above FPT, the main ones are:
In this section we look at the Dominating Set problem and its variants.
edges of the form (u1 , u2 ) for every u ∈ V . Finally, we add an edge from
every vertex in V1 to z2 . This completes the construction of H.
We show that G has a dominating set of size k if and only if H has
a dominating set of size k + 1. Let D be a dominating set of size k in G.
Then clearly D0 = {u1 | u ∈ D} ∪ {z2 } is a dominating set of size k + 1
in H. Conversely, let K be a dominating set in H of size k + 1. Observe
that either z1 or z2 must be part of K as z2 is the unique neighbor of z1 .
Without loss of generality, we can assume that z2 ∈ K, as otherwise we
could delete z1 and include z2 in K and still have a dominating set of size
at most k + 1 in H. Now take D = {u | u ∈ V, u1 or u2 ∈ K}. Clearly
D is of size k. We show that D is a dominating set in G. For any u ∈ / D,
u2 ∈
/ K and hence there exists some v1 ∈ K such that v1 dominates u2 in
H. But this implies v ∈ D and (v, u) ∈ E, which shows that v dominates
u. This proves that D is a dominating set of size k for G and establishes
the theorem. t
u
Since every bipartite graph is also triangle free, we have the following
corollary.
Corollary 1. Dominating Set problem is W [2]-complete in triangle
free graphs.
Now we define the dominating set problem on the graph with vertices
colored with White, Black or Red as above. We call a graph colored red,
white and black as above, as a rwb-graph.
RWB-Dominating Set: Let G be a G5 graph (graph with girth
at least 5) with vertices colored with Red, White or Black satisfying
the following conditions, and let k be a positive integer parameter.
Let R, W and B be the set of vertices colored red, white and black
respectively.
1. Every white vertex is a neighbor of a red vertex.
2. Black vertices have no red neighbors.
3. |R| ≤ k
Does G have at most k − |R| vertices that dominate all the black
vertices?
It is easy to verify that if we start with a general G5 graph with all
vertices colored black, and color all vertices we want to include in the
dominating set as red, and their neighbors as white, the graph we obtain
7
Proof. Let D be a set of size k − |R| that dominates all black vertices
in G, and suppose v ∈ / D. Let X be the set of black neighbors of v
which are not in D and Y be the set of black neighbors of v in D. So
|X| + |Y | > k − |R|. Observe that for every vx ∈ X we have a neighbor
ux ∈ D which is not in Y (otherwise v, vx , ux is a 3 length cycle). Similarly,
for x, y ∈ X, x 6= y ⇒ ux 6= uy . Otherwise v, x, ux , y will form a cycle
of length 4. This means that |D| ≥ |X| + |Y | > k − |R| which is a
contradiction. t
u
Our goal now is to pick enough white or black vertices to dominate the
black vertices. So the following reduction rules are obviously justified.
(R2) If a white vertex is not adjacent to a black vertex, delete the white
vertex.
(R3) If there is an edge between two white vertices, delete the edge.
(R4) If |R| > k, then stop and return NO.
Proof. Let R0 , B 0 and W 0 be the set of vertices colored red, black and
white respectively in G0 . We argue that each of |R0 |, |B 0 | and |W 0 | is
bounded by a function of k.
Because of (R4) (and the fact that G0 is a yes instance), |R0 | ≤ k.
Because of (R1), every vertex colored white or black has at most
k − |R0 | black neighbors. Also we know that no red vertex has a black
neighbor. Since G0 is a yes instance, there are at most k (k − |R0 | to be
more precise) black or white vertices dominating all black vertices. Since
each of them can dominate at most k black vertices, we conclude that
|B 0 | can be at most k 2 .
We argue that |W 0 | ≤ k 3 . Towards this end, we just show that every
black vertex has at most k white neighbors. Since |B 0 | ≤ k 2 , and every
white vertex is adjacent to some black neighbor (because of (R2) and
(R3)), the conclusion will follow.
Note that every white vertex has a red neighbor. Observe that the
white neighbors of any black vertex (any vertex for that matter) will
have all distinct red neighbors. I.e. if w1 and w2 are white neighbors of a
black vertex b, then there is no overlap between the red neighbors of w1
and the red neighbors of w2 . This is because if w1 and w2 have a common
red neighbor r, then we will have a 4-cycle b, w1 , r, w2 , b. Since |R0 | ≤ k,
it follows that a black vertex can have at most k white neighbors.
This proves the required claim. t
u
Proof. It is easy to see that the reduction rules (R1) to (R4) take poly-
nomial time to execute. When none of these rules can be executed, by
9
Proof. Any two vertices in Vred have at most one common neighbor in
Vblue as otherwise there will be a four cycle in G. Hence, the following
reduction rule is justified.
The correctness of (R10 ) follows from the fact that if we do not select x
in D then we need more than k vertices from Vred to dominate N (x) as
any vertex y ∈ Vred , y 6= x, can dominate at most one vertex of N (x).
Hence after exhaustively applying reduction rule (R10 ) if the size of D is
more than k we answer NO.
Remove N [D] from G, i. e., set Vred = Vred \D and Vblue = Vblue \N (D).
Now the degree of every vertex in Vred is at most k and we are looking
for a set of size at most k − |D| in Vred such that it dominates all the
vertices of Vblue . Since every vertex in Vred has degree at most k, the size
of the set Vblue is bounded above by k 2 ((k − |S|)k to be precise) else the
answer is NO. We can not bound the size of the set Vred anymore, as we
do not have any bound on the degree of the vertices in Vblue . So to find
the desired dominating set in Vred (dominating all the vertices in Vblue )
we do as follows:
It is easy to see that there exits a subset of Vred of size at most k − |D|
dominating all vertices of Vblue if and only if there exists a valid partition.
Number of ways in which n indistinguishable objects can be partitioned
n+r−1
into r ways is r−1 [20]. Hence the total number of partitions P con-
Since the total number of partitions is upper bounded by O(k 2k+O(1) ), the
result that Red-Blue Dominating Set is FPT for G5 graphs follows.
t
u
Proof. To solve this problem we just need to solve two instances of Red-
Blue Dominating Set problem. The instances of Red-Blue Domi-
nating Set problem we solve are:
We return YES for CBDS problem if both the instances return YES and
as D1 the red-blue dominating set returned by instance 1 and as D2 the
red-blue dominating set returned by instance 2. If either of the instances
of Red-Blue Dominating Set problem returns NO, then we return NO
for the CBDS problem. t
u
Proof. First we observe that if k < r, then the answer is NO. We assume
that r ≤ log n, as otherwise k ≥ log n and we have a kernel of size at
most 2k . Now we can solve the problem by checking all subsets of size at
most k for the desired threshold dominating set.
Our algorithm is again based on the following simple reduction rule
whose correctness follows from Lemma 1.
(R100 ) if x ∈ V has degree more than k then include x ∈ V 0 .
So basically we select all the vertices of degree more than k of V in V 0
and hence if the size of V 0 is more than k then we answer NO.
Next we assign a color to all the vertices. We assign white color to
all the vertices (including vertices in V 0 ) which have enough (at least r)
neighbors in V 0 and black to the rest. Let B and W , as usual, represent
the set of black and white vertices respectively and set B 0 = B \ V 0
and W 0 = W \ V 0 . Apply reduction rules (R2) and (R3) of Lemma 2
exhaustively. The rule (R3) makes G[W ] an independent set. Now the
problem reduces to finding a set S 0 of size at most k − |V 0 | in V \ V 0 such
that V 0 ∪ S 0 is a desired threshold dominating set for G, in particular for
the vertices of B. Since every vertex in V \ V 0 has degree at most k and
we are looking for S 0 of size at most k in V \ V 0 , the size of |B| is bounded
above by k 2 , as otherwise we answer NO.
Now what we have is a generalized version of Threshold Domi-
nating Set problem where we have a set of j ≤ k 2 black vertices
B = {u1 , · · · , uj }, each with a positive integer ri (ri = r − |N [vi ] ∩ V 0 |),
1 ≤ i ≤ j. We are looking for a set S 0 ⊆ (W 0 ∪ B 0 ) of size at most
k − |V 0 | such that for every ui ∈ B, |N (ui ) ∩ S 0 | ≥ ri in G0 where
the vertex set of G0 is V (G0 ) = B ∪ W 0 and the edge set of G0 is
E(G0 ) = {(u, v) ∈ E | u ∈ W 0 , v ∈ B or u ∈ B, v ∈ B}.
To solve this generalized version of Threshold Dominating Set
problem, we need to generalize our partition arguments used in the The-
orem 5 suitably. The major differences are that G0 is no more bipartite
and that there are vertices which need more than 1 (possibly r) vertices
in the desired threshold dominating set. To overcome this difficulty, we
13
Rule 1: Given a set cover instance, (U, S, k), if there exists Si ∈ S such
that |Si | > ck then obtain a new reduced instance of set cover as
following:
– U ← U − Si .
– S ← {S − Si | S ∈ S}. If there are multiple copies of some set,
then remove all but one copy of the same.
– k ←k−1
problem. The reduction rule also ensures that every set in S is distinct.
But then the number of distinct sets of size at most ck in S can be at
most the number of distinct subsets of U. This gives us that if |U| ≥ 2ck
then
ck ck
cek 2
X |U| |U|
|S| = ≤ ck ≤ ck = ceck k ck+1
i ck ck
i=1
t [6] and are hard for different level of W -hierarchy when parameterized
by k alone. t-Vertex Cover is W [1]-complete [18] and t-Dominating
Set is W [2]-complete when parameterized by k alone.
Here, we first give a simple algorithm for the t-Vertex Cover when
parameterized by both t and k and then show that this problem is FPT
even when parameterized by k alone in G5 graphs. We then extend this
result to the t-Dominating Set problem for G5 graphs when parame-
terized by k alone.
Our algorithms for the t-Vertex Cover depend on the following
lemma.
Lemma 4. Let (G = (V, E), k, t) be a yes instance of the t-Vertex
Cover and v be a vertex of maximum degree in G. Then there ex-
ists a t-vertex cover C whose intersection with N [v] is nonempty, i.e.
N [v] ∩ C 6= ∅.
natural and equally interesting [8, 21]. For example Vertex Cover is
fixed parameter tractable whereas the dual of Vertex Cover is the
Independent Set problem (which is the same as choosing n − k vertices
to cover all edges) and is W[1] complete.
The (m−t)-Vertex Cover problem can also be parameterized in two
ways, by k alone and by k and t. When we have both t and k as parameters
then we solve this problem by branching on an edge e = (u, v). Here we
branch by choosing either the vertex u or the vertex v or e which means
that we are looking for a solution which contains either u or v or does
not cover e. So we get the following branching recurrence:
Proof. Without loss of generality we can assume that the maximum de-
gree of this graph is not bounded by a function of k, otherwise the problem
18
which contradicts that ki=1 |Bi | ≥ k. This in turn proves the claim.
P
Since we branch on the vertices of A whose size is bounded by k + 1,
we get an algorithm of time complexity O((k + 1)k n). t
u
19
Proof. Given any two integers p and q, there exists a number R(p, q) such
that any graph on at least R(p, q) vertices contains an independent set
of size p or a clique of size q. R(p, q), for various values of p andq are
known as Ramsey Numbers. It is well known that R(p, q) ≤ p+q−2 q−1 [20].
And if n > R(p, q) then either an independent set of size p or a clique
of size q can be found in O((p + q)n) time by transforming the inductive
arguments used in the proof of Theorem 27.3 in [20] for the upper bound
of R(p, q) to a constructive algorithm.
If k ≤ 2, then we can check in linear time whether the graph has
an independent set of size 2 or not. So let us assume that k ≥ 3. If the
number of vertices n > k 2 ≥ R(k, 3) then we know that this graph has
either an independent set of size k or a clique of size 3. But since the input
graph is triangle free, we know that it must have an independent set of
size k and can be found in O(kn) time. Otherwise we know that n ≤ k 2 .
In this case, we try all possible subsets of size at most k to see whether
20
the graph has an independent set of size k or not. If any of them does,
then we answer YES and answer NO otherwise. This will take O(k O(k) )
time. This completes the proof. t
u
graphs. Observe that a bipartite graph has an independent set (and hence
planar or acyclic induced subgraph) on n/2 vertices. So, if k ≤ n/2 then
for both these problems the answer is YES and otherwise k > n/2 or
n < 2k and hence we get a kernel of size at most 2k for both the Acyclic
and Planar Subgraph problems for bipartite graphs. Now we check all
k sized subsets of the vertex set to see whether the2ksubset induces an
n
acyclic subgraph or planar subgraph. Since k ≤ k ≤ 2 = 4k , we2k
get an O(4k nO(1) ) time algorithm for both these problems for bipartite
graphs.
Minimum feedback vertex set, which is a subset of vertices whose
removal makes the graph acyclic, is a complement of the vertex set of the
maximum Acyclic Subgraph problem. Fomin et al. [15] have shown
that the minimum feedback vertex set can be found in O(1.7548n ) time
in undirected graphs. So together with this result and the kernel of size
2k we get O(1.75482k nO(1) ) = O(3.0793k nO(1) ) time algorithm for the
Acyclic Subgraph problem. Putting together everything we get the
following theorem.
Theorem 18. The parameterized Acyclic Subgraph and Planar Sub-
graph problems can be solved in O(3.08k k O(1) + nO(1) ) and O(4k k O(1) +
nO(1) ) time, respectively, for bipartite graphs.
Another problem which can be shown to be FPT for Gc graphs for
any fixed constant c ≥ 3 is the Irredundant Set problem, which is
known to be W[1]-complete [9] in general graphs.
Irredundant Set: Given a graph G = (V, E) and a positive
integer k. Is there a set V 0 ⊆ V of cardinality at least k having
the property that each vertex u ∈ V 0 has a private neighbor ? A
private neighbor of a vertex u ∈ V 0 is a vertex u0 ∈ N [u] (possibly
u0 = u) with the property that for every vertex v ∈ V 0 \ {u},
u0 ∈
/ N [v].
This follows from a simple observation that every independent set is also
an irredundant set. Then the following theorem can be proved on the lines
of Theorem 15, by considering the Ramsey Numbers R(k, c).
Theorem 19. Irredundant Set is FPT for Gc graphs for any fixed
constant c ≥ 3.
least 6 (G6 graphs). Observe that in graphs with large girth the Clique
problem is trivial. We look at Dense Subgraph problem [22] which is a
generalization of the Clique problem.
t
. Then the number of edges in G[C 0 ] is:
n2 ≤ 2
k
2 ≤ |E(G[C 0 ])| = 2n2 + n1
2
= k 0 − t + n2
k
=k+ − t + n2
2
k t t
≤k+ −t+ ( since n2 ≤ 2 ).
2 2
From the above it implies that
k t
t+ ≤k+ . (1)
2 2
If t = 1 then
1 k
k+ =k <1+ ,
2 2
a contradiction to inequality (1). So let 2 ≤ t ≤ k − 1. But then
t k−1 k k
k+ ≤k+ = +1< + t,
2 2 2 2
again a contradiction to inequality (1). This implies that |O| = k. As a
result of this, |N | = k2 and every vertex in N has degree 2. Every vertex
of degree 2 in N represents an edge in G[O]. This shows that the vertices
of O form a clique in the original graph. t
u
Hq = qi=1 1/i and OP T is the size of the optimum solution of the set
P
cover instance.
Observe that the reduction rules (R1) − (R4) depend on k whereras here
we have an optimization problem. Hence apply reduction rules for all
values for k between 1 and n and if the reduced instance as viewed as the
Set Cover problem instance satisfies the hypothesis of Proposition 2
then we obtain a dominating set for G by applying Proposition 2. Finally
we return the dominating set of smallest size among the ones obtained
for different k. Our detailed algorithm is described below. We outline our
algorithm in terms of rwb-graphs described in Section 2.2.
Algo-Dom-SET(G=(V,E))
(Input: A G5 graph. Output: A dominating set of G.)
Step 1: Given an undirected graph G = (V, E). Make it a rwb-graph by
coloring all vertices of V black; that is R = ∅, W = ∅ and B = V .
I = ∅.
Step 2: for (j = 1 to n) do as follows:
Step 2a: Apply reduction rules (R1) − (R4) on (G = (R ∪ W ∪
B, E), j) until no longer possible and obtain an instance (Gj =
(Rj ∪ W j ∪ B j , E j ), j − |Rj |).
Step 2b: If (|W j | + |B j | ≤ 2j 3 ) and the maximum degree of Gj is at
most j then
of possible dominating sets for G and return the one with the mini-
mum size in DOM as a dominating set for G.
In this paper we showed that if the input graphs do not possess short
cycles then the neighborhood problems such as Dominating Set, Inde-
pendent Set and several of their variants are fixed parameter tractable.
We have also shown that the restriction on girth is optimal if we do not
put further restriction on the graph classes. This is the first time, to
our knowledge, that the parameterized complexity of graph problems are
classified by girth.
Most of the algorithms given here are just parameterized complexity
classification algorithms. We believe that more efficient FPT algorithms
should be possible. Obtaining a O(ck nO(1) ), c a constant, algorithm for
all these problems remains an open problem.
We also gave an improved approximation algorithm for Dominating
Set problem in graphs with girth at least 5. It would be interesting to
explore the possibility of improved approximation algorithms for other
problems on graphs with no small cycles.
Furthermore, it is worth exploring excluding structures as subgraphs
other than cycles to see whether some W-hard problems become FPT.
References
1. J. Alber, H. L. Bodlaender, H. Fernau, T. Kloks and R. Niedermeier. Fixed pa-
rameter algorithms for Dominating Set and related problems on Planar Graph.
Algorithmica 33 (2002) 461-493.
2. J. Alber, H. Fan, M. R. Fellows, H. Fernau, R. Niedermeier, F. Rosamond and U.
Stege. A refined search tree technique for dominating set on planar graphs. Journal
of Computer and System Sciences 71 (2005) 385-405.
3. J. Alber, M. R. Fellows and R. Niedermeier. Polynomial time data reduction for
dominating Set. Journal of the ACM 51(3) (2004) 363-384.
4. V. E. Alekseev. On easy and hard hereditary classes of graphs with respect to the
Independent Set problem. Discrete Applied Mathematics 132(1-3) (2003) 17-26.
5. V. E. Alekseev, D. V. Korobitsyn and V. V. Lozin. Boundary classes of graphs for
the Dominating Set problem. Discrete Mathematics 285(1-3) (2004) 1-6.
6. M. Bläser. Computing small partial coverings. Information Processing Letters
85(6) (2003) 327-331.
7. R. G. Downey and M. R. Fellows. Threshold Dominating Sets and an improved
characterization of W[2]. Theoretical Computer Science 209(1-2) (1998) 123-140.
28