34
arXiv:1110.4765v1 [cs.DS] 21 Oct 2011 Finding small separators in linear time via treewidth reduction aniel Marx Barry O’Sullivan Igor Razgon § Abstract We present a method for reducing the treewidth of a graph while preserving all of its minimal s t separators up to a certain fixed size k. This technique allows us to solve s t Cut and Multicut problems with various additional restrictions (e.g., the vertices being removed from the graph form an independent set or induce a connected graph) in linear time for every fixed number k of removed vertices. Our results have applications for problems that are not directly defined by separators, but the known solution methods depend on some variant of separation. For example, we can solve similarly restricted generalizations of Bipartization (delete at most k vertices from G to make it bipartite) in almost linear time for every fixed number k of removed vertices. These results answer a number of open questions in the area of parameterized complexity. Furthermore, our technique turns out to be relevant for (H , C, K)- and (H , C, K)-coloring problems as well, which are cardinality constrained variants of the classical H -coloring problem. We make progress in the classification of the parameterized complexity of these problems by identifying new cases that can be solved in almost linear time for every fixed cardinality bound. 1 Introduction Finding cuts and separators is a classical topic in combinatorial optimization and in recent years there has been an increase of interest in the fixed-parameter tractability of such problems [7, 11, 24, 28, 30, 32, 50, 53, 54, 65]. Recall that a problem is fixed-parameter tractable (or FPT) with respect to a parameter k if instances of size n can be solved in time f (k) · n O(1) for some computable function f (k) depending only on the parameter k of the instance [20, 25, 56]. In typical parameterized separation problems, the parameter k is the size of the separator we are looking for, thus fixed-parameter tractability with respect to this parameter means that the combinatorial explosion is restricted to the size of the separator, but otherwise the running time depends polynomially on the size of the graph. The main message of our paper is the following: the small s t separators live in a part of the graph that has bounded treewidth. Therefore, if a separation problem is FPT in bounded treewidth graphs, then it is FPT in general graphs as well. As there are general techniques for obtaining linear-time algorithms for problems on bounded-treewidth graphs (e.g., dynamic programming and Courcelle’s Theorem), it follows that a surprisingly large number of generalized separation problems can be shown to be linear-time FPT with this approach (we say that a problem is linear-time FPT with parameter k if it can be solved in time f (k) · n for some function f ). For example, one of the consequences our general argument is a theorem stating that given a graph G, two terminal vertices s, t , and a parameter k, we can compute in a FPT-time a graph G having the treewidth bounded by a function of k while (roughly speaking) preserving all the inclusionwise minimal s t separators of size at most k. Therefore, combining this theorem with the well-known Courcelle’s Theorem, A subset of the results was presented at STACS 2010 [52]. Institut f¨ ur Informatik, Humboldt-Universit¨ at zu Berlin, [email protected] Cork Constraint Computation Centre, University College Cork, [email protected] § Department of Computer Science, University of Leicester, [email protected] 1

Finding small separators in linear time via treewidth

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Finding small separators in linear time via treewidth

arX

iv:1

110.

4765

v1 [

cs.D

S]

21 O

ct 2

011

Finding small separators in linear time via treewidth reduction∗

Daniel Marx† Barry O’Sullivan‡ Igor Razgon§

Abstract

We present a method for reducing the treewidth of a graph while preserving all of its minimals− tseparators up to a certain fixed sizek. This technique allows us to solves− t Cut and Multicut problemswith various additional restrictions (e.g., the vertices being removed from the graph form an independentset or induce a connected graph) in linear time for every fixednumberk of removed vertices.

Our results have applications for problems that are not directly defined by separators, but the knownsolution methods depend on some variant of separation. For example, we can solve similarly restrictedgeneralizations of Bipartization (delete at mostk vertices fromG to make it bipartite) in almost lineartime for every fixed numberk of removed vertices. These results answer a number of open questions inthe area of parameterized complexity. Furthermore, our technique turns out to be relevant for(H,C,K)-and (H,C,≤K)-coloring problems as well, which are cardinality constrained variants of the classicalH-coloring problem. We make progress in the classification ofthe parameterized complexity of theseproblems by identifying new cases that can be solved in almost linear time for every fixed cardinalitybound.

1 Introduction

Finding cuts and separators is a classical topic in combinatorial optimization and in recent years there hasbeen an increase of interest in the fixed-parameter tractability of such problems [7, 11, 24, 28, 30, 32, 50,53, 54, 65]. Recall that a problem isfixed-parameter tractable(or FPT) with respect to a parameterk ifinstances of sizen can be solved in timef (k) ·nO(1) for some computable functionf (k) depending only onthe parameterk of the instance [20,25,56]. In typical parameterized separation problems, the parameterk isthe size of the separator we are looking for, thus fixed-parameter tractability with respect to this parametermeans that the combinatorial explosion is restricted to thesize of the separator, but otherwise the runningtime depends polynomially on the size of the graph.

The main message of our paper is the following: the smalls− t separators live in a part of the graphthat has bounded treewidth. Therefore, if a separation problem is FPT in bounded treewidth graphs, then itis FPT in general graphs as well. As there are general techniques for obtaining linear-time algorithms forproblems on bounded-treewidth graphs (e.g., dynamic programming and Courcelle’s Theorem), it followsthat a surprisingly large number of generalized separationproblems can be shown to be linear-time FPT withthis approach (we say that a problem islinear-time FPTwith parameterk if it can be solved in timef (k) ·n forsome functionf ). For example, one of the consequences our general argumentis a theorem stating that givena graphG, two terminal verticess, t, and a parameterk, we can compute in a FPT-time a graphG∗ having thetreewidth bounded by a function ofk while (roughly speaking) preserving all the inclusionwiseminimals−tseparators of size at mostk. Therefore, combining this theorem with the well-known Courcelle’s Theorem,

∗A subset of the results was presented at STACS 2010 [52].†Institut fur Informatik, Humboldt-Universitat zu Berlin,[email protected]‡Cork Constraint Computation Centre, University College Cork, [email protected]§Department of Computer Science, University of Leicester,[email protected]

1

Page 2: Finding small separators in linear time via treewidth

we obtain a powerful tool for findings− t separators obeying additional constraints expressible inmonadicsecond order logic.

Algorithms for separation problems are often based on interesting mathematical properties of the prob-lem. For example, the classicals− t cut algorithm of Ford and Fulkerson is essentially based on the tightconnection between maximum flows and minimum cuts. However,algorithms based on nice mathematicalproperties and connections are inherently fragile, and anyslight generalization of the problem can breakthese connection and make the problem NP-hard (unless the generalization involves very special conditions,e.g., submodular functions). On the other hand, the main thesis of the paper is that the fixed-parametertractability of separation problems has a highly robust theory: the technique of treewidth reduction pre-sented in the paper allows us to show the fixed-parameter tractability of several generalizations with verylittle additional effort. As separation problems are crucial ingredients for solving other type of problems(e.g., bipartization), this robustness propagates into other problem areas as well.

1.1 Results

We demonstrate the power of the methodology with the following results.

• We prove that the MINIMUM STABLE s− t CUT problem (Is there an independent setS of size atmostk whose removal separatess and t?) is fixed-parameter tractable and in fact can be solved inlinear time for every fixedk. Our techniques allow us to prove various generalizations of this resultvery easily. First, instead of requiring thatSis independent, we can require that it induces a graph thatbelongs to a hereditary classG (hereditary means that ifG∈ G, then every induced subgraph ofG isin G as well); the problem remains linear-time solvable for every fixed k. Second, in the MULTICUT

problem a list of pairs of terminals are given(s1, t1), . . . , (sℓ, tℓ) andS is a set of at mostk vertices thatinduces a graph fromG and separatessi from ti for everyi. We show that this problem can be solvedin linear time for every fixedk andℓ (i.e., linear-time FPT parameterized byk andℓ), which is a verystrong generalization of previous results [30, 50, 65]. Third, the results generalize to the MULTICUT-UNCUT problem, where two setsT1, T2 of pairs of terminals are given, andS has to separate everypair of T1 andshould notseparate any pair ofT2.

• We show that CONNECTED s-t CUT (Is there a set of of at mostk vertices that induces a connectedgraph and whose removal separates terminalss and t?) is linear-time FPT. The significance of theresult is that at first sight this problem does not seem to be amenable to our techniques: connectivityis not a hereditary property, and therefore the solution is not necessarily a minimals-t separator.However, with some problem-specific ideas related to connectivity, we can extend our approach tohandle such a requirement. This suggests that our techniquemight be applicable to a much widerrange of cut problems than the hereditary problems described above.

• As a demonstration, we show that the EDGE-INDUCED VERTEX CUT (Is there a set of at mostkedges such that removal of their endpoints separates two given terminalssandt?) is linear-time FPT,answering an open problem posed in 2007 by Samer [14]. The motivation behind this problem isdescribed in [61]. While the reader might not be particularly interested in this exotic variant ofs− tcut, we believe that it nicely demonstrates the message of the paper. Slightly changing the definition ofa well-understood cut problem usually makes the problem NP-hard and determining the parameterizedcomplexity of such variants directly is by no means obvious and seems to require problem-specificideas in each case. On the other hand, using our techniques, the fixed-parameter tractability of manysuch problems can be shown in a uniform way with very little effort. Let us mention (without proofs)three more variants that can be treated in a similar way: (1) separates and t by deleting at mostkedges and at mostk vertices, (2) in a 2-colored graph, separatesandt by deleting at mostk black and

2

Page 3: Finding small separators in linear time via treewidth

at mostk white vertices, (3) in ak-colored graph, separates andt by deleting one vertex from eachcolor class.

• The BIPARTIZATION problem asks if a given graphG can be made bipartite by deleting at mostkvertices. Reed et al. [60] showed that the problem is FPT and Kawarabayashi and Reed [44] provedthat the problem is almost linear-time FPT, i.e., can be solved in time f (k) · n ·α(n,n), whereαis the inverse Ackermann function. We prove that the variantSTABLE BIPARTIZATION (Is therean independent set of sizeat most kwhose removal makes the graph bipartite?) is almost linear-time FPT, answering an open question posed by Fernau [14]. Furthermore, we prove that EXACT

STABLE BIPARTIZATION (Is there an independent set of sizeexactly kwhose removal makes thegraph bipartite?) is also almost linear-time FPT, answering an open question posed in 2001 by Dıazet al. [16]. This latter result might be somewhat surprising, as finding an independent set of sizeexactlyk is W[1]-hard, and hence unlikely to be FPT. As in the case ofs− t cuts, we introduce thegeneralizationG-BIPARTIZATION, where the at mostk vertices of the solution have to induce a graphbelonging to the classG; we show that this problem is almost linear-time FPT whenever G is decidableand hereditary. We also study the analogous edge-deletion versionG-EDGEBIPARTIZATION and showit to be FPT ifG is decidable and closed under taking subgraphs.

• The BIPARTITE CONTRACTION problem asks if a given graphG can be made bipartite by thecon-traction of at mostk edges. Very recently, Heggernes et al. [38] showed that thisproblem is FPTby presenting a nontrivial problem-specific algorithm. We observe that a simple corollary of ourresults onG-EDGEBIPARTIZATION immediately shows that BIPARTITE CONTRACTION is almost-linear time FPT.

• Finally, we analyze the constrained bipartization problems in a more general environment of(H,C,≤K)-coloring [16], where the parameter is the maximum number of vertices mapped toC in the ho-momorphism and prove that the problem is almost linear-timeFPT if the graphH \C consists oftwo adjacent vertices without loops. There have been significant efforts in the literature to fullycharacterize the complexity (i.e., to prove dichotomy theorems) of various versions ofH-coloring[8, 22, 23, 26, 33–35, 39, 40]. The version studied here was introduced in [16–19], where it was ob-served that this problem family contains several classicalconcrete problems as special case, includingsome significant open problems. Thus obtaining a full dichotomy would require breakthroughs inparameterized complexity. Our result removes one of the roadblocks towards this goal.

As the results listed above demonstrate, our method leads tothe solution of several independent prob-lems; it seems that the same combinatorial difficulty lies atthe heart of these problems. Our techniquemanages to overcome this difficulty and it is expected to be ofuse for further problems of similar flavor.We would like to emphasize that while designing FPT-time algorithms for bounded-treewidth graphs and inparticular the use of Courcelle’s Theorem is a fairly standard method, we use this technique for problemswhere there isno boundon the treewidth in the input.

Various versions of (multiterminal) cut problems [11, 28, 32, 50] play a mysterious, not yet fully un-derstood role in the fixed-parameter tractability of certain problems. Proving that BIPARTIZATION [60],DIRECTED FEEDBACK VERTEX SET [12], and ALMOST 2-SAT [58] are FPT answered longstanding openquestions, and in each case the algorithm relies on a nonobvious use of separators. Furthermore, EDGE

MULTICUT has been observed to be equivalent to FUZZY CLUSTER EDITING, a correlation clustering prob-lem [1,6,15]. Thus aiming for a better understanding of separators in a parameterized setting seems to be afruitful direction of research. The results of this paper extend our understanding of separators by showingthat various additional constraints can be easily accommodated. It is important to point out that our algorithmis very different from previous parameterized algorithms for separation problems [7, 11, 28, 30, 32, 50, 54].

3

Page 4: Finding small separators in linear time via treewidth

Those algorithms in the literature exploited certain nice properties of separators, and hence it seems verydifficult to generalize them for the problems we consider here. On the other hand, our approach is veryrobust and, as demonstrated by our examples, it is able to handle many variants.

2 Treewidth reduction

The main combinatorial result of the paper is presented in this section. We start by introducing the maintools required to prove the result: the notions of treewidthand torso.

2.1 Treewidth, brambles, and monadic second order logic

A tree decompositionof a graphG(V,E) is a pair(T,B) in which T(I ,F) is a tree andB = Bi | i ∈ I is afamily of subsets ofV(G) such that

1.⋃

i∈I Bi =V;2. for each edgee= (u,v) ∈ E, there exists ani ∈ I such that bothu andv belong toBi; and3. for everyv∈V, the set of nodesi ∈ I | v∈ Bi forms a connected subtree ofT.

Thewidthof the tree decomposition is the maximum size of a bag inB minus 1. Thetreewidthof a graphG,denoted by tw(G), is the minimum width over all possible tree decompositionsof G. For more backgroundon the combinatorial and algorithmic consequences, the reader is referred to e.g., [5, 29]. A useful fact thatwe will use later on is that for every cliqueK of G, there is a bagBi with K ⊆ Bi.

Treewidth has a dual characterization in terms of brambles [59,62]. Abramblein a graphG is a familyof connected subgraphs ofG such that any two of these subgraphs either have a nonempty intersection orare joined by an edge. Theorder of a bramble is the least number of vertices required to coverall subgraphsin the bramble. Thebramble numberbn(G) of a graphG is the largest order of a bramble ofG. Seymourand Thomas [62] proved that bramble number tightly characterizes treewidth:

Theorem 2.1(Seymour and Thomas [62]). For every graph G,bn(G) = tw(G)+1.

Typically, the definition of treewidth is useful when we are trying to prove upper bounds, and bramblesare useful when we are trying to prove lower bounds. Interestingly, in the current paper we use brambles toprove upper bounds on the treewidth. The reason for this is that we are relating the treewidth of differentgraphs appearing in our construction and want to show that ifthe resulting graph has large treewidth, thenthe earlier graphs have large treewidth as well.

The algorithmic importance of treewidth comes from the factthat a large number of NP-hard problemscan be solved in linear time if we have a bound on the treewidthof the input graph. Most of these algo-rithms use a bottom-up dynamic programming approach, whichgeneralizes dynamic programming on trees.Courcelle’s Theorem [13] (see also [20, Section 6.5], [29])gives a powerful way of quickly showing that aproblem is linear-time solvable on bounded treewidth graphs. Sentences inMonadic Second Order Logic ofGraphs(MSO) contain quantifiers, logical connectives (¬, ∨, and∧), vertex variables, vertex set variables,binary relations∈ and=, and the atomic formulaE(u,v) expressing thatu andv are adjacent. If a graphproperty can be described in this language, then this description can be turned into an algorithm:

Theorem 2.2(Courcelle [13]). If a graph property can be described as a formulaφ in the Monadic SecondOrder Logic of Graphs, then it can be recognized in time fφ (tw(G)) · (|E(G)|+ |V(G)|) if a given graph Ghas this property.

4

Page 5: Finding small separators in linear time via treewidth

Theorem 2.2 can be extended to labeled graphs, where the sentence contains additional atomic formulasPi(x) meaning that vertexx has labeli. We can implement labels on the edges by additional atomic formulasEi(x,y) with the meaning that there is an edge of labeli connecting verticesx andy. We informally call theselabels as “colors” and talk e.g., about colored graphs with black and white vertices and red and blue edges.Most of the results in the paper go through for graphs coloredwith fixed constant number of colors: thecolors do not play a role in graph-theoretic properties (such as separation, treewidth, etc.) and requirementson colors can be easily accommodated in MSO formulas.

Constructing an MSO formula for a given graph problem is usually a straightforward, but somewhatlengthy exercise. Thus when we use Theorem 2.2, the construction of the formula is relegated to the ap-pendix.

2.2 Separators

Two slightly different notions of separation will be used inthe paper:

Definition 2.3. We say that a set S of verticesseparatessets of vertices A and B if no component of G\Scontains vertices from both A\S and B\S. If s and t are two distinct vertices of G, then an s− t separatorisa set S of vertices disjoint froms, t such that s and t are in different components of G\S.

Thus if we say thatS separatesA andB, then we do not require thatS is disjoint fromA andB. Inparticular, ifSseparatesA andB, thenA∩B⊆ S.

We say that ans− t separatorS is minimumif there is nos− t separatorS′ with |S′|< |S|. We say thatans− t separatorS is (inclusionwise) minimalif there is nos− t separatorS′ with S′ ⊂ S.

If X is a set of vertices, we denote byNG(X) the set of those vertices inV(G)\X that are adjacent to atleast one vertex ofX. (We omit the subscriptG if it clear from the context.) We use the folklore result thatall the minimum cuts can be covered by a sequence of noncrossing minimum cuts: there exists a sequenceX1 ⊂ ·· · ⊂Xq such that everyN(Xi) is a minimums−t separator and every vertex that appears in a minimumseparator is covered by one of theN(Xi)’s. The existence of these sets can be proved by a simple applicationof the uncrossing technique. We present a different proof here (related to [57]) that allows us to find such asequence in linear time. Strictly speaking, it is not possible to construct the setsX1, . . . , Xq in linear time,as their total size could be quadratic. However, it is sufficient to produce the differencesXi+1 \Xi , as theycontain all the information in the sequence.

Lemma 2.4. Let s, t be two vertices in graph G such that the minimum size of an s− t separator isℓ > 0.Then there is a collectionX = X1, . . .Xq of sets wheres ⊆ Xi ⊆V(G)\ (t∪N(t)) (1≤ i ≤ q), suchthat

1. X1 ⊂ X2 ⊂ ·· · ⊂ Xq,2. |N(Xi)|= ℓ for every1≤ i ≤ q, and3. every s− t separator of sizeℓ is fully contained in

⋃qi=1 N(Xi).

Furthermore, there is an O(ℓ(|V(G)|+ |E(G)|)) time algorithm that produces the sets X1, X1 \X2, . . . ,Xq\Xq−1 corresponding to such a collectionX .

Proof. Let us construct a directed networkD the following way. There are 2|V(G)| nodes inD: for everyv∈V(G), there are two nodesv1, v2, there is an arc−−→v1v2 with capacity 1, and there is an arc−−→v2v1 with infinitecapacity. For every edgexy∈ E(G), we add two arcs−−→x2y1 and−−→y2x1 with infinite capacity.

ForY ⊆V(D), let ∆+D(Y) be the set of edges leavingY in D. We say thatF ⊆ E(D) is ans2 → t1 cut,

if there is no path froms2 to t1 in D \F . It is clear that a setS⊆V(G) \s, t is ans− t separator if andonly if the corresponding set−−→v1v2 | v∈ S of |S| arcs ofD form ans2 → t1 cut. Therefore, if we can find a

5

Page 6: Finding small separators in linear time via treewidth

sequences2 ⊆Y1 ⊂Y2 ⊂ ·· · ⊂Yq ⊆V(D)\t1 such that the capacity of∆+D(Yi) is ℓ for every 1≤ i ≤ q

and everys2 → t1 cut of weightℓ is fully contained in⋃q

i=1 ∆+D(Yi), then we can obtain the required sequence

by definingXi to contain those verticesv for whichv1,v2 ∈Yi . It is easy to observe that in this casev∈N(Xi)if and only if the corresponding arc−−→v1v2 is in ∆+

D(Yi)Let us runℓ rounds of the Ford-Fulkerson algorithm on the networkD to find a maximums2 → t1 flow

and letD′ be the residual graph (recall that the residual graphD′ contains an arc−→uv if and only if eitherDcontains an unsaturated arc−→uv in or an arc−→vu with nonzero flow). LetC1, . . . , Cq be a topological orderingof the strongly connected components ofD′ (i.e. i < j whenever there is a path fromCi to Cj ). As the valueof the maximum flow is exactlyℓ > 0, there is nos2 → t1 path in the residual graphD′, but there has to be at1 → s2 path. Therefore, ift1 is in Cx ands2 is in Cy, thenx< y. For everyx< i ≤ y, let Yi :=

⋃qj=i Cj . We

claim that the capacity of∆+D(Yi) is ℓ. By the definition ofYi , no arc leavesYi in the residual graphD′, hence

every edge leavingYi in D is saturated and no flow entersYi . As s2 ∈Cy ⊆Yi andt1 ∈Cx ⊆V(G)\Yi , this isonly possible if the capacity of∆+

D(Yi) is exactlyℓ.What remains to be shown is that every arc contained in ans2 → t1 cut of weightℓ is covered by one of

the∆+D(Yi)’s. Let F be ans2 → t1 cut of weightℓ. LetY be the set of nodes reachable froms2 in D\F ; asF

is a minimum cut, it is clear that∆+D(Y) = F. Consider an arc

−→ab∈ F. Since this arc is in a minimum cut, it

is saturated by the flow, hence there is an arc−→ba enteringY in the residual graphD′. We claim that this arc

does not appear in any cycle ofD′. If it appears in a cycle, then there is an arc−→cd of D′ leavingY. However,

such an arc cannot exist, as every arc leavingY in D is saturated and no flow entersY. Thusa andb are intwo different strongly connected componentsCia andCib for someib < ia. Since there is flow going froms2

to a, there is ana→ s2 path in the residual graphD′, and henceia ≤ y. Similarly, as there is flow going fromb to t1, there is at1 → b path inD′ andib ≥ x. Thus we have thatx≤ ib < ia ≤ y, henceYia is well-defined,

and−→ab of D is contained in∆+

D(Yia).

2.3 Torso

If we are interested in those separators of graphG that are fully contained in a subsetC of vertices, then wecan replace the neighborhood of each component inG\C by a clique, as there is no way to disconnect thesevertices with separators fully contained inC. The notion of torso and Proposition 2.7 below formalize thisconcept.

Definition 2.5. Let G be a graph and C⊆ V(G). The graphtorso(G,C) has vertex set C and verticesa,b ∈ C are connected by an edge ifa,b ∈ E(G) or there is a path P in G connecting a and b whoseinternal vertices are not in C.

We state without proof some easy consequences of the definition:

Proposition 2.6. Let G be a graph.

1. For sets C1 ⊆C2 ⊆V(G), we havetorso(torso(G,C2),C1) = torso(G,C1).2. For sets C,S⊆V(G), we have thattorso(G\S,C\S) is a subgraph oftorso(G,C)\S.

The following proposition states that, roughly speaking, the operation of taking the torso preserves theseparators that are contained inC.

Proposition 2.7. Let C1 ⊆C2 be two subsets of vertices in G and let a,b ∈ C1 two vertices. A set S⊆ C1

separates a and b intorso(G,C1) if and only if S separates these vertices intorso(G,C2). In particular, bysetting C2 =V(G), we get that S⊆C1 separates a and b intorso(G,C1) if and only if it separates them in G.

6

Page 7: Finding small separators in linear time via treewidth

Proof. Assume first thatC2 =V(G), that is, torso(G,C2) = G. Let P be a path connectinga andb in G andsuppose thatP is disjoint from a setS. The pathP contains vertices fromC1 and fromV(G)\C1. If u,v∈C1

are two vertices such that every vertex ofP betweenu andv is fromV(G) \C1, then by definition there isan edgeuv in torso(G,C1). Using these edges, we can modifyP to obtain a pathP′ that connectsa andb intorso(G,C1) and avoidsS.

Conversely, suppose thatP is a path connectinga andb in torso(G,C1) and it avoidsS⊆C1. If P usesan edgeuv that is not present inG, then this means that there is a path connectingu andv whose internalvertices are not inC1. Using these paths, we can modifyP to obtain a pathP′ that uses only the edges ofG.SinceS⊆C1, the new vertices on the path are not inS, i.e.,P′ avoidsSas well.

For the general statement observe that it follows from the previous paragraph thatS⊆ C1 separatesaandb in torso(torso(G,C2),C1) if and only if it separatesa andb in torso(G,C2). Now the statement of theproposition immediately follows from Prop. 2.6(1).

We show that if we have a treewidth bound on torso(G,Ci) for everyi, then these bounds add up for theunion of theCi ’s. The characterization of treewidth using bramble numberwill be convenient for the proofof this statement.

Lemma 2.8. Let G be a graph and C1, . . . , Cr be subsets of V(G) and let C:=⋃r

i=1Ci . We havebn(torso(G,C))≤∑r

i=1bn(torso(G,Ci)).

Proof. It is sufficient to prove the lemma in the caseC =V(G): otherwise, we prove the statement for thegraphG′ := torso(G,C) (note that torso(G,Ci) = torso(G′,Ci) by Prop. 2.6(1)).

LetB be a bramble ofG having order bn(G). For every 1≤ i ≤ r, LetBi = B∩Ci | B∈ B,B∩Ci 6= /0.We claim thatBi is a bramble of torso(G,Ci). Let us show first thatB∩Ci ∈ Bi is connected. Consider twoverticesx,y∈ B∩Ci. SinceB∈ B is connected, there is anx−y pathP in G such that every vertex ofP isin B. As in the proof of Prop. 2.7, we can replace the subpaths ofP that leaveCi by edges of torso(G,Ci) toobtain anx−y pathP′ such that every vertex ofP′ is in B∩Ci. This proves thatB∩Ci is connected.

Let us show now that the sets inBi pairwise touch. Consider two setsB1∩Ci ,B2∩Ci ∈ Bi. We knowthatB1 andB2 touch inG, thus there are verticesx∈ B1, y∈ B2 such that eitherx= y or x andy are adjacentin G. If x,y∈Ci , then it is clear thatB1∩Ci andB2∩Ci touch in torso(G,Ci). If x or y is not inCi, then bothx andy are inK ∪NG(K) for some componentK of G\Ci . As B1∩Ci ,B2∩Ci 6= /0, bothB1 andB2 have tointersectNG(K). By the definition of torso,NG(K) induces a clique in torso(G,Ci), thusB1∩Ci andB1∩Ci

touch in torso(G,Ci).Let Xi be a cover ofBi having order bn(torso(Gi)). To complete the proof of the lemma, we observe that

⋃ri=1 Xi is a cover ofB. Indeed, asC = V(G), everyB∈ B intersects someCi , and thereforeXi intersects

B∩Ci.

The following lemma will be used for the inductive proof of the treewidth reduction result. This time,the definition of treewidth using tree decompositions will be more useful in the proof.

Lemma 2.9. Let C′ ⊆ V(G) be a set of vertices and let R1, . . . , Rr be components of G\C′. For every1≤ i ≤ r, let C′

i ⊆ Ri be subsets and let C′′ :=C′∪⋃ri=1C′

i . Then we have

tw(torso(G,C′′))≤ tw(torso(G,C′))+r

maxi=1

tw(torso(G[Ri],C′i ))+1

bn(torso(G,C′′))≤ bn(torso(G,C′))+r

maxi=1

bn(torso(G[Ri],C′i )).

Proof. Let T be a tree decomposition of torso(G,C′) having width at mostw1, and letTi be a tree decom-position of torso(G[Ri],C′

i ) having width at mostw2. Let Ni ⊆ C′ be the neighborhood ofRi in G. SinceNi induces a clique in torso(G,C′), we have|Ni| ≤ w1 + 1 and there is a bagBi of T containingNi. Let

7

Page 8: Finding small separators in linear time via treewidth

us modifyTi by includingNi in every bag and then let us joinT andTi by connecting an arbitrary bag ofTi with Bi. By performing this step for every 1≤ i ≤ r, we get a tree decomposition having width at mostw1+w2+1. To show that it is indeed a tree decomposition of torso(G,C′′), consider two verticesx,y∈C′′

that are adjacent in torso(G,C′′), i.e., there is a pathP between them whose internal vertices are outsideC′′.

1. If x,y∈C′, then they are adjacent in torso(G,C′) as well (since the internal vertices ofP are outsideC′′ ⊇C′) and hence they appear together in a bag ofT.

2. If x,y∈C′i , then all the internal vertices ofP are inRi. Thus they are adjacent in torso(G[Ri],C′

i ) andhence they appear together in a bag ofTi.

3. If x∈C′ andy∈C′i , thenx∈ Ni and every bag ofTi containingy was extended with theNi.

A simple consequence of Lemma 2.9 is that adding a constant number of vertices toC increases thetreewidth of the torso only by a constant:

Corollary 2.10. For every graph G, sets C,X ⊆V(G), we havetw(torso(G,C∪X))≤ tw(torso(G,C))+ |X|.

On the other hand, removing even a single vertex fromC can increase treewidth arbitrarily. For ex-ample, letG be a star with a central vertexv andn leaves. Then tw(torso(G,V(G))) = tw(G) = 1, whiletorso(G,V(G)\v) is a clique onn vertices, hence it has treewidthn−1.

2.4 Treewidth bound for minimal s− t separators

If the minimum size of ans− t separator isℓ, then theexcessof an s− t separatorS is |S| − ℓ (which isalways nonnegative). Note that ifs and t are adjacent, then nos− t separator exists, and in this case wesay that the minimum size of ans− t separator is∞. The aim of this section is to show that, for everyk,we can construct a setC′ covering all the minimals− t separators of size at mostk such that torso(G,C′)has treewidth bounded by a function ofk. Equivalently, we can require thatC′ covers every minimals− tseparator of excess of at moste := k− ℓ, whereℓ is the minimum size of ans− t separator. Observe that itis crucial that we want to cover only inclusionwise minimal separators: every vertex (other thans andt) ispart of somes− t separator having excess 1.

Lemma 2.4 shows that the unionC of all minimums−t separators can be covered by a chain of minimums− t separators. It is not difficult to see that this chain can be used to define a tree decomposition (in fact,a path decomposition) of torso(G,C). This observation solves the problem fore= 0. For the general case,we use induction one.

Lemma 2.11. Let s, t be two vertices of graph G and letℓ be the minimum size of an s− t separator. Forsome e≥ 0, let C be the union of all minimal s− t separators havingexcessat most e (i.e. having size atmost k= ℓ+e). Then there is an f(ℓ,e) · (|E(G)|+ |V(G)|) time algorithm that returns a set C′ ⊇C disjointfroms, t such thatbn(torso(G,C′))≤ g(ℓ,e), for some functions f and g depending only onℓ and e.

Proof. We prove the lemma by induction one. Consider the collectionX of Lemma 2.4 and defineSi :=N(Xi) for 1≤ i ≤ q. For the sake of uniformity, we defineX0 := /0,Xq+1 :=V(G)\t, S0 := s, Sq+1 := t.For 1≤ i ≤ q+1, letLi :=Xi \(Xi−1∪Si−1). See Figure 2.4 for an intuitive illustration of these sets.Observethat Li ’s are pairwise disjoint. Furthermore, for 1≤ i ≤ q+ 1 and two disjointnon-emptysubsetsA,B ofSi ∪Si−1, we defineGi,A,B to be the graph obtained fromG[Li ∪A∪B] by contracting the setA to a vertexaand the setB to a vertexb. The key observation that makes it possible to use inductionis that ifC includesa vertex of someLi , thene> 0.

8

Page 9: Finding small separators in linear time via treewidth

X1

X2

X3

S0 = s

S1 S2

L1 L2 Sq+1 = t

Figure 1: Schematic illustration of the first few setsSi andLi in the proof of Lemma 2.11. The illustrationis simplified, e.g., it does not take into account thatSi−1 andSi are not necessarily disjoint.

Claim 2.12. If a vertex v∈ Li is in C, then there are disjoint non-empty subsets A,B of Si ∪Si−1 such that vis part of a minimal a−b separator K2 in Gi,A,B of size at most k (recall that k= ℓ+e) and excess at moste−1.

Proof. By definition ofC, there is a minimals− t separatorK of size at mostk that containsv. Let K1 :=K \Li andK2 := K∩Li. Partition(Si ∪Si−1)\K into the setA of vertices reachable froms in G\K and thesetB of vertices non-reachable froms in G\K. Let us observe that bothA andB are non-empty. Indeed,due to the minimality ofK, G has a pathP from s to t such thatV(P)∩K = v ⊆ Li. By selection ofv,Si−1 separatesv from sandSi separatesv from t. Therefore, at least one vertexu of Si−1 occurs inP beforev and at least one vertexw of Si occurs inP afterv. The prefix ofP ending atu and suffix ofP starting atw are both subpaths inG\K. It follows thatu is reachable froms in G\K, i.e. belongs toA and thatw isreachable fromt in G\K, hence non-reachable fromsand thus belongs toB.

To see thatK2 is ana−b separator inGi,A,B, suppose that there is a pathP connectinga andb in Gi,A,B

avoidingK2. Then there is a corresponding pathP′ in G connecting a vertex ofA and a vertex ofB. PathP′

is disjoint fromK1 (since it contains vertices ofLi and(Si ∪Si−1)\K only) and fromK2 (by construction).Thus a vertex ofB is reachable froms in G\K, a contradiction.

To see thatK2 is a minimala−b separator, suppose that there is a vertexu∈ K2 such thatK2 \u isalso ana− b separator inGi,A,B. SinceK is minimal, there is ans− t pathP in G\ (K \u), which has topass throughu. Arguing as when we proved thatA andB are non-empty, we observe thatP includes verticesof both A andB, hence we can consider a minimal subpathP′ of P between a vertexa′ ∈ A and a vertexb′ ∈ B. We claim that all the internal vertices ofP′ belong toLi. Indeed, due to the minimality ofP′, aninternal vertex ofP′ can belong either toLi or toV(G) \ (K1∪Li ∪Si−1∪Si). If all the internal vertices ofP′ are from the latter set then there is a path froma′ to b′ in G\ (K1∪ Li) and hence inG\ (K1∪K2) incontradiction tob′ ∈ B. If P′ contains internal vertices of both sets thenG has an edgeu,w whereu∈ Li

while w∈V(G)\ (K1∪Li ∪Si−1∪Si). But this is impossible sinceSi−1∪Si separatesLi from the rest of the

9

Page 10: Finding small separators in linear time via treewidth

graph. Thus it follows that indeed all the internal verticesof P′ belong toLi . Consequently,P′ correspondsto a path inGi,A,B from a to b that avoidsK2\u, a contradiction that proves the minimality ofK2.

Finally, we show thatK2 has excess at moste− 1. Let K′2 be a minimuma− b separator inGi,A,B.

Observe thatK1∪K′2 is ans− t separator inG. Indeed, consider a pathP from s to t in G\ (K1∪K′

2). Itnecessarily contains a vertexu∈ K2, hence arguing as in the previous paragraph we notice thatP includesvertices of bothA andB. Considering a minimal subpathP′ of P between a vertexa′ ∈ A andb′ ∈ B weobserve, analogously to the previous paragraph that all theinternal vertices of this path belong toLi. Hencethis path correspond to a path betweena andb in Gi,A,B. It follows thatP′, and henceP, includes a vertexof K′

2, a contradiction showing thatK1∪K′2 is indeed ans− t separator inG. Due to the minimality ofK2,

K′2 6= /0. ThusK1∪K′

2 contains at least one vertex fromLi, implying thatK1∪K′2 is not a minimums− t

separator inG. Thus|K2|− |K′2|= (|K1|+ |K2|)− (|K1|+ |K′

2|)< k− ℓ= e, as required. This completes theproof of Claim 2.12.

Now we defineC′. LetC0 :=⋃q

i=1 Si (note thats, t 6∈C0). In the casee= 0, we can setC′ =C0. It is easyto see that tw(torso(G,C0))) ≤ 2ℓ−1: the bagsS1∪S2, S2∪S3, . . . , Sq−1∪Sq define a tree decompositionof width at most 2ℓ−1.

Assume now thate> 0. For every 1≤ i ≤ q+1 and disjoint non-empty subsetsA,B of Si ∪Si−1, theinduction assumption implies that there exists a setC′

i,A,B ⊆ Li such that bn(torso(Gi,A,B,C′i,A,B))≤ g(ℓ,e−1)

andC′i,A,B contains every inclusionwise minimala−b separator of size at mostk and excess at moste−1 in

Gi,A,B. We defineC′ as the union ofC0 and all setsC′i,A,B as above. Observe thatC′ satisfies the requirement

that any vertexv participating in a minimals− t separator of size at mostk indeed belongs toC′: every suchseparator of sizeℓ is contained inC0, and if the separator has size strictly greater thanℓ, then Claim 2.12implies thatv is contained in someC′

i,A,B.We would like to use Lemma 2.9 to show that the bramble number of torso(G,C′) can be bounded by a

functiong(ℓ,e). Each component ofG\C0 is fully contained in someLi. LetC′i be the union of the at most

32ℓ setsC′i,A,B, for nonempty disjoint subsetsA,B⊆ Si ∪Si−1. As G[Li] = Gi,A,B \a,b andC′

i,A,B is disjointfrom a,b, we have that torso(G[Li],C′

i,A,B) = torso(Gi,A,B,C′i,A,B). Therefore, by Lemma 2.8, the bramble

number of torso(G[Li],C′i ) is at most 32ℓ ·g(k,e−1). It follows that we have the same bound on the bramble

number of torso(G[R],C′∩R) for every componentR of G\C0. Recall that the treewidth of torso(G,C0) isat most 2ℓ− 1, hence bn(torso(G,C0)) ≤ 2ℓ. Therefore, bn(torso(G,C′)) ≤ 2ℓ+ 32ℓ ·g(k,e− 1) holds byLemma 2.9.

We conclude the proof by showing that the above setC′ can be constructed in timef (ℓ,e) · (|E(G)|+|V(G)|) for an appropriate functionf (ℓ,e). We prove this statement by induction one. The setsXi can becomputed as shown in the proof of Lemma 2.4. Then the setsSi can be obtained in the first paragraph ofthe proof of the present lemma. Their union results inC0 which isC′ for e= 0. Thus fore= 0, C′ can becomputed in timeO(k(|V(G)|+ |E(G)|)). Now assume thate> 0. For eachi such that 1≤ i ≤ q+1 and|Li| > 0, the algorithm explores all possible disjoint subsetsA andB of Si ∪Si−1. Let mi be the number ofedges ofG[Li]. Observe that the number of edges ofGi,A,B is at mostmi +2|Li|: the degree of the two extraverticesa andb is at most|Li |. For the given choice, we check if the size of a minimuma−b separator ofGi,A,B is at mostk (observe that this can be done in timeO(k(mi +2|Li|)) by k rounds of the Ford-Fulkersonalgorithm) and if yes, compute the setC′

i,A,B recursively. Thus the number of steps required to handle layeri (not including the recursive calls) isO(32ℓ · k · (mi +2|Li|)). By the induction assumption, each of the atmost 32ℓ recursive calls takes at mostf (ℓ,e−1) · (mi +2|Li|) steps. Therefore, the overall running time of

10

Page 11: Finding small separators in linear time via treewidth

computingC′ is

O(|E(G)|)+q+1

∑i=1

(

32ℓO(k(mi +2|Li|))+32ℓ f (ℓ,e−1)(mi +2|Li|))

≤ O(|E(G)|)+32ℓO(k(E(G)+2|V(G)|))+32ℓ f (ℓ,e−1)(E(G)+2|V(G)|)≤ f (ℓ,e)(|E(G)|+ |V(G)|),

for an appropriate choice off (ℓ,e) (the first inequality follows from the fact that theLi ’s are disjoint, andhence∑q+1

i=1 |Li| ≤ |V(G)| and∑q+1i=1 mi ≤ 2|E(G)|).

Remark 2.13. The setC′ given by Lemma 2.11 is disjoint froms, t, thus torso(G,C′) does not containsor t. However, by Corollary 2.10, extendingC′ with s andt increases treewidth only by 2.

Remark 2.14. The recursiong(ℓ,e) := 2ℓ+32ℓ ·g(ℓ,e−1)) implies thatg(ℓ,e) is 2O(eℓ), i.e., the treewidth/bramblenumber bound is exponential inℓ ande. It is an obvious question whether it is possible to improve this de-pendence to polynomially bounded. However, a simple example shows that the functiong(ℓ,e) has to beexponential. LetG be then-dimensional hypercube and lets and t be opposite vertices. The size of theminimums− t separator isℓ := n. We claim that every vertexv of the hypercube (other thansandt) is partof a minimals− t separator of size at mostn(n−1). To see this, letP be a shortest path connectings andv. Let P′ = P−v be the subpath ofP connectingswith a neighborv′ of v. Let Sbe the neighborhood ofP′;clearlyS is ans− t separator andv∈ S. However,S\v is not ans− t separator: the pathP is not blocked byS\v asS\v does not contain any vertex farther froms thanv. SinceP′ has at mostn−1 vertices and everyvertex has degreen, we have|S| ≤ n(n−1). Thusv (and every other vertex) is part of a minimal separatorof size at mostn(n−1). Hence if we setℓ := n ande := n(n−1)−n, thenC contains every vertex of thehypercube (excepts andt). The treewidth of ann-dimensional hypercube isΩ(2n/

√n) [10], which is also

a lower bound ong(ℓ,e).

Lemma 2.11 together with Prop. 2.7 show that if we want to find an s− t separator of size at mostksatisfying some additional constraints, then it is sufficient to find such ans− t separator in the bounded-treewidth graph torso(G,C′ ∪ s, t), which can be done using standard techniques. However, there is aminor technical detail here. The graph torso(G,C′ ∪s, t) can contain edges not originally present inG.Therefore, it is possible that someS⊆C′ satisfies the required property (say, inducing an independent set)in G, but not in torso(G,C′∪s, t) (or vice versa). This problem can be solved by marking the newedgesas “special”: for example, when solving the problem using Courcelle’s Theorem, we can assume that theinput structure contains a binary predicate distinguishing these new edges. Intuitively, we can say that theoriginal edges of the graph have color “black,” the new edgesintroduced by the torso operation are “red,”and we are looking for a separator where the black edges form acertain patters. In Theorem 2.15, we followa different approach: we modify the graph such that every minimal s− t separatorSof size at mostk inducesthe same graph in the original graphG and in the new bounded-treewidth graph. This theorem statesourmain combinatorial tool in a form that will be very convenient to use for applications where we require thatS induces a certain type of graphs.

Theorem 2.15. [The treewidth reduction theorem]Let G be a graph, T⊆V(G), and let k be an integer.Let C be the set of all vertices of G participating in a minimals− t separator of size at most k for somes, t ∈ T. For every fixed k and|T|, there is a linear-time algorithm that computes a graph G∗ having thefollowing properties:

1. C∪T ⊆V(G∗)2. For every s, t ∈ T, a set K⊆ V(G∗) with |K| ≤ k is a minimal s− t separator of G∗ if and only if

K ⊆C∪T and K is a minimal s− t separator of G.

11

Page 12: Finding small separators in linear time via treewidth

3. The treewidth of G∗ is at most h(k, |T|) for some function h.4. G∗[C∪T] is isomorphic to G[C∪T].

Proof. For everys, t ∈ T that can be separated by the removal of at mostk vertices, the algorithm ofLemma 2.11 computes a setC′

s,t containing all the minimals− t separators of size at mostk. By Lemma 2.8,

if C′ is the union of these(|T|

2

)

sets, then torso(G,C′) has treewidth bounded by a function ofk and|T|. ByCorollary 2.10, we have similar bound on the treewidth ofG′ = torso(G,C′∪T). Note thatG′ satisfies all therequirements of the theorem except the last one: two vertices ofC′ non-adjacent inG may become adjacentin G′ (see Definition 2.5). To fix this problem we subdivide each edge u,v of G′ such thatu,v /∈ E(G)with a new vertex, and, to avoid selection of this vertex intoa cut, we split it intok+ 1 copies. In otherwords, for each edgeu,v ∈ E(G′)\E(G) we introducek+1 new verticesw1, . . . ,wk+1 and replaceu,vby the set of edgesu,w1 . . .u,wk+1,w1,v, . . . ,wk+1,v. Let G∗ be the resulting graph. It is nothard to check thatG∗ satisfies all the properties of the present theorem.

Remark 2.16. The treewidth ofG∗ may be larger than the treewidth ofG. We use the phrase “treewidthreduction” in the sense that the treewidth ofG∗ is bounded by a function ofk and|T|, while the treewidth ofG is unbounded in general.

3 Constrained separation problems

We present a set of results in this section that give linear-time algorithms for vertex cut problems where thecut has to have a certain property, for example, it induces a graph that belongs to a classG.

3.1 Hereditary graph classes

Let G be a class of graphs. Given a graphG, verticess, t, and parameterk, theG-M INCUT problem asks ifG has ans− t separatorC of size at mostk such thatG[C] ∈ G. Suppose thatG is hereditary,i.e. for everyG∈ G andX ⊆V(G), we haveG[X] ∈ G. In this case, whenever there is ans− t separatorK of size at mostk that induces a member ofG, then there is aminimal s− t separator of size at mostk that induces a memberof G: if K′ ⊂ K is a minimals− t separator, thenG[K] ∈ G impliesG[K′] ∈ G. Therefore, if we construct (inlinear time) the graphG∗ of Theorem 2.15 forS= s, t, thenG has ans− t separator of size at mostk thatinduces a member ofG if and only if G∗ has such a separator. This means that we can solve the problemongraphG∗, whose treewidth is bounded by a function ofk. Courcelle’s Theorem provides a very easy wayto prove that certain problems are linear-time solvable on graphs of bounded treewidth. Using this result,it is a routine exercise to show that for every fixed boundk on the separator size and fixed boundw on thetreewidth of the graph,G-M INCUT is linear-time solvable: all we need to do is to construct an appropriatesentence in monadic second order logic expressing that there is a set of at mostk vertices that form ans− tseparator and induces a member ofG (see Appendix A.1 for details). Note that the classG contains a finitenumber of graphs having at mostk vertices, and ifG is decidable, then they can be enumerated in timedepending only onk. Therefore, we obtain our first basic result:

Theorem 3.1. Assume thatG is decidable and hereditary. Then theG-M INCUT problem can be solved intime fG(k)(|E(G)|+ |E(H)|).

Theorem 3.1 allows us to answer a fairly natural open question in the area of parameterized complexity.In particular, letG0 be the class of all graphs without edges. ThenG0-M INCUT is the MINIMUM STABLE

s− t CUT problem whose fixed-parameter tractability has been posed as an open question by Kanj [43].Clearly,G0 is hereditary and hence theG0-M INCUT is FPT.

12

Page 13: Finding small separators in linear time via treewidth

Corollary 3.2. M INIMUM STABLE s− t CUT is linear-time FPT.

Theorem 3.1 can be used to decide if there is ans− t separator of sizeat most khaving a certainproperty, but cannot be used if we are looking fors− t separators of sizeexactly k.We show (with a veryeasy argument) that some of these problems actually become hard if the size is required to be exactlyk.

Theorem 3.3. It is W[1]-hard (parameterized by k) to decide if G has an s− t separator that is an indepen-dent set of size exactly k.

Proof. Let G be a graph and letG′ be a graph obtained fromG by adding two isolated verticess andt. Asevery set not containings andt is ans− t separator,G has an independent set of size exactlyk if and onlyif G′ has an independents− t separator of size exactlyk. Since it is W[1]-hard to check the existence of anindependent set of size exactlyk, it follows that it is also W[1]-hard to check existence of anindependents− t separator of size exactlyk.

The hardness of checking the existence of a separator of sizeexactlyk that is a clique or a dominatingset can be proven similarly.

We remark that Theorem 3.1 remains true for graphs having a fixed finite number of colors (the finitenumber of colors ensures thatG contains only a finite number of graphs with at mostk vertices). Therefore,we can solve problems such as finding ans− t separator having at mostk red vertices and at mostk bluevertices.

3.2 Edge-induced vertex cuts

Samer and Szeider [61] introduced the notion ofedge-induced vertex-cutand the corresponding computa-tional problem: given a graphG and two verticess andt, the task is to find out if there is ans− t separatorthat can be covered byk edges. Intuitively, we want to separatesandt by removing theendpointsof at mostk edges (but of course we are not allowed to removesandt themselves). It remained an open question in [61]whether this problem is FPT. Samer reposted this problem as an open question in [14]. Using Theorem 3.1,we answer this question positively. For this purpose, we introduceGk, the class of graphs where the numberof vertices minus the size of the maximum matching is at mostk, observe that this class is hereditary, andshow that(G,s, t,k) is a yes-instance of theedge-induced vertex-cutproblem if and only if(G,s, t,2k) is ayes-instance of theGk-M INCUT problem. Then we apply Theorem 3.1 to get the following corollary.

Corollary 3.4. TheEDGE-INDUCED VERTEX-CUT problem is linear-time solvable for every fixed k.

Proof. Let Gk contain those graphs where the number of vertices minus the size of the maximum matchingis at mostk. It is not hard to observe thatGk is hereditary by noticing that for anyH ∈ Gk andv∈V(H) thedifference between the number of vertices and the size of maximum matching does not increase by removalof v. It follows therefore from Theorem 3.1 thatGk-M INCUT is FPT.

We will show thatGk-M INCUT with parameter 2k is equivalent to the problem of finding out whetherscan be separated fromt by removal of a setS that can be extended to the union of at mostk edges.

Assume that(G,s, t,2k) is a yes-instance of theGk-M INCUT problem and letS be ans− t separatorof size at most 2k such thatG[S] ∈ Gk. SinceGk is hereditary, we may assume thatS is a minimals− tseparator. LetM be a maximum matching ofG[S]. Then, by definition ofGk, we have|S|− |M| ≤ k or, inother words,|S|−2|M| ≤ k−|M|. The 2|M| vertices ofG[S] incident to the matching are covered by|M|edges. The remaining at mostk−|M| vertices can be covered by selecting an edge ofG incident to each ofthem (due to the minimality ofS, it does not contain isolated vertices). Thuss andt may be separated byremoval of a set that can be covered by at mostk edges. Conversely, assume thats andt can be separatedby removal of setSof vertices that can be extended to the union of at mostk edges ofG. Clearly |S| ≤ 2k.

13

Page 14: Finding small separators in linear time via treewidth

It is not hard to observe that the size of the smallest set of edges coveringSequals the size of the maximummatching|M| of G[S] plus |S|−2|M| edges for the vertices not covered by the matching. By definition ofS, |M|+ |S| − 2|M| ≤ k. It follows thatG[S] ∈ Gk. Thus,(G,s, t,2k) is a yes-instance of theGk-M INCUT

problem.

3.3 Connected vertex cuts

Thestable cutandedge-induced vertex-cutproblems can be solved by direct application of Theorem 3.1.The following problem is an example where the required property is not hereditary, but the problem canbe still handled with a slight extension of our framework. Wesay that ans− t separatorS in graphGis a connected s− t separator if G[S] is a connected graph. The main difficulty in finding a connecteds− t separator of size at mostk is that we cannot restrict our search to minimals− t separators: everyconnecteds− t separatorScontains a minimals− t separatorS′ ⊆ S, but there is no guarantee thatG[S′] isconnected as well. Therefore, we cannot assume that the solution S is fully contained in the setC′ producedby Lemma 2.11.

The right way to look at the problem of finding a connecteds− t separator is that we have to find aminimal s− t separatorS′ that can be extended to a connected setS of size at mostk. Let us call a setk-connectableif it can be extended to a connected set of size at mostk. Deciding if a givenS′ is k-connectableis essentially a Steiner Tree problem: we are looking for a tree having at mostk vertices (or equivalently,at mostk− 1 edges) containingS′. Given a setX of terminals in an edge-weighted graph, the classicalalgorithm of Dreyfus and Wagner [21] finds in time 3|X| · nO(1) a minimum weight tree that containsX.Recently, this has been improved to 2|X| ·nO(1) for unweighted graphs [4,48,55]. However, neither of thesealgorithms is linear time. We need the following result, which shows that for every fixedsize k, a tree of atmostk vertices containingX can be found in linear time (if exists). It can be proved by a simple modificationof the algorithm of Dreyfus and Wagner: for example, it is sufficient to solve recurrence (12) in [48] up toi = k.

Lemma 3.5. Let G be a graph, X⊆ V(G), and k an integer. There is an O(3k(|V(G)|+ |E(G)|)) timealgorithm that finds a tree containing X and having at most k vertices, if such a tree exists.

The following lemma contains the main idea of our algorithm for finding connecteds− t separators. Byour observations above, it is sufficient to look for a minimals−t separator that isk-connectable. Lemma 2.11gives us a setC′ that contains every such minimals−t separatorS, but it is possible thatScannot be extendedto a connected set of size at mostk insideC′. We show that by considering a slightly larger setC′′, we canensure that everyk-connectable set inC′ can be extended to a connected set inC′′.

Lemma 3.6. Let G be a graph with two vertices s and t, and let k be an integer. There is a set C′′ ⊆V(G)such that tw(torso(G,C′′)) is bounded by a constant depending only on k and the followingholds: wheneverG has a connected s− t separator S of size at most k, G also has a connected separator S′ of size at most ksuch that S′ ⊆C′′. Furthermore, such a set C′′ can be found in time f(k)(|E(G)|+ |V(G)|).

Proof. Let us use the algorithm of Lemma 2.11 to obtain a setC′ ⊆ V(G) containing every minimals− tseparator of size at mostk. Let K1, . . . , Kq be the components ofG\C′ and letNi be the neighborhood ofKi

in C′. As Ni induces a clique in torso(G,C′), we have that|Ni | ≤ tw(torso(G,C′))+1. For every 1≤ i ≤ qand every nonempty subsetX ⊆ Ni of size at mostk, let us use the algorithm of Lemma 3.5 to check ifthere is a connected setTi,X of size at mostk such thatX ⊆ Ti,X ⊆ Ki ∪Ni, and if so, letTi,X be such a set ofminimum size; otherwise, letTi,X = /0. LetTi =

/0⊂X⊆NiTi,X andC′′ =C′∪⋃q

i=1Ti . Observe thatC′′ contains

|Ti | ≤ k|Ni|k vertices ofKi, which implies in particular that tw(torso(G[Ki],C′′∩Ki))≤ k(|Ni |

k

)

. Therefore, byLemma 2.9 the treewidth of torso(G,C′′) is larger than the treewidth of torso(G,C′) by a constant dependingonly onk, which means that it can be still bounded by a constant depending only onk.

14

Page 15: Finding small separators in linear time via treewidth

Consider a connecteds−t separatorSof size at mostk such that|S\C′′| is minimum possible. IfS⊆C′′,then there is nothing to prove so we assume thatS\C′′ is non-empty. By the definition ofC′, the setS∩C′

is ans− t separator as well: otherwise,S contains a minimals− t separator that has a vertex outsideC′.Consider a vertexv∈ S\C′′ and suppose thatv∈ Ki. Let T be the connected component ofG[S∩ (Ki ∪Ni)]containingv and letX = T ∩Ni. ThusT is a connected set of size at mostk with X ⊆ T ⊆ Ki ∪Ni, whichmeans thatTi,X is nonempty and|Ti,X | ≤ |T|. Let S′ := (S\T)∪Ti,X , it is clear that|S′| ≤ |S| andS′ is alsoans− t separator (as it containsS∩C′). To see thatG[S′] is connected, observe thatG[Ti,X] is connected andcontains every vertex ofX by definition. Furthermore, every component ofG[S′ \Ki] contains at least onevertex ofX, hence every vertex ofG[S′] is in the same component. As|S′ \C′′| < |S\C′′|, this contradictsthe minimality ofS.

With Lemma 3.6 at hand, it is fairly simple to find a connecteds− t separator of size at mostk:

Theorem 3.7. Finding a connected s− t separator of size at most k is linear-time FPT.

Proof. Let us construct the setC′′ using the algorithm of Lemma 3.6, and letG∗ = torso(G,C′′ ∪s, t).Let us mark the edges ofG∗ by two colors: let an edgexy be “black” if it appears also inG, and letxy be“red” if it appears only inG∗. According to Lemma 3.6, it remains to find ans− t separatorS of size atmostk in G∗ such that the black edges inG∗[S] form a connected subgraph that span every vertex ofS. Itis a routine exercise to formulate in monadic second order logic the problem of finding such a separator.As the treewidth ofG∗ is bounded by a function ofk, the linear-time algorithm follows by Courcelle’sTheorem.

3.4 Multicut problems

In Sections 3.1–3.3, we proved tractability results for problems where the task is to separate two verticess and t with a separator of size at mostk that satisfies some additional constraint (e.g., induces a certaingraph). In this section, we demonstrate the power of our methodology by showing that it is possible to solveproblems where the underlying separation task is more complicated than separating a single pair(s, t) ofvertices. We generalize the problem in three ways: (1) instead of a single pair, we need to separate multiplepairs; (2) instead of pairs of vertices, we need to separate pairs of subsets of vertices; and (3) for some ofthe pairs, we modify the problem by requiring that the removal of the cutsetdoes notseparate them.

MULTICUT is the generalization of MINCUT where, instead ofs andt, the input contains a set(s1, t1),. . . , (sℓ, tℓ) of terminal pairs. The task is to find a setSof at mostk vertices that separatessi andti for every1≤ i ≤ ℓ. MULTICUT is known to be FPT [30, 50, 65] parameterized byk andℓ. Very recently, it has beenshown that the problem is FPT parameterized byk only [7, 54]. (Note that all our results in this section areparameterized by bothk andℓ, thus they do not generalize the FPT results of [7, 54] parameterized bykonly.) In the MULTIWAY CUT problem, the input contains a setT of terminals and the task is to find a setS of at mostk vertices that pairwise separate the vertices inT. Let us observe that MULTIWAY CUT is aspecial case of MULTICUT. This special case has been proved to be FPT parameterized byk only alreadyin [11,50].

We define SET-MULTICUT to be the variant where instead the pairs(s1, t1), . . . , (sℓ, tℓ), we are givenpairs (X1,Y1), . . . ,(Xℓ,Yℓ) of sets and want to find a setS of at mostk nonterminal vertices that separateXi andYi for every 1≤ i ≤ ℓ. Note that in this variant the setS is allowed to intersectXi or Yi . In manycases, it is easy to reduce the problem of separating two setsto the problem of separating two vertices: ifwe add a new vertexsi adjacent toXi and a new vertexti adjacent toYi , then a set disjoint fromsi , ti is ansi − ti separator if and only if it separatesXi andYi in the original graph. This might suggest that the fixed-parameter tractability of SET-MULTICUT problem parameterized byk andℓ easily follows from this kind offixed-parameter tractability for the ordinary multicut problem: for every 1≤ i ≤ ℓ, add a vertexsi adjacent

15

Page 16: Finding small separators in linear time via treewidth

PSfrag replacements

Y2

Y2 Y2Y1

X2

X1

(b)(a)

t2s2

t1

s1

X1X1

X2X2

Y1Y1

Figure 2: (a) Removing the central vertex separatesX1 from Y1 andX2 from Y2. (b) Removing the centralvertexdoes notseparates1 from t1 ands2 from t2.

to eachXi and a vertexti adjacent to eachYi , consider(s1, t1), . . . (sℓ, tℓ) as pairs of terminals and solve theresulting instance of the multicut problem (with the additional constraint that the solution is disjoint froms1, . . . ,sℓ, t1, . . . , tℓ). However this approach, which works very well forℓ = 1 fails even forℓ = 2, seeFigure 2. Thus the parameterization of the SET-MULTICUT problem byk andℓ is not a trivial extension ofthe parameterization byk andℓ of the ordinary multicut problem.

We further generalize SET-MULTICUT by defining SET-MULTICUT-UNCUT to be the variant where theinput contains an additional integerℓ′ ≤ ℓ, and we change the problem by requiring for everyℓ′ ≤ i ≤ ℓ thatS does notseparateXi andYi . Finally, if G is a class of graphs, then (analogously to Section 3.1) we defineG-SET-MULTICUT-UNCUT to be the problem with the additional requirement that the solutionsS induces amember ofG. The main result of the section is the following:

Theorem 3.8. If G is decidableand hereditary,thenG-MULTICUT-UNCUT is linear-time FPT parameter-ized by k andℓ.

For the proof of Theorem 3.8, we need to adapt some statementsof Section 2 to the setting of separatingsets of vertices. First, we restate Lemma 2.11 in terms of separating two setsX andY.

Lemma 3.9. Let X,Y be sets of vertices of G. For some k≥ 0, let C be the union of all minimal sets S ofsize at most k separating X and Y . There is a O( f (k) · (|E(G)|+V(G))) time algorithm that returns a setC′ ⊇C such that the treewidth oftorso(G,C′) is at most g(k), for some functions f and g of k.

Proof. Let G′ be the graph obtained by introducing a new vertexsadjacent toX and a new vertext adjacentto Y. It is clear that a setS⊆ V(G) is ans− t separator inG′ if and only if it separatesX andY in G.Thus Lemma 2.11 gives us a setC′ ⊆V(G′) disjoint froms, t that fully contains every minimal set of sizeat mostk separatingX andY in G. As G is a subgraph ofG′, the treewidth of torso(G,C′) is at most thetreewidth of torso(G′,C′).

16

Page 17: Finding small separators in linear time via treewidth

X

X∗

Y Y∗ C

Figure 3: Schematic illustration of the sets introduced in Lemma 3.10

Next we adapt Prop. 2.7 to the case of separating sets of vertices. The only technical detail is to adjustthe setsX andY in order to account for those vertices that are not in the torso.

Lemma 3.10. Let G be a graph and X,Y,C⊆V(G) sets of vertices such C separates X and Y . Let us defineX∗ such that v∈C is in X∗ if and only if there is a path P between v and a vertex w∈ X such that v is theonly vertex of P in C (in particular, X∩C ⊆ X∗). Let Y∗ be defined analogously. (For intuitive illustrationof these sets, see Figure 3.) Then for every S⊆C, the set S separates X and Y in G if and only it separatesX∗ and Y∗ in torso(G,C).

Proof. Consider a setS⊆C thatdoes notseparateX∗ andY∗ in torso(G,C): by Prop 2.7, this implies thatthere is a pathP between somex∈ X∗ andy∈Y∗ in G\S. Let Px be the path that connectsx and vertex ofX as in the definition ofX∗, and letPy be the similar path forY; note thatPx andPy are disjoint fromS⊆C.Now the pathPxPPy connects a vertex ofX and a vertex ofY in G\S, i.e.,Sdoes not separateX andY in G.

Consider now a setS⊆C thatdoes notseparate somex∈ X andy∈Y in G, and letP a path connectingx andy in G\S. AsC separatesX andY, the pathP intersectsC. Going fromx to y on P, the first vertex ofC is in X∗ (denote it byx∗) and the last vertex ofC is in Y∗ (denote it byy∗). As Sdoes not separatex∗ andy∗ in G, Prop. 2.7 implies thatSdoes not separatex∗ andy∗ (and henceX∗ andY∗) in torso(G,C).

Now we are ready to prove the fixed-parameter tractability ofG-SET-MULTICUT-UNCUT

Proof of Theorem 3.8.Consider an instance(G,(X1,X2), . . . ,(Xℓ,Yℓ),k, ℓ′) of G-SET-MULTICUT-UNCUT.For every 1≤ i ≤ ℓ′, let us use Lemma 3.9, to obtain a setC′

i that contains every set of size at mostk thatseparatesXi andYi . Note that we can assume thatC′

i separatesXi andYi : otherwise, there is no set of sizeat mostk that separatesXi andYi , and we can return “NO.” LetC =

⋃ℓ′i=1C′

i ; by Lemma 2.8, the treewidthof torso(G,C) can be bounded by a constant depending only onk andℓ′. Any minimal solution ofG-SET-MULTICUT-UNCUT having size at mostk is a subset ofC: if a vertex of the solution is not part of a minimalset separatingXi andYi for some 1≤ i ≤ ℓ′, then removing this vertex from the solution cannot make thesolu-tion invalid; in particular, no pair(Xi,Yi) with ℓ′ < i ≤ ℓ can become separated after the removal. Therefore,if C does not separateXi andYi for someℓ′ < i ≤ ℓ, then we can remove the pair(Xi ,Yi) from consideration,

17

Page 18: Finding small separators in linear time via treewidth

as it is not separated by any minimal solution. Thus in the following, we can assume thatC separatesXi andYi for every 1≤ i ≤ ℓ.

For 1≤ i ≤ ℓ, let us defineX∗i andY∗

i as in Lemma 3.10. By Lemma 3.10, a setS⊆C separatesXi andYi in G if and onlyC separatesX∗

i andY∗i in torso(G,C). Let us mark the edges of torso(G,C) by two colors:

let an edgexy be “black” if it appears also inG, and letxy be “red” if it appears only in torso(G,C). Nowour task is to find a setS⊆C of size at mostk such that the black edges ofG[S] for a member ofG, the setSseparatesX∗

i andY∗i in torso(G,C) for every 1≤ i ≤ ℓ′, andS does notseparateX∗

i andY∗i in torso(G,C) for

ℓ′ < i ≤ ℓ. It is a routine exercise to formulate in monadic second order logic the problem of finding such asetS; only some straightforward modifications are required compared to the formulations in Theorems 3.1and 3.7 (e.g., we need to introduce a unary predicate describing each setX∗

i , Y∗i ). As the treewidth of

torso(G,C) is bounded by a function ofk andℓ′, the linear-time algorithm follows by Courcelle’s Theorem.Notice that the treewidth oftorso(G,C) does not depend onℓ, i.e., by the number of pairs that should notbe separated. The dependence of the runtime onℓ rather than onℓ′ is caused by the size of the resultingmonadic second order logic formula.

Theorem 3.8 helps clarifying a theoretical issue. In Section 2, we definedC as the set of all verticesappearing in minimals− t separators of size at mostk. There is no obvious way of finding this set in FPT-time and Lemma 2.8 produces only a supersetC′ of C. However, Theorem 3.8 can be used to findC: avertexv is in C if and only if there is a setSof size at mostk−1 and two neighborsv1,v2 of v such thatSseparatess andt in G\v, but Sdoes not separates from v1 andt from v2 in G\v (including the possibilitythatv1 = sor v2 = t).

4 Constrained Bipartization Problems

Reed et al. [60] solved a longstanding open question by proving the fixed-parameter tractability of theBIPARTIZATION problem: given a graphG and an integerk, find a setS of at mostk vertices such thatG\S is bipartite (see also [49] for a somewhat simpler presentation of the algorithm). This paper intro-duced the technique of “iterative compression,” which has become a standard tool in parameterized com-plexity [63]. The running time of this algorithm isO(k · 3k|V(G)| · |E(G)|), i.e., quadratic time for fixedk. Very recently, a significantly more complex new algorithm with almost linear running time were pre-sented by Kawarabayashi and Reed [44] (throughout this paper, almost linearmeans that the running timeis O(|E(G)|α(|E(G)|, |V(G)|)), whereα is the inverse of the Ackermann function).

In this section we consider theG-BIPARTIZATION problem: a generalization of BIPARTIZATION where,in addition toG\Sbeing bipartite, it is also required thatSinduces a graph belonging to a classG. We provethat givenanysolutionS0 of size at mostk for BIPARTIZATION, our algorithm forG-M INCUT (Section 3.1)can be used to check in linear time (for fixedk) whether or not there exists a solutionSof size at mostk forBIPARTIZATION such thatG[S] belongs toG. Thus the quadratic-time and almost linear-time algorithms of[60] and [44] imply quadratic-time and almost linear-time algorithms, respectively, forG-BIPARTIZATION.

A key idea in the algorithm of Reed et al. [60] is that if a setX is given such thatG\X is bipartite, thenBIPARTIZATION can be solved by at most 3|X| applications of a procedure solving MINCUT. The followinglemma allows us to transform BIPARTIZATION into a separation problem.

Lemma 4.1. Let G be a bipartite graph and let(B′,W′) be a 2-coloring of the vertices. Let B and W be twosubsets of V(G). Then for any set S⊆V(G), the graph G\S has a 2-coloring where B\S is black and W\Sis white if and only if S separates X:= (B∩B′)∪ (W∩W′) and Y:= (B∩W′)∪ (W∩B′).

Proof. In a 2-coloring ofG\S, each vertex either has the same color as in(B′,W′) (call it an unchanged ver-tex) or the opposite color as in(B′,W′) (call it a changed vertex). Observe that a changed and an unchanged

18

Page 19: Finding small separators in linear time via treewidth

vertex cannot be adjacent: in this case, they would have the same color either under(B′,W′) or under theconsidered coloring ofG\S. Consequently, a changed and an unchanged vertex cannot belong to the sameconnected component ofG\S, because this would imply existence of an edge between a changed and anunchanged vertex. IfB is black andW is white in a 2-coloring ofG\S, then clearlyX \S is unchanged andY \S is changed. ThusShas to separateX andY in G.

For the other direction, suppose thatX \S is separated fromY \S in G\S. We modify the coloring(B′,W′) by changing the color of every vertex that is in the same connected component ofG\S as somevertex ofY. Since the vertices of the same component either all change their colors or all remain coloredin the same color as in(B′,W′), the resulting coloring is a proper 2-coloring ofG\S. By construction, allvertices ofY have the desired color. SinceS separatesX andY, the vertices ofX \S are unchanged andhence have the required colors as well.

The main result of the section is the following:

Theorem 4.2. If G is hereditary and decidable, thenG-BIPARTIZATION is almost linear-time FPT parame-terized by k.

Proof. Using the algorithm of [44], we first try to find a setS0 of size at mostk such thatG\S0 is bipartite.If no such set exists, then clearly there is no setS satisfying the requirements. Otherwise, we branch into3|S0| directions: if we fix a hypothetical solutionSand a 2-coloring ofG\S, then each vertex ofS0 is eitherremoved (i.e., inS), colored black, or colored white. For a particular branch,let R= v1, . . . ,vr be thevertices ofS0 to be removed and letB0 (resp.,W0) be the vertices ofS0 having color black (resp., white) ina 2-coloring of the resulting bipartite graph. We say that a set S is compatiblewith partition (R,B0,W0) ifS∩S0 = R andG\Shas a 2-coloring whereB0 andW0 are colored black and white, respectively. It is easyto see that(G,k) is a yes-instance of theG-BIPARTIZATION problem if and only if for at least one branchcorresponding to partition(R,B0,W0) of S0, there is a setScompatible with(R,B0,W0) having size at mostk and such thatG[S] ∈ G. Clearly, we need to check only those branches whereG[B0] andG[W0] are bothindependent sets.

We transform finding a set compatible with(R,B0,W0) into a separation problem. Let(B′,W′) be a2-coloring ofG\S0. Let B= N(W0)\S0 andW = N(B0)\S0. Let us defineX andY as in Lemma 4.1, i.e.,X := (B∩B′)∪ (W∩W′), andY := (B∩W′)∪ (W∩B′). We construct a graphG′ that is obtained fromGby deleting the setB0∪W0, adding a new vertexs adjacent withX∪R, and adding a new vertext adjacentwith Y∪R. Note that everys− t separator inG′ containsR. By Lemma 4.1, a setS is compatible with(R,B0,W0) if and only if S is ans− t separator inG′. Thus what we have to decide is whether there is ans− t separatorSof size at mostk such thatG′[S] = G[S] is in G. That is, we have to solve theG-M INCUT

instance(G′,s, t,k). The fixed-parameter tractability of theG-BIPARTIZATION problem now immediatelyfollows from Theorem 3.1.

Remark 4.3. Instead of the very complex almost-linear time algorithm of[44], one can use the muchsimpler quadratic-time algorithm of [60] to find the setS0. This increases the total running time from almostlinear to quadratic. There is a similar possible trade off between running time and simplicity in all the resultsin remaining part of the current paper which rely on [44].

Similar to Theorem 3.1, we can generalize Theorem 4.2 such thatG contains graphs colored with a fixedfinite number of colors.

Theorem 4.2 immediately implies that the STABLE BIPARTIZATION problem (“Is there an independentset of size at mostk whose removal makes the graph bipartite?”) is FPT: just setG to be the class of allgraphs without edges. This answers an open question of Fernau [14]. Next, we show that the EXACT

STABLE BIPARTIZATION problem (“Is there an independent set of sizeexactly kwhose removal makes thegraph bipartite?”) is also FPT, answering a question posed by Dıaz et al. [16]. An obvious approach would

19

Page 20: Finding small separators in linear time via treewidth

be to modify the algorithm of Theorem 4.2 such that we find an independents− t separatorSof size exactlyk (instead of size at mostk). However, finding such a separator is W[1]-hard by Theorem 3.3, makingthis approach unlikely to work. Instead, we argue that underappropriate conditions, any solution of sizeat mostk can be extended to an independent set of size exactlyk. We find it somewhat surprising that forindependents− t separators finding a solution of size exactlyk is harder than the finding a solution of sizeat mostk, while in the closely related bipartization problem the twovariants have the same complexity.

For the proof, we use the folklore result that a minimum length odd cycle in a graphG can be found inpolynomial time. We need this statement in the following form:

Lemma 4.4. Given a graph G and a set S⊆V(G) such that G\S is bipartite, we can find a minimum lengthodd cycle in time O(|S|(|E(G)|+ |V(G)|)).

Proof. Let us construct a bipartite graphG′ where two verticesv1, v2 correspond to each vertexv of G andtwo edgesv1u2 andv2u1 correspond to each edgeuv of G. We claim thatG has an odd cycle of length atmostk if and only for somev ∈ S there is a path of length at mostk betweenv1 andv2 in G. Testing thelater condition can be done by performing a breadth-first search starting fromv1 for everyv∈S, which takeslinear-time per each vertex ofS.

To prove the claim, let us observe first that graphG′ is bipartite, and ifv1 and v2 are in the samecomponent ofG′ then every path betweenv1 andv2 has odd length. IfG has an odd cycle of length at mostk, then it has to go through somev∈ S and it is easy to see that there is a corresponding path of length kfrom v1 to v2 in G′. Conversely, given a pathP of (odd) lengthk from v1 to v2 in G′, there is a correspondingclosed walkP′ of (odd) lengthk in G and this implies that a subwalk ofP′ is an odd cycle of length at mostk in G.

Theorem 4.5. Given a graph G and an integer k, deciding whether G can be madebipartite by the deletionof an independent set of size exactly k is almost linear-timeFPT.

Proof. It is more convenient to consider an annotated version of theproblem where the independent setbeing deleted is required to be a subset of a setD ⊆V(G) given as part of the input. To express the originalproblem without the annotation,D is initially set toV(G). The algorithm has the following 4 stoppingconditions.

• If k= 0 andG is bipartite, then return “YES.”

• If k= 0, butG is not bipartite, then return “NO.”

• If k> 0, butG is bipartite, then decide in a polynomial time whetherG[D] has an independent set ofsize exactlyk.

• If k> 0 andG\D is not bipartite, then return “NO.”

Assume that none of the above conditions is satisfied. Then the algorithm starts by finding an odd cycleC of minimum length. For this purpose, we first invoke the algorithm of Kawarabayashi and Reed [44] tofind a setSof at mostk vertices such thatG\S is bipartite (note that we do not require here thatS is in D).If there is no such setS, then we can return “NO.” Otherwise, we can use Lemma 4.4 to find a shortest oddcycleC.

It is not difficult to see that the minimality ofC implies that eitherC is a triangle orC is chordless.Moreover, in the latter case, every vertexv not inC is adjacent to at most 2 vertices of the cycle. To see this,note first that if the length ofC is more than 3, then the minimality ofC implies thatv cannot be adjacent withtwo adjacent vertices ofC (as they would form a triangle). Thus ifv has at least 3 (nonadjacent) neighbors inC, then the length ofC is at least 7 andv has two neighborsx andy whose distance inC is at least 3. Vertices

20

Page 21: Finding small separators in linear time via treewidth

x andy split C into a path of odd length and a path of even length. Replacing the even-length path (whoselength is at least 4) with the pathxvyof length 2 gives a shorter odd cycle, contradicting the minimality ofC.

Since none of the stopping conditions holds,|V(C)∩D|> 0. If 1≤ |V(C)∩D| ≤ 3k+1, then we branchon the selection of each vertexv∈V(C)∩D into the setSof vertices being removed and apply the algorithmrecursively with the parameterk being decreased by 1 and the setD being updated by removal ofv andN(v)∩D. If |V(C)∩D| > 3k+1, then we apply the approach of Theorem 4.2 to find an independent setSof size at mostk whose removal makes the graph bipartite. To ensure thatS⊆ D we may, for example splitall verticesv∈V(G)\D into k+1 independent copies with the same neighborhood asv. If |S| = k, we aredone. Otherwise,|S| = k′ < k. In this case we observe that by construction each vertex ofS (either inC oroutsideC) forbids the selection of at most 3 vertices ofV(C)∩D (including itself, if it is inC). Thus thenumber of vertices ofV(C)∩D allowed for selection is at least 3k+1−3k′ = 3(k−k′)+1. Since the cycleis chordless, we can selectk−k′ independent vertices among them and thus complementS to being of sizeexactlyk. Therefore, if the algorithm succeeds to find an independentsetSof size at mostk whose removalmakes the graph bipartite, it may safely return “YES.” It is clear that otherwise “NO” can be returned.

4.1 Edge bipartization

It is equally natural to study the edge-deletion version of bipartization (“Given graphG and integerk,can G be made bipartite by the deletion of at mostk edges?”). Analogously toG-BIPARTIZATION, weintroduce a constrained version of the problem, where the edges removed need to form a graph belongingto a certain class. Formally, ifG is a class of graphs,G-EDGEBIPARTIZATION problem asks ifG has asubgraphH such thatH has at mostk edges,H ∈ G, andG\E(H) (i.e., removing the edges ofH) isbipartite. By a direct reduction to the vertex-deletion variant, we show that this problem is FPT wheneverG isdecidable and closed under taking subgraphs. In Section 4.2, the fixed-parameter tractability of BIPARTITE

CONTRACTION is obtained as an easy corollary of this result.The reduction is conceptually simple, but somewhat technical to describe. It is convenient to use the

generalization of Theorem 4.2 which allows graphs to have a finite number of labels (colors) on the vertices.To describe the reduction, we need the following transformation. For every graphG, we define a graphG′

where the vertices have labels from the set1,2,3 :

• For everyv∈ V(G), let V(G′) contain a label-1 vertexv1, a label-2 vertexv2, let E(G′) contain theedgev1v2,

• For everyuv∈ E(G), letV(G′) contain two label-3 verticese′,e′′, one of them adjacent tou1 andv2,the other one adjacent tou2 andv1.

The following statement is easy to see (note that the inducedsubgraph relation considered here respects thelabels):

Proposition 4.6. For two undirected graphs G and H, G′ is an induced subgraph of H′ if and only if G is asubgraph of H.

Proof. The “if” direction is obvious: the edges/vertices that are present inH but not inG correspond tovertices present inH ′ but missing fromG′. For the “only if” direction, observe that every label-1 vertex inG′ or H ′ has a unique label-2 neighbor. Therefore, for everyv∈V(G) every induced subgraph embeddingof G′ into H ′ mapsv1,v2 ∈V(G′) to w1,w2 ∈V(H ′) for somew∈V(H). Using this mapping, it is easy tosee that every vertex or edge ofG has a corresponding vertex or edge inH, i.e.,G is a subgraph ofH.

Theorem 4.7. If G is decidable and closed under taking subgraphs, thenG-EDGEBIPARTIZATION is almostlinear-time FPT parameterized by k.

21

Page 22: Finding small separators in linear time via treewidth

1

2

1

2

3

3

u v

u1

u2

v1

v2

e′

e′′

1

2

1

2

3

3

u1

u2

v1

v2

e′

e′′

4 4

44u1

u2

v1

v2

G′′G′G

Figure 4: Constructing the graphG′ andG′′ into proof Theorem 4.7.

Proof. Given an instance(G,k) of G-EDGEBIPARTIZATION, we reduce it to an instance ofGk-BIPARTIZATION

for an appropriate (finite) classGk, constructed as follows. For every graphH ∈ G having at mostk edges,let Gk containH ′ and every induced subgraph ofH ′. By definition,Gk is hereditary. Note that ifH 6∈ G, thenProp. 4.6 implies thatH ′ 6∈ Gk.

Let us constructG′ from G. We extendG′ to obtain a graphG′′ the following way. For everyv∈V(G),we introduce two new adjacent verticesv1, v2 having label 4. Fori = 1,2, we makevi adjacent to everyneighbor ofvi in G′. Furthermore, for every neighboru of v in G, we makevi adjacent toui .

We claim that(G,k) is a yes-instance ofG-EDGEBIPARTIZATION if and only if G′′ has a setSsuch thatG′′ \Ssuch thatG′′[S] ∈ Gk. Suppose first thatG has a subgraphH with at mostk edges such thatG\E(H)is bipartite andH is in G. ThenH ′ ∈ Gk by definition ofGk. For everyv∈V(H), let Scontain the verticesv1

andv2; for everye∈ E(H), let Scontain the label-3 verticese′,e′′ corresponding toe. Observe thatG′′[S] isisomorphic to a supergraph ofH ′ ∈ Gk: the additional edges are due to edges ofG that are not inE(H), butconnect two vertices ofV(H). Therefore,G′′[S] is in Gk.

We show thatG′′ \S is bipartite. Consider a 2-coloring ofG\E(H). If v ∈ V(G) has colori, thenlet v1, v1 have colori andv2, v2 have color 3− i (if they appear inG′′ \S). Observe that this is a proper2-coloring of these vertices: for example, ifu1 andv1 are adjacent inG′′ \Sand have the same color, thenu andv are adjacent inG and have the same color, which means thatuv∈ E(H), and thereforev1 ∈ S, acontradiction. Furthermore, for every label-3 vertex inG′′ \S, the neighbors have the same color, thus thecoloring can be extended to the label-3 vertices. To see this, recall that if a vertexe′ of G′′ \S representsan edgee= uv∈ E(G), then its neighborhood is inui ,ui ,v3−i ,v3−i for somei = 1,2. The fact thate′ isin G′′ \S implies thatuv 6∈ E(H), and thereforeu andv have different colors in the 2-coloring ofG\E(H).This means thatui ,ui,v3−i ,v3−i indeed have the same color.

Suppose now thatG′′ \S is bipartite andG′′[S] is in Gk. As S contains no vertices having label 4, wecan define a (not proper) 2-color ofG by assigning the color ofv1 to v. Let H be the subgraph ofGspanned by those edges whose endpoints have the same color. Clearly,G\E(H) is bipartite. For every edgee= uv∈ E(H), the two corresponding label-4 verticese′,e′′ in G′′ are inS: these vertices are adjacent toui

22

Page 23: Finding small separators in linear time via treewidth

1

1 2

22

2

1

1

1

2

Figure 5: A graph that can be made bipartite by removing the 5 strong edges (the numbers on the verticesshow the resulting 2-coloring). The strong edges span a graph with rank 4. Therefore, the graph can bemade bipartite by contracting four edges: contract each of the two components into a single vertex.

andv3−i (for somei = 1,2) whose colors are different. Similarly, for everyuv∈E(H), the verticesu1, u2, v1,v2 have to be inS, as each of them are adjacent to vertices of both colors. Therefore,G′′[S] ∈ Gk containsH ′

as an induced subgraph. SinceGk is hereditary, it follows thatH ′ ∈Gk. As we have observed at the beginningof the proof, this is only possible ifH ∈ G. Thus(G,k) is indeed a yes-instance ofG-BIPARTIZATION.

4.2 Bipartite contraction

If e is an edge of graphG, then thecontractionof e in G is the graphG/e obtained by identifying theendpoints ofeand removing loops and parallel edges. IfS is a set of edges inG, then we denote byG/Sthegraph obtained by contracting the edges inS in an arbitrary order until all of them are removed.

Problems defined by deleting the minimum number of edges or vertices to achieve a certain propertyhave been intensively studied in the literature, especially from the viewpoint of fixed-parameter tractabil-ity [9,31,41,44–47,51,60,66]. Recently, there has been increased interest in analogous problems defined bycontractions[2,3,27,36–38,42,64]. In many respects, deletions and contractions behave very differently. Forexample, Heggernes et al. [38] showed that BIPARTITE CONTRACTION (Given a graphG and integerk, canG be made bipartite by the contraction of at mostk edges?) is FPT, but their algorithm is significantly morecomplex than the relatively simple algorithms for the bipartite edge/vertex deletion problems [31, 49, 60].On the other hand, it seems that contraction problems fit naturally into our study of generalized bipartiza-tion. Using a simple combinatorial observation, we obtain the fixed-parameter tractability of BIPARTITE

CONTRACTION as a corollary.Let us denote byr(G) the rank of graphG, i.e., the number of edges in a spanning forest ofG (equiva-

lently, the number of vertices minus the number of connectedcomponents). Note thatr(G′)≤ r(G) for everysubgraphG′ of G. The following lemma allows us to translate bipartite contraction into an edge deletionproblem (see Figure 5):

Lemma 4.8. For every graph G and integer k, the following statements areequivalent:

(1) G has a subgraph F such that|E(F)| ≤ k and G/E(F) is bipartite, and(2) G has a subgraph H such that r(H)≤ k and G\E(H) is bipartite.

Proof. (1)⇒ (2): Let us extendF to a subgraphH of G that includes every edge ofG whose endpoints arein the same connected component ofF . Clearly, r(H) ≤ k, asF is a spanning forest ofH. We claim thatG\E(H) is bipartite. Observe that each componentK of F is an independent set inG\E(H). Therefore, a2-coloring ofG/E(F) can be turned into a 2-coloring ofG\E(H) if we color every vertex in a connectedcomponentK of F by the color of the single vertex corresponding toK in G/E(F).

23

Page 24: Finding small separators in linear time via treewidth

PSfrag replacements

(d)

CCCC

CCCCC

= k= k

= k= k

= kk

(b)

≤ k

(a) (c)

≤ k≤ k

(e)

Figure 6:(H,C,K)- (or (H,C,≤K)-) coloring with these graphs is equivalent to finding (a) a vertex coverof size at mostk, (b) an independent set of sizek, (c) a bipartization set of size at mostk, (d) an independentbipartization set of size exactlyk, (e) a bipartite independent set of sizek+k.

(2) ⇒ (1): Let us fix a 2-coloring ofG\E(H). We can assume thatH is minimal, i.e.,G\E(H ′) isnot bipartite for any proper subgraphH ′ of H (here we use thatr(H) is monotone under taking subgraphs).Therefore, in each connect component ofH, every vertex has the same color in the 2-coloring ofG\E(H).This means that contracting each connected component ofH to a single vertex creates a bipartite graph. Sucha contraction can be achieved by contracting the edges of a spanning forestF of H, which hasr(H) ≤ kedges.

By Lemma 4.8, BIPARTITE CONTRACTION is equivalent toGk-EDGEBIPARTIZATION, whereGk is theset of all graphsG with r(G)≤ k. Thus fixed-parameter tractability follows from Theorem 4.7.

Theorem 4.9. BIPARTITE CONTRACTION is almost linear-time FPT.

5 (H,C,K)-coloring

Constrained bipartization can be also considered in terms of (H,C,K)-coloring. H-coloring (cf. [39]) is ageneralization of ordinary vertex coloring: given graphsG andH, anH-coloring of G is a homomorphismθ : V(G)→V(H), that is, ifu,v∈V(G) are adjacent inG, thenθ(u) andθ(v) are adjacent inH (includingthe possibility thatθ(u) = θ(v) is a vertex ofH having a loop). It is easy to see that a graph isk-colorableif and only if it has aKk-coloring. A seminal dichotomy result of Hell and Nesetril [40] characterizes thecomplexity of finding anH-coloring for everyH: it is polynomial-time solvable ifH is bipartite or has aloop, and NP-hard otherwise.

Various generalizations ofH-coloring were explored in the literature, and it was possible to obtaindichotomy theorems in many cases [8, 22, 23, 26, 33–35, 39, 40]. Here we study the version of the problemallowing cardinality constraints [16–19] where, for certain verticesv∈V(H), we have a restriction on howmany vertices ofG can map tov. Formally, letC⊆V(H) be a subset of vertices and letK be a mapping fromC to Z

+. An (H,C,K)-coloring of G is anH-coloring with the additional restriction that|θ−1(v)| = K(v)for everyv∈C. (H,C,≤K)-coloring is the variant of the problem where we require|θ−1(v)| ≤ K(v), i.e.,vertexv can be usedat most K(v) times. As shown in Fig. 6 and discussed in [16], this is a very aversatileproblem formulation: these coloring requirements can express a wide range of fundamental problems suchask-INDEPENDENT SET, k-VERTEX COVER, BIPARTIZATION, and (EXACT) STABLE BIPARTIZATION.

Following [16], we consider the parameterized version of(H,C,K)-coloring, where the parameter isk :=∑v∈C K(v), the total number of times the vertices with cardinality constrains can be used. Dıaz et al. [16]started the program of characterizing the easy and hard cases of (H,C,K)- and(H,C,≤K)-coloring. Wemake progress in this direction by showing that(H,C,≤K)-coloring is FPT wheneverH \C consists of twoadjacent vertices without loops. The reader might considerthis result as only a humble step towards a fulldichotomy, but let us note that, as shown in Fig. 6(c,d), thisnontrivial case already includes BIPARTIZATION

24

Page 25: Finding small separators in linear time via treewidth

(whose parameterized complexity was open for a long time [49, 60]) and STABLE BIPARTIZATION (whosecomplexity is resolved first in this paper).

We believe that by obtaining a better understanding of parameterized separation problems, it might bepossible to obtain a full dichotomy for parameterized(H,C,≤K)-coloring. However, it is important to notethat (H,C,K)-coloring behaves very differently, and we cannot hope for afull dichotomy of (H,C,K)-coloring at this point. As Fig. 6(e) shows, BIPARTITE INDEPENDENT SET (find disjoint setsS1, S2, eachof size k, such that there is no edge with one endpoint inS1 and one endpoint inS2) is a special caseof (H,C,K)-coloring. The parameterized complexity of BIPARTITE INDEPENDENT SET (or equivalently,BICLIQUE in the complement graph) is a longstanding open question. Wecannot obtain a dichotomy for(H,C,K)-coloring without resolving this question first.

It will be convenient to prove the fixed-parameter tractability result for an even more general problem:in list (H,C,≤K)-coloring the input contains a listL(v) ⊆ V(H) for each vertexv ∈ V(G) and θ has tosatisfy the additional requirement thatθ(v) ∈ L(v) for everyv∈V(G). The main result of the section is thefollowing:

Theorem 5.1. For every fixed H, list(H,C,≤K)-coloring is almost linear-time FPT if H\C is a single edgewithout loops.

We start with the introduction of new terminology. Given a graphG, a triple(H,C,K) as in the statementof the theorem, andL : V(G) → 2V(H) associating each vertex ofG with the set of allowed vertices ofH,we say thatθ is an(H,C,≤K)-coloring of (G,L) if θ is an(H,C,≤K)-coloring of G such that for eachv∈V(G), θ(v) ∈ L(v). Theexceptional setof θ is the setSof all vertices ofG that are mapped toC by θ .SinceH \C consists of two vertices without loops,G\S is bipartite. Moreover, the size ofS is bounded bythe parameterk := ∑v∈C K(v). Thus the considered problem is in fact a problem of constrained bipartization.

There is an important detail that makes(H,C,≤K)-coloring different than the bipartization problems ofSection 4. The exceptional set of a solutionθ is a bipartization set, but it is not true that there is alwaysa solution whose exceptional set is an inclusionwise minimal bipartization set (see Example 5.3 below).Therefore, we cannot straightforwardly use the approach ofTheorem 4.2 and reduce the problem to findinga minimal separator. Nevertheless, we will restrict our attention to solutions where the exceptional set isinclusionwise minimal and argue that treewidth reduction can be performed in a way that preserves all thesesolutions.

Definition 5.2. An(H,C,≤K)-coloringθ of (G,L) is minimal if there is no(H,C,≤K)-coloringθ ′ of (G,L)such that the exceptional set ofθ ′ is a subset of the exceptional set ofθ .

Observe that if there is an(H,C,≤K)-coloring of(G,L), then there is a minimal(H,C,≤K)-coloring aswell.

Example 5.3.Let H be a 5-cycle on verticesa,b,c,d,e, letC= c,d,e, and letK(c) =K(d) =K(e) = 3(see Figure 7). LetG be a cycle of length 15 and letL(v) = a,b,c,d,e for everyv∈ V(G). Removingany vertex ofG makes it bipartite, thus every inclusionwise minimal bipartization set is of size 1. On theother hand, a simple case analysis shows that every solutionθ of (G,L) has at least 3 exceptional vertices.Thus the coloring in Figure 7(b) having 3 exceptional vertices is minimal in the sense of Definition 5.2. Thecoloring in Figure 7(c) having 9 exceptional vertices is notminimal.

We prove that there is an FPT-computable graphG∗ that preserves exceptional sets of all minimal(H,C,≤K)-colorings of(G,L) and whose treewidth is bounded by a function ofk (recall thatk=∑v∈C K(v)).Similarly to the cases ofG-M INCUT andG-BIPARTIZATION, we use this result to transform the given in-stance of the(H,C,≤K)-coloring problem to an instance with bounded treewidth andthen apply Courcelle’sTheorem.

25

Page 26: Finding small separators in linear time via treewidth

PSfrag replacements

(a)

bbaaabedc

C

babbaaaedc

(c)c

c

d

d

e

e

aa bb

cc

dd

eeaa aa

aaa

b

(b)

e

d

cb

a

b

bb b

bbb

Figure 7: (a) A 5-cycleH with 3 constrained vertices, (b) a minimal coloring of the 15-cycle, (c) a non-minimal coloring of the 15-cycle.

We first show how the treewidth can be reduced in the special case whenG is bipartite (Lemma 5.4)),which makes it possible to apply Courcelle’s Theorem (Lemma5.5). It turns out that the general case(whenG is nonbipartite) can be easily reduced to the bipartite case: we find a small setS′ of vertices whoseremoval makes the graph bipartite, guess the coloring of these vertices, modify the lists of their neighborsaccordingly, and then remove the vertices ofS′ from the graph.

Lemma 5.4. Assume that G is bipartite. Then there is a linear-time FPT algorithm parameterized byk= ∑v∈V(C) K(v) that finds a set C′′ such that the treewidth oftorso(G,C′′) is at most f(k, |V(H)|) for somefunction f and the exceptional set of every minimal(H,C,≤K)-coloring of(G,L) is a subset of C′′.

Proof. The proof is by induction onk. Fork= 0, we can setC′′ = /0, hence torso(G,C′′) is the empty graphwhose treewidth is 0. Assume now thatk> 0. Denote the vertices ofH \C by b andw. Let B be the set ofall verticesv∈V(G) such thatw /∈ L(v). Analogously, letW be the set of all verticesv∈ V(G) such thatb /∈ L(v). Let (B′,W′) be a 2-coloring ofG and setX := (B∩B′)∪ (W∩W′) andY := (B∩W′)∪ (W∩B′)as in Lemma 4.1. If there is no path fromX to Y, then, by Lemma 4.1, there is a 2-coloring ofG whereBandW are colored in black and white respectively. In other words,there is a(H,C,≤K)-coloring of(G,L)where each vertex ofG is mapped tob andw. Consequently, all minimal(H,C,≤K)-colorings of(G,L)have exceptional sets of size 0 and henceC′′ = /0 as in the case withk= 0.

If there is a path connectingX andY, then let us use Lemma 3.9 to compute in FPT-time a setC′ suchthat every minimal set of size at mostk separatingX andY in G is a subset ofC′ and the treewidth oftorso(G,C′) is bounded by a function ofk. Let P be a connected component ofG\C′ and letN be thesubset ofC′ that consists of all vertices adjacent to the vertices ofP. Let θ be an(H,C,≤K)-coloring of(G[N],L[N]) whereL[N] is the restriction ofL to the vertices ofN. Let Lθ be the function onV(P) obtainedfrom L[V(P)] by the following operation: for eachv∈V(P), removeu∈ L(v) from the list ofv wheneverthere is a neighborx of v in G such thatx ∈ N andθ(x) is not adjacent tou in H. In other words,Lθ isan updated version ofL that allows colors onV(P) so that they are compatible with the mapping ofθ onN. Furthermore, let us consider every functionK′ : C → Z

+ associating the vertices ofC with integers sothat ∑v∈C K′(v) ≤ k− 1. By the induction assumption there is an FPT algorithm parameterized byk− 1that returns a setCP,θ ,K′ ⊆V(P) such that torso(P,CP,θ ,K′) has the treewidth bounded by af (k−1, |V(H)|)and the exceptional set of any minimal(H,C,≤ K′)-coloring of(P,Lθ) is a subset ofCP,θ ,K′ . LetCP be theunion of all possible setsCP,θ ,K′ . Observe that the number of possible mappingsθ is bounded by a functionof k and |V(H)|: the vertices ofN form a clique in torso(G,C′), hence|N| is bounded by the treewidth oftorso(G,C′) plus 1, which is bounded by a function ofk. Furthermore, the number of possible mappingsK′ is bounded by a function ofk− 1 and|V(H)|. Therefore by Lemma 2.8, the treewidth of torso(P,CP)is bounded by a function ofk and |V(H)|. Let C′′ be the union ofC′ and the setsCP for all the connectedcomponentsP of G\C′. According to Lemma 2.9, the treewidth of torso(G,C′′) is bounded byf (k, |V(H)|)for an appropriately selected functionf . (Such function can be defined similarly to functiong in the proof

26

Page 27: Finding small separators in linear time via treewidth

of Lemma 2.11). Also, arguing similarly to Lemma 2.11, we canobserve thatC′′ can be computed in FPTtime parameterized byk.

It remains to be shown that the exceptional setS of every minimal(H,C,≤K)-coloring θ of (G,L)is a subset ofC′′. Since inG\S vertices ofB\S are colored in black (i.e., mapped tob by θ ) and thevertices ofW\Sare colored in white (i.e., mapped tow by θ ), SseparatesX andY according to Lemma 4.1.Therefore,Scontains at least one element ofC′. Consequently, for any connected componentP of G\C′,|S∩V(P)| ≤ k− 1. Let θP be the restriction ofθ to the vertices ofP and for each vertexv of C ⊆ V(H)defineK′(v) as the number of vertices ofP mapped tov by θP. Let θ ′ be the restriction ofθ to the verticesof C′ adjacent toV(P). It is not hard to observe thatθP is a minimal(H,C,≤ K′)-coloring of (P,Lθ ′). Inother words,S∩V(P)⊆CP,θ ′,K′ ⊆CP. Since each vertexv belongs either toC′ or to someV(P), the presentlemma follows.

A standard application of Courcelle’s Theorem shows that(H,C,≤K)-coloring is linear-time solvableon bounded treewidth graphs. A possible construction of therequired MSO sentence is in the appendix.

Lemma 5.5. For every fixed H, k, and w,(H,C,≤K)-coloring can be solved in linear time, where w is thetreewidth of G.

For the proof of Theorem 5.1, we use Lemma 5.4 to reduce treewidth and then apply Lemma 5.5 to solvethe problem on the reduced graph. We need additional arguments to handle the coloring of the componentsof G\C′′.

Proof of Theorem 5.1.First we show that it can be assumed thatG is bipartite. Otherwise, we use the FPTalgorithm of Kawarabayashi and Reed [44] to find a setS′ of at mostk vertices whose deletion makesGbipartite (if there is no such set, “NO” can be returned). We branch on the|V(H)||S′| possible ways ofdefiningθ on S′. For each of these ways we appropriately update the values ofK(v) for all v∈C. Also, ifa vertexv∈V(G)\S′ has a neighboru∈ S′, then we modify the list ofv such that it contains only verticesadjacent toθ(u) in H. It is clear that the original instance has a solution if and only if at least one of theresulting instances has a solution.

As G is bipartite, we can use Lemma 5.4 to obtain the setC′′. We transformG the following way. LetPi

be a connected component ofG\C′′ having more than one vertex. Let(Xi,Yi) be the bipartition ofPi (uniquedue to the connectedness ofPi). We replacePi by two adjacent verticesxi andyi such thatxi (resp.,yi) isadjacent with the neighborhood ofXi (resp.,Yi) in C′′. We defineL(xi) = b,w∩⋂

v∈XiL(v), andL(yi) is

defined analogously. LetG′ be the graph obtained after performing this operation for every componentP,and letL′ be the resulting list assignment onG′. We have torso(G,C′′) = torso(G′,C′′) and every componentof G′ \C′′ contains at most two vertices. Thus Lemma 2.8 implies that the treewidth ofG′ is larger than thetreewidth of torso(G,C′′) by at most 2 and hence it is bounded by a function ofk.

We claim that(G,L) has an(H,C,≤K)-coloring if and only if (G′,L′) has an(H,C,≤K)-coloring,hence we can use Lemma 5.5 to solve the problem. Suppose first thatθ is a minimal(H,C,≤K)-coloring of(G,L). We know that the exceptional set ofθ is contained inC′′, thus vertices of a componentP of G\C′′

are mapped tob andw. Thus if(Xi,Yi) is the bipartition ofPi, then due toPi being a connected graph, everyvertex ofXi is mapped to the same vertex ofH \C and similarly forYi . Thus by mappingxi andyi to thesevertices inG′, we can obtain an(H,C,≤K)-coloring of(G′,L′).

Suppose now that(G′,L′) has an(H,C,≤K)-coloring θ ′. Again, letPi be a component ofG\C′′ withbipartition (Xi,Yi). We can obtain an(H,C,≤K)-coloring θ of (G,L) by mapping every vertex ofX toθ ′(xi) ∈ b,w and every vertex ofYi to θ ′(yi) ∈ b,w.

27

Page 28: Finding small separators in linear time via treewidth

6 Conclusions

We have presented a general methodology for showing that restricted separation problems can be solved inlinear time for every fixed boundk on the size of the separator. This technique allows us to prove fixed-parameter tractability results in an easy way for quite natural problems (such as MINIMUM STABLE s− tCUT) whose parameterized complexity status was open. The connection between separators and bipartiza-tion problems, as first developed by Reed et al. [60], makes itpossible to use our results for constrainedbipartization and certain homomorphism problems.

The results of the paper raise some obvious open questions for future work:

• The treewidth bound of Lemma 2.11 is exponential ink, which implies that the running time of thealgorithms obtained this way are typically at least double exponential ink. Is it possible to improvethis dependence onk in the running time to 2poly(k), at least for some basic concrete problems such asM INIMUM STABLE s− t CUT?

• Section 3.3 dealing with CONNECTED s− t CUT shows that our technique can be extended in non-trivial ways to handle certain nonhereditary restrictions. It would be interesting to explore other suchextensions.

• Is it possible to extend our techniques to handle global restrictions such as balance requirements(c.f. [24])?

• Is there some way of extending these results (at least partially) to directed graphs?

• Can we introduce treewidth reduction into the MULTICUT algorithm of [54] to obtain more generalresults? For example, is MULTICUT, parameterized by the sizek of the solution, is FPT with theadditional restriction that the solution induces an independent set? It would be interesting to see thetreewidth reduction of the current paper can be combined with the “random sampling of importantseparators” technique of [54].

• An obvious goal is to prove an FPT vs. W[1]-hardness dichotomy result for parameterized(H,C,K)-and (H,C,≤K)-coloring. For(H,C,≤K)-coloring, this might be doable, but (as discussed in Sec-tion 5) for (H,C,K)-coloring this would require first understanding the parameterized complexity ofBICLIQUE, which is a notorious open problem.

References

[1] N. Bansal, A. Blum, and S. Chawla. Correlation clustering. Machine Learning, 56(1-3):89–113, 2004.

[2] R. Belmonte, P. A. Golovach, P. Heggernes, P. van ’t Hof, M. Kaminski, and D. Paulusma. Findingcontractions and induced minors in chordal graphs via disjoint paths. Accepted to ISAAC 2011.

[3] R. Belmonte, P. Heggernes, and P. van ’t Hof. Edge contractions in subclasses of chordal graphs. InTAMC, pages 528–539, 2011.

[4] A. Bjorklund, T. Husfeldt, P. Kaski, and M. Koivisto. Fourier meets Mobius: fast subset convolution.In STOC’07—Proceedings of the 39th Annual ACM Symposium on Theory of Computing, pages 67–74.ACM, New York, 2007.

[5] H. L. Bodlaender. Treewidth: Characterizations, applications, and computations. InWG, pages 1–14,2006.

28

Page 29: Finding small separators in linear time via treewidth

[6] H. L. Bodlaender, M. R. Fellows, P. Heggernes, F. Mancini, C. Papadopoulos, and F. A. Rosamond.Clustering with partial information.Theor. Comput. Sci., 411(7-9):1202–1211, 2010.

[7] N. Bousquet, J. Daligault, and S. Thomasse. Multicut isfpt. In STOC, pages 459–468, 2011.

[8] R. C. Brewster, P. Hell, and G. MacGillivray. The complexity of restricted graph homomorphisms.Discrete Mathematics, 167-168:145–154, 1997.

[9] L. Cai. Fixed-parameter tractability of graph modification problems for hereditary properties.Inform.Process. Lett., 58(4):171–176, 1996.

[10] L. S. Chandran and T. Kavitha. The treewidth and pathwidth of hypercubes. Discrete Math.,306(3):359–365, 2006.

[11] J. Chen, Y. Liu, and S. Lu. An improved parameterized algorithm for the minimum node multiway cutproblem. InWADS, pages 495–506, 2007.

[12] J. Chen, Y. Liu, S. Lu, B. O’Sullivan, and I. Razgon. A fixed-parameter algorithm for the directedfeedback vertex set problem.J. ACM, 55(5), 2008.

[13] B. Courcelle. Graph rewriting: an algebraic and logic approach. InHandbook of theoretical computerscience, Vol. B, pages 193–242. Elsevier, Amsterdam, 1990.

[14] E. Demaine, G. Z. Gutin, D. Marx, and U. Stege. Seminar 07281 open problems. InStructure Theoryand FPT Algorithmics for Graphs, Digraphs and Hypergraphs, Dagstuhl Seminar Proceedings, 2007.

[15] E. D. Demaine, D. Emanuel, A. Fiat, and N. Immorlica. Correlation clustering in general weightedgraphs.Theor. Comput. Sci., 361(2-3):172–187, 2006.

[16] J. Dıaz, M. Serna, and D. M. Thilikos.(H,C,K)-coloring: fast, easy, and hard cases. InMathematicalfoundations of computer science, 2001 (Marianske Lazne), volume 2136 ofLecture Notes in Comput.Sci., pages 304–315. Springer, Berlin, 2001.

[17] J. Dıaz, M. J. Serna, and D. M. Thilikos. The restrictive H-coloring problem. Discrete AppliedMathematics, 145(2):297–305, 2005.

[18] J. Dıaz, M. J. Serna, and D. M. Thilikos. Complexity issues on bounded restrictiveH-coloring.DiscreteMathematics, 307(16):2082–2093, 2007.

[19] J. Dıaz, M. J. Serna, and D. M. Thilikos. Efficient algorithms for counting parameterized listH-colorings.J. Comput. Syst. Sci., 74(5):919–937, 2008.

[20] R. G. Downey and M. R. Fellows.Parameterized Complexity. Monographs in Computer Science.Springer, New York, 1999.

[21] S. E. Dreyfus and R. A. Wagner. The Steiner problem in graphs.Networks, 1:195–207, 1971/72.

[22] T. Feder, P. Hell, and J. Huang. List homomorphisms and circular arc graphs. Combinatorica,19(4):487–505, 1999.

[23] T. Feder, P. Hell, and B. Mohar. Acyclic homomorphisms and circular colorings of digraphs.SIAM J.Discrete Math., 17(1):161–169, 2003.

[24] U. Feige and M. Mahdian. Finding small balanced separators. InSTOC 2006, pages 375–384. ACM,2006.

29

Page 30: Finding small separators in linear time via treewidth

[25] J. Flum and M. Grohe.Parameterized Complexity Theory. Springer, 2006.

[26] A. Galluccio, P. Hell, and J. Nesetril. The complexity of H-colouring of bounded degree graphs.Discrete Mathematics, 222(1-3):101–109, 2000.

[27] P. Golovach, M. Kaminski, D. Paulusma, and D. Thilikos.Increasing the minimum degree of a graphby contractions. Accepted to IPEC 2011.

[28] G. Gottlob and S. T. Lee. A logical approach to multicut problems.Inform. Process. Lett., 103(4):136–141, 2007.

[29] M. Grohe. Logic, graphs, and algorithms. In J. Flum, E. Gradel, and T. Wilke, editors,Logic andAutomata- History and Perspectives. Amsterdam University Press, 2007.

[30] S. Guillemot. FPT algorithms for path-transversals and cycle-transversals problems in graphs. InIWPEC, pages 129–140, 2008.

[31] J. Guo, J. Gramm, F. Huffner, R. Niedermeier, and S. Wernicke. Compression-based fixed-parameteralgorithms for feedback vertex set and edge bipartization.J. Comput. System Sci., 72(8):1386–1396,2006.

[32] J. Guo, F. Huffner, E. Kenar, R. Niedermeier, and J. Uhlmann. Complexity and exact algorithms forvertex multicut in interval and bounded treewidth graphs.European Journal of Operational Research,186(2):542–553, 2008.

[33] A. Gupta, P. Hell, M. Karimi, and A. Rafiey. Minimum cost homomorphisms to reflexive digraphs. InLATIN, pages 182–193, 2008.

[34] G. Gutin, P. Hell, A. Rafiey, and A. Yeo. Minimum cost homomorphisms to proper interval graphs andbigraphs.CoRR, abs/cs/0602038, 2006.

[35] G. Gutin, P. Hell, A. Rafiey, and A. Yeo. A dichotomy for minimum cost graph homomorphisms.Eur.J. Comb., 29(4):900–911, 2008.

[36] P. Heggernes, P. van ’t Hof, B. Leveque, D. Lokshtanov, and C. Paul. Contracting graphs to paths andtrees.CoRR, abs/1104.3677, 2011. Accepted to IPEC 2011.

[37] P. Heggernes, P. van ’t Hof, B. Leveque, and C. Paul. Contracting chordal graphs and bipartite graphsto paths and trees.Electronic Notes in Discrete Mathematics, 37:87–92, 2011.

[38] P. Heggernes, P. van ’t Hof, D. Lokshtanov, and C. Paul. Obtaining a bipartite graph by contractingfew edges.CoRR, abs/1102.5441, 2011. Accepted to FSTTCS 2011.

[39] P. Hell. From graph colouring to constraint satisfaction: there and back again. InTopics in discretemathematics, volume 26 ofAlgorithms Combin., pages 407–432. Springer, Berlin, 2006.

[40] P. Hell and J. Nesetril. On the complexity ofH-coloring. J. Combin. Theory Ser. B, 48(1):92–110,1990.

[41] F. Huffner, C. Komusiewicz, H. Moser, and R. Niedermeier. Fixed-parameter algorithms for clustervertex deletion.Theory Comput. Syst., 47(1):196–217, 2010.

[42] M. Kaminski, D. Paulusma, and D. M. Thilikos. Contractions of planar graphs in polynomial time. InESA (1), pages 122–133, 2010.

30

Page 31: Finding small separators in linear time via treewidth

[43] I. Kanj. Open problem session of Dagstuhl seminar 08431, 2008.

[44] K. Kawarabayashi and B. Reed. An (almost) linear time algorithm for odd cyles transversal. InSODA’10: Proceedings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms, pages 365–378,2010.

[45] M. S. Krishnamoorthy and N. Deo. Node-deletion NP-complete problems.SIAM J. Comput., 8(4):619–625, 1979.

[46] J. M. Lewis and M. Yannakakis. The node-deletion problem for hereditary properties is NP-complete.J. Comput. System Sci., 20(2):219–230, 1980.

[47] D. Lokshtanov. Wheel-free deletion is W[2]-hard. InProceedings of the International Workshop onParameterized and Exact Computation (IWPEC 2008), volume 5018 ofLecture Notes in ComputerScience, pages 141–147. Springer, 2008.

[48] D. Lokshtanov and J. Nederlof. Saving space by algebraization. InSTOC, pages 321–330, 2010.

[49] D. Lokshtanov, S. Saurabh, and S. Sikdar. Simpler parameterized algorithm for oct. InIWOCA, pages380–384, 2009.

[50] D. Marx. Parameterized graph separation problems.Theoretical Computer Science, 351(3):394–406,2006.

[51] D. Marx. Chordal deletion is fixed-parameter tractable. Algorithmica, 57(4):747–768, 2010.

[52] D. Marx, B. O’Sullivan, and I. Razgon. Treewidth reduction for constrained separation and bipartiza-tion problems. InSTACS, pages 561–572, 2010.

[53] D. Marx and I. Razgon. Constant ratio fixed-parameter approximation of the edge multicut problem.Inf. Process. Lett., 109(20):1161–1166, 2009.

[54] D. Marx and I. Razgon. Fixed-parameter tractability ofmulticut parameterized by the size of the cutset.In STOC, pages 469–478, 2011.

[55] J. Nederlof. Fast polynomial-space algorithms using mobius inversion: Improving on steiner tree andrelated problems. InICALP (1), pages 713–725, 2009.

[56] R. Niedermeier. Invitation to fixed-parameter algorithms, volume 31 ofOxford Lecture Series inMathematics and its Applications. Oxford University Press, Oxford, 2006.

[57] J.-C. Picard and M. Queyranne. On the structure of all minimum cuts in a network and applications.Math. Programming Stud., (13):8–16, 1980. Combinatorial optimization, II (Proc. Conf., Univ. EastAnglia, Norwich, 1979).

[58] I. Razgon and B. O’Sullivan. Almost 2-SAT is fixed-parameter tractable. InICALP (1), pages 551–562, 2008.

[59] B. Reed. Tree width and tangles: A new connectivity measure and some applications. In R. Bailey,editor,Surveys in Combinatorics, volume 241 ofLMS Lecture Note Series, pages 87–162. CambridgeUniversity Press, 1997.

[60] B. Reed, K. Smith, and A. Vetta. Finding odd cycle transversals. Operations Research Letters,32(4):299–301, 2004.

31

Page 32: Finding small separators in linear time via treewidth

[61] M. Samer and S. Szeider. Complexity and applications ofedge-induced vertex-cuts.CoRR,abs/cs/0607109, 2006.

[62] P. D. Seymour and R. Thomas. Graph searching and a min-max theorem for tree-width.J. Comb.Theory, Ser. B, 58(1):22–33, 1993.

[63] C. Sloper and J. A. Telle. An overview of techniques for designing parameterized algorithms.Comput.J., 51(1):122–136, 2008.

[64] P. van ’t Hof, M. Kaminski, D. Paulusma, S. Szeider, and D. M. Thilikos. On contracting graphs tofixed pattern graphs. InSOFSEM, pages 503–514, 2010.

[65] M. Xiao. Simple and improved parameterized algorithmsfor multiterminal cuts. Theory Comput.Syst., 46(4):723–736, 2010.

[66] M. Yannakakis. Edge-deletion problems.SIAM J. Comput., 10(2):297–309, 1981.

32

Page 33: Finding small separators in linear time via treewidth

A Logical sentences

A.1 MSO formula in the proof of Theorem 3.1

The part ofϕ describing the separation ofsandt is based on the ideas from [28]. The detailed constructionis given below. We assume that the two special verticess andt are labeled in the graph: there is a unaryrelationST= s, t.

We construct the formulaϕ as

ϕ = ∃C(AtMostk(C)∧Separates(C)∧ InducesG(C)),

where AtMostk(C) is true if and only if|C| ≤ k, Separates(C) is true if and only ifC separates the verticesof ST in G∗, InducesG(C) is true if and onlyC induces a graph ofG.

In particular, AtMostk(C) states thatC does not havek+ 1 mutually non-equal elements: this can beimplemented as

∀c1, . . . ,∀ck+1

1≤i, j≤k+1

(ci = c j).

Formula Separates(C) is a slightly modified formula uvmc(X) from [28] that looks as follows:

∀s∀t(

(ST(s) ∧ ST(t) ∧ ¬(s = t)))

→(

¬C(s) ∧ ¬C(t) ∧ ∀Z(Connects(Z,s, t) → ∃v(C(v) ∧ Z(v))))

,

where Connects(Z,s, t) is true if and only if in the modeling graph there is a path fromsandt all vertices ofwhich belong toZ. For definition of the predicate Connects, see Definition 3.1in [28]

To construct InducesG(C), we explore all possible graphs having at mostk vertices and for each ofthese graphs we check whether it belongs toG. Since the number of graphs being explored depends onk andG is a decidable class, we can compile the setG′

1, . . . ,G′r of all graphs of at mostk vertices that

belong toG in time depending only onk. Let k1, . . .kr be the respective numbers of vertices ofG′1, . . .G

′r .

Then InducesG(C) = Induces1(C)∨·· ·∨ Inducesr(C), where Inducesi(C) states thatC inducesG′i. To define

Inducesi, let v1, . . .vki be the set of vertices ofG′i and define Adjacency(c1, . . . ,cki ) as the conjunction of all

E(cx,cy) such thatvx andvy are adjacent inG′i. Then

Inducesi(C) = AtMostki (C) ∧ ∃c1 . . .∃cki

(

1≤ j≤ki

C(c j) ∧∧

1≤x,y≤ki

(cx 6= cy) ∧ Adjacency(c1, . . . ,cki ))

.

Let us now verify that indeedG1 |= ϕ if and only if (G∗,s, t,k) is a ‘YES’ instance of theG-M INCUT

problem. Assume first the latter and letS be ans− t separator of size at mostk such thatG∗[S] ∈ G.Let us observe that all the three main conjuncts ofϕ quantified byC are satisfied whenS is substitutedinsteadC. That AtMostk(S) is true immediately follows from the pigeonhole principle:if we takek+ 1elements out of a set of at mostk elements, at least 2 of them must be equal. To show that Separates(S)is true w.r.t. G1, we draw the following line of implications. SetS separatess and t in G∗, hence theset of vertices of every path froms to t intersects withS, hence every setZ including as a subset a setof vertices of a path froms to t intersects withS. Formally written, the last statement can be expressedas follows∀Z(Connects(Z,s, t) → ∃v(S(v)∧Z(v))), but this (together with the fact thatS is disjoint withs, t) is the right-hand part of the main implication of Separates(S), hence Separates(S) is true. To verifythat InducesG(S) is true w.r.t.G1, let G′

i ∈ G be the graph isomorphic toG∗[S] and observe that Inducesi(S)is true by construction.

For the opposite direction assume thatG1 |= ϕ . It follows that there is a set of verticesC such thatAtMostk(C), Separates(C), and InducesG(C) are all true. Consequently,|C| ≤ k. Indeed otherwise, we canselectk+1 distinct elements ofC that falsify AtMostk(C). It also follows thatC is disjoint withs, t and

33

Page 34: Finding small separators in linear time via treewidth

separatess from t in G∗. Indeeds andt satisfy the left part of the main implication of Separates(C), hencethe right part of it must be satisfied as well. It immediately implies thatC is disjoint with s andt. If weassume thatC does not separates andt then there is a pathP from s to t avoidingC. Let Z =V(P). ThenConnects(V(P),s, t) is true while∃v(C(v)∧Z(v)) is false, falsifying the last conjunct of the right part of themain implication, a contradiction. Finally, it follows from InducesG(C) that Inducesi(C) is true for somei.By construction, this means thatG∗[C] is isomorphic toG′

i ∈ G. Thus(G∗,s, t,k) is a ‘YES’ instance of theG-M INCUT problem.

A.2 MSO formula in the proof of Lemma 5.5

Let (G,L) be an instance of the(H,C,≤K)-coloring. For eachx∈V(H), letLx be the subset ofV(G) consist-ing of all verticesvsuch thatx∈ L(v). Denote the vertices ofH byx1, . . . ,xr and letG1=(V(G),E(G),Lx1, . . . ,Lxr )be a labeled graph. We construct a formulaϕ such thatG1 |= ϕ if and only if there is a(H,C,≤K)-coloringof (G,L).

The formulaϕ is defined as

∃V1∃V2 . . .∃Vr

(

1≤i≤rxi∈C

AtMostK(xi )(Vi)∧partition(V1, . . . ,Vr )∧∧

1≤i≤r

subset(Vi ,Lxi )

∧∧

xi ,xj∈V(H)xixj 6∈E(H)

∀v,u((Vi(v)∧Vi(u))→¬E(v,u)))

,

wherepartition(V1, . . . ,Vr) :=

(

1≤i< j≤r

disjoint(Vi ,Vi))

∧(

∀v∨

1≤i≤r

Vi(v))

expresses that(V1, . . . ,Vr) is a partition ofV(G) and

subset(A,B) := ∀v(A(v)→ B(v))

is true if and only ifA⊆ B.

It is not hard to see thatG1 |= ϕ if and only if for some choice ofV1, . . . ,Vr there is an(H,C,≤K)-coloringθ of (G,L) defined byθ(v) = xi if and only if v∈Vi . Note furthermore that the length ofϕ dependsonly onk andH.

34