Parameterized Complexity of Deletion to Scattered Graph Classes ∗

Ashwin Jacob1, Jari J. H. de Kroon2, Diptapriyo Majumdar3, and Venkatesh Raman1

1The Institute of Mathematical Sciences, HBNI, Chennai, India {ajacob|vraman}@imsc.res.in 2Eindhoven University of Technology, The Netherlands [email protected] 3Royal Holloway, University of London, United Kingdom [email protected]

Abstract Graph-modification problems, where we add/delete a small num- ber of vertices/edges to make the given graph to belong to a simpler graph class, is a well-studied optimization problem in all algorith- mic paradigms including classical, approximation and parameterized complexity. Specifically, graph-deletion problems, where one needs to delete at most k vertices to place it in a given non-trivial hereditary (closed under induced subgraphs) graph class, captures several well- studied problems including Cover, Feedback Vertex Set, Odd Transveral, Cluster Vertex Deletion, and Per- fect Deletion. Investigation into these problems in parameterized complexity has given rise to powerful tools and techniques. While a precise characterization of the graph classes for which the problem is fixed-parameter tractable (FPT) is elusive, it has long been known that if the graph class is characterized by a finite set of forbidden graphs, arXiv:2105.04660v1 [cs.DS] 10 May 2021 then the problem is FPT. In this paper, we initiate a study of a natural variation of the problem of deletion to scattered graph classes where we need to delete at most k vertices so that in the resulting graph, each connected belongs to one of a constant number of graph classes. A simple hitting set based approach is no longer feasible even if each of the graph classes is characterized by finite forbidden sets.

∗Preliminary version of the paper appeared in proceedings of IPEC 2020

1 As our main result, we show that this problem is fixed-parameter tractable (FPT) when the deletion problem corresponding to each of the finite classes is known to be FPT and the properties that a graph belongs to each of the classes is expressible in CMSO logic. When each graph class has a finite forbidden set, we give a faster FPT using the well-known techniques of iterative compres- sion and important separators.

2 1 Introduction

Graph modification problems, where we want to modify a given graph by adding/deleting vertices/edges to obtain a simpler graph are well-studied problems in algorithmic . Starting from the classical work of Lewis and Yannakakis [10] (see also [18]) who showed the problem NP- complete for the resulting simpler graph belonging to any non-trivial (the graph property is true for infinitely many graphs and false for infinitely many graphs) hereditary graph class (closed under induced subgraphs), the complexity of the problem has been studied in several algorithmic paradigms including approximation and parameterized complexity. Specifically, deleting at most k vertices to a fixed hereditary graph class is an active area of research in parameterized complexity over the last several years yielding several powerful tools and techniques. Examples of such problems include Vertex Cover, Cluster Vertex Deletion, Feedback Vertex Set and Chordal Vertex Deletion. It is well-known that any hereditary graph class can be described by a forbidden set of graphs, finite or infinite, that contains all minimal forbidden graphs in the class. In parameterized complexity, it is known that the deletion problem is fixed-parameter tractable (FPT) as long as the resulting hereditary graph class has a finite forbidden set [2]. This is shown by an easy reduction to the Bounded Hitting Set problem. This includes, for example, deletion to obtain a split graph or a cograph. We also know FPT for specific graph classes defined by infinite forbidden sets like feedback vertex set and odd cycle transversal [5]. While the precise characterization of the class of graphs for which the deletion problem is FPT is elusive, there are graph classes for which the problem is W-hard [9,11]. Recently, some stronger versions have also been studied, where the problem is to delete at most k vertices to get a graph such that every connected component of the resulting graph is at most ` edges away from being a graph in a graph class F (see [15–17]). Some examples of F that have been studied in this stronger version include forest, pseudo-forest or bipartite. Our results: In this paper, we address the complexity of a very natural variation of the graph deletion problem, where in the resulting graph, each connected component belongs to one of finitely many graph classes. For example, we may want the connected components of the resulting graph to be a clique or a biclique (a complete ). It is known that cliques forbid exactly P3s, the induced paths of length 2, and bicliques forbid P4 and triangles. So if we just want every connected component to be a clique or every connected component to be a biclique, then one can find appropriate constant sized subgraphs in the given graph and branch on them (as one would

3 in a hitting set instance). However, if we want each connected component to be a clique or a biclique, such a simple approach by branching over P3, P4, or K3 would not work. Notice that triangles are allowed to be present in clique components and P3s are allowed to be present in biclique components. It is not even clear that there will be a finite forbidden set for this resulting graph class. Our main result of the paper shows this deletion problem is FPT when there are a constant number of hereditary graph classes, when the deletion problem corresponding to each of the classes is known to be FPT and the properties that a graph belongs to each of the classes is expressible in CMSO logic (See Section 2 for definitions). Furthermore, when each of the graph classes is characterized by a finite forbidden set we get a faster FPT algorithm using the well-known techniques in parameterized complexity – iterative compression and important separators. Specifically the problems we show to be fixed-parameter tractable is the following. Let Pi(G) denote the graph property that “graph G is in the graph class Πi”.

Individually tractable (Π1,Π2,...,Πd) Vertex Deletion Input: An undirected graph G = (V, E), an integer k, and d hereditary graph classes Π1,...,Πd such that for all i ∈ [d], Πi Vertex Deletion is FPT Pi(H) for input graph H is CMSO expressable. Parameter: k Question: Is there a subset Z ⊆ V(G), |Z| ≤ k such that every connected component of G − Z is in at least one of the graph classes Π1,...,Πd?

Finite (Π1,Π2,...,Πd) Vertex Deletion Input: An undirected graph G = (V, E), an integer k, and d graph classes Π1,...,Πd described by finite forbidden sets F1,..., Fd respectively. Parameter: k Question: Is there a subset Z ⊆ V(G), |Z| ≤ k such that every connected component of G − Z is in at least one of the graph classes Π1,...,Πd? Previous Work: While there has been a lot of work on graph deletion and modification problems, one work that comes close to ours is the work by Ganian, Ramanujan and Szeider [8] where they consider the parameterized complexity of finding strong backdoors to a scattered class of CSP instances. In fact, in their conclusion, they remark that ‘graph modification problems and in particular the study of efficiently computable modulators to various graph classes has been an integral part of parameterized complexity and has led to the development of several powerful tools and techniques. We believe that the study of modulators to ‘scattered

4 graph classes’ could prove equally fruitful and, as our techniques are mostly graph based, our results as well as techniques could provide a useful starting point towards future research in this direction’. Our work is a starting point in addressing the parameterized complexity of the problem they suggest. Our Techniques: The FPT algorithm for Individually tractable (Π1,Π2,...,Πd) Vertex Deletion in Theorem 3 relies on a result by Lokshtanov et al. [13] that allows one to obtain a (non-uniform) FPT algo- rithm for CMSO-expressible graph problems by designing an FPT algorithm for the problem on a well-connected class of graphs called unbreakable graphs. For the latter, using the observation that only one connected component after deleting the solution is large, which belongs to some particular class Πi, we use the FPT algorithm for Πi-Vertex Deletion to obtain a modulator to the graph class Πi of size s(k) for a function s. Then we use a branching rule to remove the components that are not in Πi in the modulator “revealing” the solution to the problem. We now give a brief summary of the main FPT algorithm described in Theorem 4.3. We reduce the problem Finite (Π1,Π2,...,Πd) Vertex Deletion to Disjoint (Π1,Π2,...,Πd) Vertex Deletion Compression (Disjoint Finite (Π1,Π2,...,Πd)-VDC for short) using the standard tech- nique of iterative compression. In Disjoint Finite (Π1,Π2,...,Πd)-VDC, we can assume that a (Π1,Π2,...,Πd)-modulator W of the graph of size k − i is also given to us as input for some i ≤ k (i is the number of vertices from the modulator we have guessed to be in the solution) and the aim is to check if there is a (Π1,Π2,...,Πd)-modulator of the graph of size k − i − 1 disjoint from W. This is formally described in Subsection 4.1. In Subsection 4.2, we give an FPT algorithm for Disjoint Finite (Π1,Π2,...,Πd)-VDC in the special case when the solution that we are looking for leaves W in a single component. The algorithm uses the technique of important separators [14]. Finally in Subsection 4.3, we handle general instances of Disjoint Finite (Π1,Π2,...,Πd)-VDC. We focus on instances where the solution separates W. We guess W1 ⊂ W as the part of W that occurs in some single connected component after deleting the solution. Since, the solution separates W, we know that it contains a W1 − (W \ W1) separator X. The algorithm uses the technique of important separator sequences [12]. Informally, an important separator sequence partitions the graph into slices with small boundaries which allows us to look for solutions local to the slices. The algorithm guesses the integer ` which is the size of the part of the solution present in the graph containing W1 after removing X. The algorithm then constructs the important separator sequence corresponding to ` and finds the separator P furthest from W1 in the sequence such that there is a (Π1,Π2,...,Πd)-modulator of size ` in

5 the graph containing W1 after removing P. If separator X either intersects P or dominates the other, then a recursive smaller instance is easily constructable. In the case when the two separators are incomparable, the algorithm identifies a set of vertices Y that is reachable from W1 after deleting P. The algorithm then constructs a graph gadget of kO(1) vertices whose appropriate attachment to the boundary P of the graph G[Y] gives a graph G0 which preserves the part of the solution of G present in G[Y]. Since this part of the solution is strictly smaller in size, the algorithm can find the solution for G by recursively finding the solution in G0. While the main techniques for a good part follow from the paper by Ganian, Ramanujan and Szeider [8], the problem has its own challenges. The paper by Ganian, Ramanujan and Szeider worked on strong backdoors to a scattered class of CSPs. The authors create an variable-constraint incidence graph based on the CSP and focus on “forbidden sets” with respect to a set of variables S which is a set of constraints C such that there is an assignment of S on which for every CSP class, one of the constraints under this assignment does not belong to this class. We identify an equivalent notion of forbidden set in our problem as a subset of vertices C such that for every finite forbidden graph class, there is a subset of C such that the graph induced on the subset belongs to a forbidden member of this class. Since the forbidden set is identified by a collection of finite subgraphs here, instead of a set of constraint vertices in the CSP case where the graph properties are not relevant, there are more difficulties arising from it. For example, the CSP result uses a connecting gadget that adds extra vertices and edges to preserve connectivity of some subsets. They manage this by associating tautological constraints to these extra vertices which can go into any of the CSP classes. But adding new vertices and edges can create new subgraphs which could be a finite forbidden subgraph, in our case. Due to this, we had to come up with an algorithm avoiding any use of connecting gadgets. Another difficulty is in creating the smaller graph instance G0 using gadgets as described in the previous paragraph where we could recursively solve the instance. In the CSP case, identifying the set of vertices that need to be preserved in the smaller instance was easier as the forbidden sets were a set of constraint vertices. In our case, this gets more complicated as we deal with forbidden sets involving subgraphs. Specifically this results in a more complex marking procedure in Lemma 10 to prove its third claim.

2 Preliminaries

Graph Theory: For ` ∈ N, we use P` to denote the on ` vertices. We

6 use standard graph theoretic terminology from Diestel’s book [6]. A is a connected graph with no cycles. A forest is a graph, every connected component of which is a tree. A paw is a graph G with vertex set V(G) = {x1, x2, x3, x4} and edge set E(G) = {x1x2, x2x3, x3x1, x3x4}. A graph is a block graph if all its biconnected components are cliques. For a set X ⊆ G, we use G[X] to denote the graph induced on the vertex set X and we use G − X (or G \ X) to denote the graph induced by the vertex set V(G) \ X. We say that a subset Z ⊆ V(G) disconnects a subset S ⊆ V(G) if there exists v, w ∈ S with v 6= w such that v and w occur in different connected components of the graph G \ Z.

Definition 1. Let G be a graph and disjoint subsets X, S ⊆ V(G). We denote by RG(X, S) the set of vertices that lie in the connected component containing X in the graph G \ S. We denote RG[X, S] = RG(X, S) ∪ S. Finally we denote NRG(X, S) = V(G) \ RG[X, S] and NRG[X, S] = NRG(X, S) ∪ S. We drop the subscript G if it is clear from the context.

Definition 2. [14] Let G be a graph and X, Y ⊆ V(G).

• A vertex set S disjoint from X and Y is said to disconnect X and Y if RG(X, S) ∩ Y = φ. We say that S is an X − Y separator in the graph G.

• An X−Y separator is minimal if none of its proper subsets is an X−Y separator.

• An X−Y separator S1 is said to cover an X−Y separator S with respect to X if R(X, S) ⊂ R(X, S1).

• Two X − Y separators S1 and S2 are said to be incomparable if neither covers the other.

• In a set H of X − Y separators, a separator S is said to be component- maximal if there is no separator S0 in H which covers S. Component- minimality is defined analogously.

• An X − Y separator S1 is said to dominate an X − Y separator S with respect to X if |S1| ≤ |S| and S1 covers S with respect to X.

• We say that S is an important X − Y separator if it is minimal and there is no X − Y separator dominating S with respect to X.

For the basic definitions of Parameterized Complexity, we refer to [5].

7 Parameterized Complexity and Kernels: A parameterized problem L is a subset of Σ∗ ×N for some finite alphabet Σ. An instance of a parameterized problem is denoted by (x, k) where x ∈ Σ∗, k ∈ N. We assume that k is given in unary and without loss of generality k ≤ |x|.

Definition 3 (Fixed-Parameter Tractability). A parameterized problem L ⊆ Σ∗ × N is said to be fixed-parameter tractable (FPT) if there exists an algorithm A, a computable function f : N N and a constant c independent of f, k, |x|, such that given input (x, k), runs in time f(k)|x|c and correctly decides whether (x, k) ∈ L or not. → Counting Monadic Second Order Logic. The syntax of Monadic Sec- ond Order Logic (MSO) of graphs includes the logical connectives ∨, ∧, ¬, , = , variables for vertices, edges, sets of vertices and sets of edges, the quantifiers ∀ and ∃, which can be applied to these variables, and five binary↔ relations:⇒ 1. u ∈ U, where u is a vertex variable and U is a vertex set variable;

2. d ∈ D, where d is an edge variable and D is an edge set variable;

3. inc(d, u), where d is an edge variable, u is a vertex variable, and the interpretation is that the edge d is incident to u;

4. adj(u, v), where u and v are vertex variables, and the interpretation is that u and v are adjacent;

5. equality of variables representing vertices, edges, vertex sets and edge sets.

Counting Monadic Second Order Logic (CMSO) extends MSO by including atomic sentences testing whether the cardinality of a set is equal to q modulo r, where q and r are integers such that 0 ≤ q < r and r ≥ 2. That is, CMSO is MSO with the following atomic sentence: cardq,r(S) = true if and only if |S| ≡ q mod r, where S is a set. We refer to [1, 4] for a detailed introduction to CMSO.

3 Individually tractable (Π1,Π2,...,Πd) Ver- tex Deletion in general graphs

We recall the notion of unbreakable graphs from [13].

8 Definition 4. A graph G is (s, c)-unbreakable if there does not exist a partition of the vertex set into three sets X, C and Y such that (a) C is an (X, Y)-separator: there are no edges from X to Y, (b) C is small: |C| ≤ c, and (c) X and Y are large: |X|, |Y| ≥ s. We now use the following theorem from [13] which says that if the problem is FPT in unbreakable graphs, then the problem is FPT in general graphs. Let CMSO[ψ] denote the problem with graph G as an input, and the objective is to determine whether G satisfies ψ.

Theorem 1. [13] Let ψ be a CMSO sentence. For all c ∈ N, there exists s ∈ N such that if there exists an algorithm that solves CMSO[ψ] on (s, c)- unbreakable graphs in time O(nd) for some d > 4, then there exists an algorithm that solves CMSO[φ] on general graphs in time O(nd). We prove the following lemma.

Lemma 1. Individually tractable (Π1,Π2,...,Πd) Vertex Deletion is CMSO expressible. Proof. We use conn(X) which verifies that a subset X of a graph G induces a connected subgraph. It is known that conn(X) is expressable by an MSO formula [5]. Also for X ⊆ V(G) , we can express the sentence “|X| ≤ k as ∃x1, . . . , xk∀u ∈ X = (∨i∈[k]u = xi) Recall that Pi(G) denote the graph property “graph G is in Πi” for i ∈ [d] and input graph G. Let⇒ the CMSO sentences for properties Pi(G) be ψi(G). The overall CMSO sentence for our problem ψ is ∃X ⊆ V(G), |X| = k, ∀C ⊆ V(G) \ X : conn(C) = (∨i∈[d]ψi(G[C])). Hence Theorem 1 and Lemma 1 allow us to focus on unbreakable graphs. ⇒ Theorem 2. Individually tractable (Π1,Π2,...,Πd) Vertex Dele- tion is FPT in (s(k), k)-unbreakable graphs. Proof. Let G be an (s(k), k)-unbreakable graph and X be a solution of size k. Look at the connected components of G − X. Since X is a separator of size at most k, there is at most one connected component of G − X has size more than s(k). Let us first look at the case where no connected component of G − X has size more than s(k). In this case, we can bound the number of connected components by 2s(k). Suppose not. Then we can divide vertex sets of connected components into two parts C1 and C2, each having at least s(k) vertices. Then the partition (C1, X, C2) of V(G) contradicts that G is (s(k), k)- unbreakable.

9 Since each component has size at most s(k), we have |V(G)\X| ≤ 2(s(k))2. Hence |V(G)| ≤ 2(s(k))2 + k. We can solve the problem by going over all subsets of size k in G and checking if every connected component of G − X is in some graph class Πi for i ∈ [d]. This gives us an algorithm with running h(k) O(1) 2 time k h(k) where h(k) = 2(s(k)) + k. Let us now look at the case where there is a component C of G − X of size more than s(k). Let Πj be the graph class which C belongs to. Let R = V − (X ∪ C). Since X is a separator of size at most k with separation (C, R), we can conclude that |R| ≤ s(k). Hence we can conclude that X ∪ R is a modulator of size at most s(k) + k such that G − (X ∪ R) is a graph in graph class Πi. Hence we can conclude that G has a modulator of size at most g(k) = s(k) + k to the graph class Πj. Our algorithm first guesses the graph class Πj and then use the FPT algorithm for Πj-Vertex Deletion to find a modulator S of size g(k) such that G − S is in the graph class Πj. We know that (C, X, R) is a partition of V(G). Let (SCX,SR) the partition of S where SCX = S ∩ (C ∪ X) and SR = S ∩ R. The algorithm goes over all 2-partitions of S to guess the partition (SCX,SR). Claim 1. For every component Q in the graph G − X such that Q is not in the graph class Πj, we have SR ∩ V(Q) 6= ∅.

Proof. Suppose SR ∩ V(Q) = ∅. By definition, we have V(Q) ⊆ R. Hence if SR ∩ V(Q) = ∅, we have S ∩ V(Q) = ∅. But then this contradicts the fact that G − S is in the graph class Πj as Q is not in the graph class Πj and Πj is a hereditary graph class.

For every vertex v ∈ SR, let Qv denote the component in G − X that contains v. Note that the neighborhood of V(Qv) in the graph G is a subset of X which is of size at most k. We now use the following proposition that helps us to guess the subset V(Qv). Proposition 1. ( [7]) Let G = (V, E) be a graph. For every v ∈ V , and b, f ≥ 0, the number of connected vertex subsets B ⊆ V such that

• v ∈ B

• |B| = b + 1

• |N(B)| = f b+f b+f is at most b and can be enumerated in time O(n b ) by making use of polynomial space. We have the following Branching Rule.

10 Branching Rule 1. Let v ∈ SR. Using the enumeration algorithm from Proposition 1, go over all connected vertex subsets B ⊆ V such that v ∈ B, |B| = b + 1, and |N(B)| = f where 1 ≤ b ≤ s(k) and 1 ≤ f ≤ k and return the instance (G − B, k − |N(B)|). The branching rule is safe because in one of the branches, the algorithm rightfully guesses B = V(Qv). The algorithm repeats the branching rule for all vertices v ∈ SR. Hence we can assume that the current instance is such that SR = ∅. We update the sets X and R by accordingly deleting the removed vertices. Let (G0, k0) be the resulting instance. We have the following claim. 0 Claim 2. The set X is such that |X| ≤ k and G − X is in the graph class Πj. The proof of the claim comes from the fact as S ∩ R = ∅, every component other than C does not intersect with S. Hence these components have to be in the graph class Πj as G − S is in the graph class Πj. The algorithm now again use the FPT algorithm for the graph class Πj to obtain the solution of size k0 thereby solving the problem. We summarize the algorithm below.

1. For any of the given graph classes check whether the given graph G has a modulator of size at most g(k). If none of them has, then return NO. Otherwise, let Πj be such a graph class with S being the modulator.

2. Go over all 2-partitions (SCX,SR). For each v ∈ SR, apply Branching Rule 1. Let (G0, k0) be the resulting instance.

0 0 3. Check whether the graph G has a Πj-deletion set of size at most k . If yes, return YES. Else return NO.

O(1) Running Time: Let fj(k)n be the running time for Πj-Vertex Deletion. g(k) O(1) We use j · fj(g(k)) · 2 n time to obtain set S and its 2-partition where g(k) = s(k) + k. We use overall O(n(g(k) + 1))k+1) time to enumerate the connected vertex sets in Branching Rule 1. The branching factor is bounded by (g(k) + 1))k+1 and the depth is bounded by k. Since choices of v is bounded by g(k), exhaustive application of Branching Rule takes at most k(k+2) O(1) (g(k)) n time. Finally we apply the algorithm for Πj-Vertex Deletion O(1) again taking at most fj(k)n time. g(k) Hence the overall running time is bounded by j · fj(g(k)) · 2 (g(k) + 1))k(k+2)nO(1). We have the following from Theorem 1 and Theorem 2.

Theorem 3. Individually tractable (Π1,Π2,...,Πd) Vertex Dele- tion is FPT in general graphs.

11 4 Deletion to d finite scattered classes

Definition 5. We call a set Z a (Π1,Π2,...,Πd)-modulator if every connected component of G \ Z is in one of the graph classes Πi for i ∈ d. Organization of the section: This section is divided into three subsections. In the first section, we use iterative compression to transform the Finite (Π1,Π2,...,Πd) Vertex Deletion problem into a compressed version of the problem named Disjoint Finite (Π1,Π2,...,Πd)-VDC. In the second section, we give an algorithm for Disjoint Finite (Π1,Π2,...,Πd)-VDC for the special case of having a non-separating solution which we will define later. Finally in the third section, we give a general algorithm for Disjoint Finite (Π1,Π2,...,Πd)-VDC and subsequently Finite (Π1,Π2,...,Πd) Vertex Deletion using the algorithm in the second section as a subroutine.

4.1 Iterative Compression We use the standard technique of iterative compression to transform the Fi- nite (Π1,Π2,...,Πd) Vertex Deletion problem into the following problem Disjoint (Π1,Π2,...,Πd) Vertex Deletion Compression(Disjoint Fi- nite (Π1,Π2,...,Πd)-VDC) such that an FPT algorithm with running time O∗(f(k)) for the latter gives a O∗(2k+1f(k)) time algorithm for the former. The details are moved to the full version.

Disjoint Finite (Π1,Π2,...,Πd)-VDC Input: A graph G, an integer k, finite forbidden sets F1, F2,..., Fd for graph classes Π1,Π2,...,Πd and a subset W of V(G) such that W is a (Π1,Π2,...,Πd)- modulator of size k + 1. Parameter: k Question: Is there a subset Z ⊆ V(G) \ W, |Z| ≤ k such that Z is a (Π1,Π2,...,Πd)-modulator of the graph G?

4.2 Finding non-separating solutions

In this section, we focus on solving instances of Disjoint Finite (Π1,Π2,...,Πd)- VDC which have a non-separating property defined as follows.

Definition 6. Let (G, k, W) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC and Z be a solution for this instance. Then Z is called a non- separating solution if W is contained in a single connected component of G \ Z and separating otherwise. If an instance has only separating solutions, we call it a separating instance. Otherwise, we call it non-separating.

12 We begin the description of the algorithm with the following reduction rule. Reduction Rule 1. If a connected component of G belongs to some graph class Πi, then remove all the vertices of this connected component. Lemma 2. Reduction rule 1 is safe. Proof. Let X be the connected component of G removed to get an in- stance (G0, k, W 0). We claim that (G, k, W) is a YES-instance if and only if (G0, k, W 0) is also a YES-instance. Let Z be a solution of G of size at most k. Since G0 is an of G, Z is also a solution of G0 as well. Conversely, suppose Z0 is the solution of size k for graph G0. Then every 0 0 connected component of the graph G \ Z belongs to some graph class Πi for i ∈ [d]. Since X also belongs to some graph class Πi for some i ∈ [d], we have that Z0 is also a solution for the graph G. We now develop the following notion of forbidden sets which can be used to identify if a connected component of a graph belongs to any of the classes Πi for i ∈ [d]. Definition 7. We say that a subset of vertices C ⊆ V(G) is a forbidden set of G if C occurs in a connected component of G and there exists a subset Ci ⊆ C such that G[Ci] ∈ Fi for all i ∈ [d] and C is a minimal such set. Clearly if a connected component of G contains a forbidden set, then it does not belong to any of the graph classes Πi for i ∈ [d]. We note that even though the forbidden set C is of finite size, the lemma below rules out the possibility of a simple algorithm involving just branching over all the vertices of C. Lemma 3. Let G be a graph and C ⊆ V(G) be a forbidden set of G. Let Z be a (Π1,Π2,...,Πd)-modulator of G. Then Z disconnects C or Z ∩ C 6= ∅. Proof. Suppose Z is disjoint from C. We know that C cannot occur in a connected component X of G \ Z as X cannot belong to any graph class Πi for i ∈ [d] due to the presence of subsets Ci ⊆ C such that G[Ci] ∈ Fi. Hence Z disconnects C. We now have the following lemma on important separators which is helpful in our algorithm to compute non-separating solutions. Lemma 4. [3] For every k ≥ 0 and subsets X, Y ⊆ V(G), there are at most 4k important X − Y separators of size at most k. Furthermore, there is an algorithm that runs in O(4kkn) time that enumerates all such important X−Y separators and there is an algorithm that runs in nO(1) time that outputs one arbitrary component-maximal X − Y separator.

13 We now have the following lemma which connects the notion of important separators with non-separating solutions of our problem.

Lemma 5. Let (G, k, W) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC obtained after exhaustively applying Reduction Rule 1 and Z be a non- separating solution. Let v be a vertex such that Z is a {v} − W separator. Then there is a solution Z0 which contains an important v − W separator of size at most k in G. Proof. Since we have applied Reduction rule 1 as long as it is applicable, there is no connected component X of G that is disjoint from W. Hence every component of G, in particular the component containing v intersects with W. Therefore, since the solution Z disconnects v from W, it must contain a minimal non-empty v − W separator A. If A is an important v − W separator, we are done. Else there is an important v − W separator B dominating A. We claim that Z0 = (Z\A)∪B is also a solution. Clearly |Z0| ≤ |Z|. Suppose that there exists a forbidden set C in the graph G \ Z0. Let X be the connected component of G \ Z0 containing C. Suppose X is disjoint from W. Then there exists a connected component Y of G \ W containing X , contradicting that W is a (Π1,Π2,...,Πd)-modulator . Hence X must intersect W. Since B ⊆ Z0 disconnects v from W, we can conclude that X is not contained in RG(v, B) as if so it cannot intersect with W. By the definition of Z0, any component of the graph G\Z0 which intersects 0 Z \ Z = A \ B has to be contained in the set RG(v, B). Hence the component X is disjoint from Z \ Z0. Thus, there exist a component H of the graph G \ Z containing X . But this contradicts that Z is a (Π1,Π2,...,Πd)-modulator . We use the above lemma along with Lemma 4 to obtain our algorithm for non-separating instances. The algorithm finds a minimal forbidden set C in polynomial time which is finite. Then it branches on the set C and also on v − W important separators of size at most k of G for all v ∈ C. Lemma 6. Let (G, k, W) be a non-separating instance of Disjoint Finite O(k) O(1) (Π1,Π2,...,Πd)-VDC. Then it can be solved in 2 n time where |V| = n. Proof. We first apply Reduction Rule 1 exhaustively. If the graph is empty, we return YES. Else, there is a connected component of G which does not belong to any graph classes Πi for i ∈ [d]. Therefore, there exists a forbidden set C ⊆ V(G) of G present in this connected component. We find C by checking for each graph class Πi, if a graph in Fi exists as an induced subgraph in a any connected component X of G, take the union of these vertices and make it minimal by removing vertices and seeing if the set still remains forbidden.

14 We branch in |C|-many ways by going over all the vertices v ∈ C and in each branch, recurse on the instance (G − v, k − 1, W). Then for all v ∈ C, we branch over all important v − W separators X of size at most k in G and recurse on instances (G \ X, k − |X|,W). We now prove the correctness of the algorithm. Let Z be a solution of the instance. From Lemma 3, we know that a forbidden set C of G is disconnected by Z or Z ∩ C 6= φ. In the latter case, we know that Z contains a vertex x ∈ C giving us one of the branched instances obtained by adding x into the solution. Now we are in the case when C is disconnected by Z. Since Reduction rule 1 is applied exhaustively, the connected component containing C also contains some vertices in W. Since Z is a non-separating solution, W goes to exactly one connected component of G \ Z and there exists some non-empty part of C that is not in this component. Hence, there exists some vertex x ∈ C that gets disconnected from W by Z. From Lemma 5, we know that there is also a solution Z0 which contains an important x − W separator of size at most k in G. Since we have branched over all such x − W important separators, we have correctly guessed on one such branch. We now bound the running time. Since |C| = O(d), any forbidden set in G can be obtained via brute force in nO(d) time. For each i ∈ [k], we know that there are at most 4i important separators of size 1 ≤ i ≤ k which can be enumerated using Lemma 4 in O(4i · i · n) time. For the instance (G, k, W), if we branch on v ∈ C , k drops by 1 and if we branch on a v − W separator of size i, k drops by i. Hence if T(k) denotes the time taken for the instance k (G, k, W), we get the recurrence relation T(k) = O(d)T(k − 1) + 4iT(k − i) i=1 upon solving with taking into account that d is a constant,P we get that T(k) = 2O(k)nO(1).

4.3 Solving general instances

We now solve general instances of Disjoint Finite (Π1,Π2,...,Πd)-VDC us- ing the algorithm for solving non-separating instances as a subroutine. We first focus on solving separating instances of Disjoint Finite (Π1,Π2,...,Πd)- VDC. We guess a subset W1 ⊂ W such that for a solution Z, W1 is exactly the intersection of W with a connected component of G\Z. For W2 = W \W1, we are looking for a solution Z containing a W1 − W2 separator. Formally, let W = W1 ]W2 be a set of size k+1 which is a (Π1,Π2,...,Πd)-modulator. We look for a set Z ⊆ V(G)\W of size at most k such that Z is a (Π1,Π2,...,Πd)- modulator, Z contains a minimal (W1,W2)-separator X and W1 occurs in a connected component of G \ Z.

15 From here on, we assume that the separating instance (G, k, W) of Dis- joint Finite (Π1,Π2,...,Πd)-VDC is represented as (G, k, W1,W2) where W = W1 ] W2 . We branch over all partitions of W into W1 and W2 which adds a factor of 2k+1 to the running time. We now introduce the notion of tight separator sequences and t-boundaried graphs which are used to design the algorithm.

4.3.1 Tight Separator Sequences

We first look at a type of W1 − W2 separators where the graph induced on the vertices reachable from W1 satisfy the property as defined below.

Definition 8. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC. We call a W1 − W2 separator X in G `-good if there exists a set K of size at most ` such that K ∪ X is a (Π1,Π2,...,Πd)-modulator for the graph G[R[W1,X]]. Else we call it `-bad.

Lemma 7. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC and let X and Y be disjoint W1 − W2 separators in G such that X covers Y. If X is `-good, then Y is also `-good.

Proof. Let us define graphs GX = G[R[W1,X]] and GY = G[R[W1,Y]]. Let K be a subset of size at most ` such that K ∪ X is a (Π1,Π2,...,Πd)-modulator 0 0 for the graph GX. Let K = K ∩ R[W1,Y]. We claim that K ∪ Y is a (Π1,Π2,...,Πd)-modulator for the graph GY proving that Y is `-good. 0 Suppose K ∪ Y is not a (Π1,Π2,...,Πd)-modulator . Then there exists a 0 forbidden set C ⊆ R[W1,Y] contained in a single component of GY \ (K ∪ Y). Since C ⊆ R[W1,Y] ⊂ R[W1,X] and X and Y are disjoint, C does not intersect X. Also C does not contain any vertices in K\K0 as Y disconnects the set from C. Hence C is disjoint from K∪X. Since C lies in a single connected component 0 of GY \(K ∪Y) we can conclude that C occurs in a single connected component of the graph GX \ (K ∪ X) giving a contradiction that X is `-good.

Definition 9. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC and let X and Y be W1 − W2 separators in G such that Y dominates X. Let ` be the smallest integer i for which X is i-good. If Y is `-good, then we say that Y well-dominates X. If X is `-good and there is no Y 6= X which well-dominates X, then we call X `-important.

The following lemma allows us to focus on solutions containing an `- important W1 − W2 separator for some appropriate value of `.

16 Lemma 8. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC and Z be a solution. Let P ⊆ Z be a non-empty minimal W1 − W2 0 separator in G and let P be a W1 − W2 separator in G well-dominating P. Then there is also a solution Z0 for the instance containing P 0.

Proof. Let Q = Z∩R[W1,P]. Note that Q is a (Π1,Π2,...,Πd)-modulator for 0 0 the graph G[R[W1,P]]. Let Q ⊇ P be a smallest (Π1,Π2,...,Πd)- modulator 0 0 0 0 for the graph G[R[W1,P ]] extending P . We claim that Z = (Z \ Q) ∪ Q 0 0 is a solution for (G, k, W1,W2). Since P well-dominates P, |Z | ≤ |Z|. We 0 now show that Z is a (Π1,Π2,...,Πd)-modulator. Suppose not. Then there exists a forbidden subset C present in a connected component X of G \ Z0. We first consider the case when X is disjoint from the set Z\Z0. Then there is a component H in G\Z which contains X and hence C, contradicting that Z is a solution. We now consider the case when X intersects Z\Z0. By definition 0 0 0 0 of Z , X is contained in the set R(W1,P ). Since Z \ Q is disjoint from 0 0 0 R(W1,P ) and is separated from R(W1,P ) by just P , we can conclude that X 0 0 and hence C is contained in a single connected component of G[R[W1,P ]]\Q . 0 But this contradicts that Q is not a (Π1,Π2,...,Πd)-modulator in the graph 0 G[R[W1,P ]]. We now define the notion of tight separator sequence. It gives a natural way to partition the graph into parts with small boundaries. This helps us focus our problem on local parts of the graph which eases the task of solving it. Definition 10. An X − Y tight separator sequence of order k of a graph G with X, Y ⊆ V(G) is a set H of X − Y separators such that every separator has size at most k, the separators are pairwise disjoint, for any pair of separators in the set, one covers another and the set is maximal with respect to the above properties. Lemma 9. Given a graph G, disjoint vertex sets X, Y and integer k, a tight separator sequence H of order k can be computed in |V(G)|O(1) time. Proof. We can check using the minimum cut algorithm if there is an X − Y separator of size at most k. If not, we stop the procedure. Else we compute an arbitrary component-maximal X − Y separator S of size at most k using the polynomial time algorithm in Lemma 4. We add S to the family H, set Y to S and repeat the process. We claim that H is a tight separator sequence of order k after the procedure terminates. It is clear that the first three properties of tight separator sequence are satisfied by H in any iteration. Suppose H is not maximal and hence an X − Y separator P can be added. If P covers one of the separators S0 in H, it contradicts the component-maximality

17 Figure 1: An X − Y tight separator sequence of order two

of S0 at the time it was added to H. Else P is covered by all the separators in H which contradicts the termination of the procedure after the last separator in H was added. This completes the proof. In the proof, it can be seen that the separators S in H can be totally ordered by the subset relation of the reachability sets R(X, S). Hence H is rather called a sequence than a set.

4.3.2 Boundaried graphs Definition 11. A t-boundaried graph G be a graphs with t distinguished labelled vertices. We call the set of labelled vertices ∂(G) the boundary of G and the vertices in ∂(G) terminals. Let G1 and G2 be two t-boundaried graphs with the graphs G1[∂(G1)] and G2[∂(G2)] being isomorphic. Let µ : ∂(G1) ∂(G2) be a bijection which is an isomorphism of the graphs G1[∂(G1)] and G2[∂(G2)]. We denote the graph G1⊗µG2 as a t-boundaried graph obtained by the→ following gluing operation. We take the union of graphs G1 and G2 and identify each vertex x ∈ ∂(G1) with vertex µ(x) ∈ ∂(G2). The t-boundary of the new graph is the set of vertices obtained by unifying.

Definition 12. A t-boundaried graph with an annotated set is a t- boundaried graph with a second set of distinguished but unlabelled vertices disjoint from the boundary. The set of annotated vertices is denoted by ∆(G).

We now prove the following crucial lemma for giving the algorithm for solving separating instances of Disjoint Finite (Π1,Π2,...,Πd)-VDC. Suppose we are looking at an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC which has a solution Z. We know that the solution Z contains a minimal W1 − W2 separator Q which is incomparable to a given `-good W1 − W2 separator P in G. Then some part of Z, say K, lies in the set R[W1,Q]. We show that by carefully replacing parts outside of R[W1,P] with a small gadget, we can get a smaller graph G0 which preserves the part of K inside the set

18 R[W1,P]. Also we show that there is some part of K lying outside the set 0 R[W1,P] and hence the size of the solution in G is strictly smaller than in G. The gadget is loosely speaking a set obtained by a marking procedure which preserves all possible types of forbidden sets in the original graph. Let us look at a forbidden set C and a subset Ci ⊆ C such that G[Ci] = Hi ∈ Fi. 0 Let us look at the subset Ci ⊆ Ci that lies outside R(W1,P), the corresponding graph being an induced subgraph of Hi. For all i ∈ [d] and all possible induced subgraphs of Hi, we mark sets of vertices outside R(W1,P) such that there is a corresponding forbidden set C in the graph G whose intersections with 0 NR[W1,P] are exactly these graphs. Let G be the graph formed by removing the unmarked vertices outside R(W1,P). For any forbidden set C in G, we can replace parts of Ci outside R(W1,P) with the corresponding marked vertices and get a forbidden set C0 in graph G0. This allows us to focus on the smaller graph G0 and use the solution in G0 to construct a solution in G.

Lemma 10. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC and let Z be a solution. Let Q ⊆ Z be a minimal W1 − W2 separator in the graph G. Let K = Z ∩ R[W1,Q] with ` = |K \ Q|. Let P be a minimal W1 − W2 separator in G which is disjoint from K and incomparable to Q. Let r nr r r Q = Q ∩ R(W1,P) and Q = Q \ Q . Similarly, let P = P ∩ R(W1,Q) and nr r r P = P \ P . Let K = K ∩ R[W1,P]. Let G1 = G[R[W1,P]] be a boundaried graph with Pr as the boundary. Then there exists a |Pr|-boundaried graph G^ which is kO(1) in size with an annotated set of vertices, and a bijection µ : ∂(G^) Pr such that the glued 0 graph G = G1 ⊗µ G^ has the following properties (see Figure 3).

→ 0 1. The set W1 is a (Π1,Π2,...,Πd)-modulator for the graph G .

r r r nr 0 2. The set Q is a |K \Q |-good W1 −P separator in the graph G \∆(G^).

0 nr 0 3. For any Q which is a W1 − P separator in G \ ∆(G^) well-dominating r 0 0 nr Q in G , the set Q ∪ Q well dominates the W1 − W2 separator Q in G.

4. There is a a family H of boundaried graphs with an annotated set of vertices such that H contains G^, has size bounded by 2kO(1) and can be computed in 2kO(1) nO(1). Proof. We first describe the graph G^ and then prove that it has prop- erties claimed by the lemma. Let Knr = K \ Kr. Look at the subset r nr r nr V2 = (NR(W1,P) ∩ R(W1,Q)) ∪ P ∪ K . The set V2 \ (P ∪ K ) contains the vertices which are disconnected by P from W1 but are not disconnected from W1 by Q. We focus our attention on the graph G2 = G[V2]. Two vertices

19 0 Figure 2: The graph G obtained by gluing some G^ ∈ H to G[R[W1,P]]

nr nr v, w of G2 \ K are V2-connected if they are connected in the graph G2 \ K (V2-connectivity of sets is defined analogously). We now perform the following marking scheme on the graph G2. r r For all tuples h(H1,...,Hd), (B1,...,Bd), (b1, . . . , bd), (TP ,b1 ,...,TP ,bd )i Pr where Hi ∈ Fi, Bi ⊆ V(Hi), bi ∈ {0} ∪ [|V(Hi)|] and TPr,b ∈ , if there i bi nr exists a forbidden set C ⊆ (V2 ∪ V(G1)) of G \ K such that

• For all i ∈ [d], there exists a subset Ci ⊆ C such that G[Ci] = Hi with nr the graphs G[Ci] occur in a connected component of G \ K ,

+ + r r • for sets Ci = V2 ∩ Ci, we have G[Ci ] = Hi[Bi] and P ∩ Ci = TP ,bi with r bi = |P ∩ Ci|,

S + r • for every v ∈ i∈[d] Ci , there exists a vertex p ∈ P such that v and p are V2-connected,

+ then we mark for one such forbidden set C, the subset of vertices C = C∩V2. We now give an informal description of the intention of the marking scheme. The idea is to mark vertices corresponding to every possible way any r r forbidden set C can intersect with V2. Since P is a W1 − (V2 \ P ) separator, + r the edges from Ci to the rest of Ci (if it is non-empty) is only via vertices of P . + We now look at the graphs G[Ci ] which are induced subgraphs of Hi. These graphs would be induced subgraphs Hi[Bi] of Hi for subsets Bi ⊆ V(Hi). The + graphs G[Ci ] being constant in size would intersect some constant vertices of r P and interact with the rest of the graph G[Ci] via this subset of vertices. r These corresponding subsets are TP ,bi of sizes bi. Now for any forbidden set C, we can replace the vertices intersecting with V2 with those vertices in the + r marked set corresponding to the pair ((G[Ci ])i∈[d], (TP ,bi )i∈[d]) so that the new set C0 is a forbidden set in the graph G0 \ Knr. We then use the presence of C0 to give contradictions. This part will be more clear in the proof of the third claim of the lemma.

20 We also do another marking procedure to preserve the connectivity of the set Pr. From the definition of Pr as the set of vertices of P present in r the set R[W1,Q], we can infer that all pairs of vertices of P are connected r in the graph G[R[W1,Q]]. But some pairs of vertices of P may loose their connectivity after removing the current set of the unmarked vertices in V2 in the graph G[R[W1,P]] as V2 contains vertices in R[W1,Q]. We can compute this set of pairs P by removing the unmarked set and checking if each pair of vertices in Pr is connected. We now aim to identify and additionally mark a set of vertices that preserve connectivity of pairs in P. We compute a minimal forest F of the graph G2 so that the forest connects every pair of vertices of Pr in P. We do so by computing a of G2 and greedily removing vertices so that the pairs in P remain connected. Note that the set of leaves in F is a subset of Pr as any other leaf of the spanning tree gets deleted. Hence the number of leaves of F is bounded by |Pr| ≤ k from which we can conclude that the number of vertices in F with more than 2 is bounded by k. The rest of the forest F contains degree 2 paths. We bound the number of vertices in these paths via contracting them upto a point. Let us look at a degree 2 path α in F with end vertices nr y1 and y2. Let the vertices of Knr in α be x1, . . . , xq with q ≤ |K |. For each vertex xi, we look at the subpath from xi−1 to xi and the subpath from xi to xi+1 (If i = 1, the first subpath is from y1 to x1 and if i = q, the second subpath if from xq to y2.). For each of the paths, if any of them is of size more than 2pd + 2, we contract it to length 2pd + 2 in the following way where p denote the size of the maximum sized subgraph present among all th the families Fi. For each subpath, we identify at the (pd + 2) vertices from the left and right and contract every vertices in between these vertices. Since the number of subpaths in α is at most k + 1, the size of the path α after contraction is at most (2pd + 2)(k + 1). The number of paths α is at most k2 as the number of pairs of vertices which is not degree 2 is at most k2. Hence we can conclude that the forest F0 contains O(k3) vertices. We mark all the vertices in F0. Let M be the set of all marked vertices. Let us now bound the size of M for which we bound the set of marked vertices other than F0. Since each graph class Fi has a finite number of finite sized graphs, we can conclude that the number of tuples h(H1,...,Hd), (B1,...,Bd)i is a constant (assuming d is a constant). Since [|V(Hi)|] is a constant-sized set, integer bi is a constant. Each of the r P  bi+1 sets TPr,b is a member of the family which is of size at most k . Hence i bi O(1) r r the number of tuples (TP ,b1 ,...,TP ,bd ) is k . We can conclude that the r r number of tuples h(H1,...,Hd), (B1,...,Bd), (b1, . . . , bd), (TP ,b1 ,...,TP ,bd )i is kO(1). Since we mark a constant sized set for each forbidden set C of G\Knr

21 corresponding to each such tuple, we can conclude that |M| = kO(1). r nr We define the graph G^ = G2[M ∪ P ∪ K ]. We define the boundary of G^ to be Pr and define the annotated set ∆(G^) to be the set Knr. We have V(G^) = kO(1). 0 We define the graph G = G1 ⊗identity G^. We now prove that G0 satisfies the properties claimed by the lemma. 0 Claim 3. The set W1 is a (Π1,Π2,...,Πd)-modulator for the graph G . Suppose there is a forbidden set C present in a connected component of 0 G \ W1. Suppose C does not intersect with any contracted vertices of F0, then C is also present in a connected component of G \ (W1 ∪ W2). The graph G \ Knr can be seen as obtained from G0 \ Knr by uncontracting the edges of F and adding back the remaining vertices of G neither of which destroys 0 the connectivity of the set C. Since the set W2 is disjoint from V(G ), we can conclude that W1 ∪ W2 is a (Π1,Π2,...,Πd)-modulator for the graph G. Hence we assume that C intersects with some contracted vertices of F0. But from the way we contracted the paths in F to length 2pd + 2 > 2|C|, we can infer that C cannot intersect any of the contracted vertices. r r r nr Claim 4. The set Q is a |K \ Q |-good W1 − P separator in the graph G0 \ ∆(G^). r nr 0 nr We first show that Q is a W1 − P separator in the graph G \ K . By nr nr nr definition, Q is a W1 − P separator in the graph G. Since Q ⊆ K , we r nr nr can conclude that Q is a W1 − P separator in the graph G \ K . Now we note that G0 is obtained from G by deleting some of the vertices of G and contracting some edges of G both of which the set Qr is not part of. Hence the statement follows. We now argue that Qr is |Kr \ Qr|-good in the graph G0 \ Knr and is witnessed by Kr \ Qr. Suppose not. Then there is a forbidden set C in the graph G0 \ (Knr ∪ Qr ∪ (Kr \ Qr)) = G0 \ (K ∪ Q). Then as argued previously C is disjoint from the contracted vertices of F0 and hence is also a forbidden set in the graph G \ (K ∪ Q). This gives a contradiction that Q is `-good in G witnessed by K \ Q. 0 nr 0 Claim 5. For any Q which is a W1 − P separator in G \ ∆(G^) well- r 0 0 nr dominating Q in G , the set Q ∪ Q well dominates the W1 − W2 separator Q in G. The set Q^ = Q0 ∪ Qnr dominates Q in G by definition. Hence it suffices to prove that Q^ is `-good in G.

22 Let Y 0 be the vertex set certifying that Q0 is |Kr \ Qr|-good in G0 \ Knr. We claim that Y = Y 0 ∪ (Knr \ Qnr) certifies that Q^ is `-good in G. Since |Y 0| ≤ |Kr \ Qr| and sets Y 0 and Kr \ Qr are disjoint from Knr \ Qnr, we have |Y| ≤ |(Kr \ Qr) ∪ (Knr \ Qnr)| = |K \ Q| = `. Assume for contradiction that there exists a forbidden set C in the graph G[R[W1, Q^ ]] \ (Q^ ∪ Y). If C ⊆ V(G1), then C would also be a forbidden set in the graph G0 \ (Knr ∪ Q0 ∪ Y 0) contradicting that Q0 is a |Kr \ Qr|-good nr 0 + W1 − P separator in G \ ∆(G^). Hence we have the set C = C ∩ V2 to be non-empty. Suppose C+ ⊆ V(G^). Then C would again be a forbidden set in the 0 nr 0 0 0 r r nr graph G \ (K ∪ Q ∪ Y ) contradicting that Q is a |K \ Q |-good W1 − P separator in G0 \ ∆(G^). Hence we can assume that some vertices of C lie outside V(G0). Let us focus on each of the forbidden graphs corresponding to C. Let Hi ∈ Fi be the graphs such that there exist Ci ⊆ C such that G[Ci] = Hi. For i ∈ [d], We + + call the set Ci = Ci ∩ V2. We have G[Ci ] = Hi[Bi] for some sets Bi ∈ V(Hi). Pr r M Let Ci = Ci ∩ P . We look at sets of vertices Ci ⊆ (V(G1) ∪ V2) that is + Pr Pr 0 marked corresponding to the tuple (Hi,Ci , |Ci |,Ci ) in the graph G . We + M construct a set CM which is the union of sets (Ci \ Ci ) ∪ Ci for all i ∈ [d]. nr ^ M We have that V2 \ K ⊆ R[W1,Q] ⊆ R[W1, Q]. Hence the sets Ci and hence 0 nr 0 0 CM is a subset of vertices of the graph G \ (K ∪ Q ∪ Y ). We now prove 0 nr 0 0 that CM is a forbidden set in the graph G \ (K ∪ Q ∪ Y ) contradicting 0 r r nr 0 that Q is a |K \ Q |-good W1 − P separator in G \ ∆(G^). By definition of M + M the sets Ci , we have G[Ci \ Ci ] = Hi \ Bi and G[Ci ] = Hi[Bi]. Let us define 1 + Pr 2 M graphs Gi = G[(Ci \ Ci ) ∪ Ci ] and Gi = G[Ci ]. We define boundaries of 1 2 Pr 1 2 Gi and Gi as the set Ci . We now glue the graphs Gi and Gi with identity 0 r r mapping to obtain the graph Gi. Since P is a W1 − (V2 \ P ) separator, we M Pr + can conclude that there are no edges from (Ci \ Ci ) to (Ci \ Ci ). We can 0 conclude that the graph Gi is the forbidden graph Hi. Hence for the set CM, + M + M we have subsets (Ci \Ci )∪Ci such that graphs G[(Ci \Ci )∪Ci ] = Hi ∈ Fi. 0 nr 0 0 To finish the proof that CM is a forbidden set in G \(K ∪Q ∪Y ), remains 0 nr 0 0 to prove that the set CM occurs in a connected component of G \(K ∪Q ∪Y ). Suppose there exists a pair of vertices v, w in CM that occur in different connected components of the graph G0 \ (Knr ∪ Q0 ∪ Y 0). Firstly, let us assume M that one of these vertices say v is in the set Ci for some i ∈ [d] and w is in S M the set C \ i∈[d] Ci . By definition of the marking procedure, there exists r a vertex p ∈ P such that v and p are V2-connected. There is a path from w to some vertex p0 ∈ Pr as C is a forbidden set with a non-empty set C+. We can conclude that every pair of vertices in Pr are connected in the graph G0 \(Knr ∪Q0 ∪Y 0) as the vertices of F0 are disjoint from Knr by definition and 0 0 disjoint from Q ∪ Y as they lie in R(W1,P). Hence we get a path connecting

23 0 Figure 3: The graph G obtained by gluing some G^ ∈ H to G[R[W1,P]]

v and w giving a contradiction. S M We now look at the case when both v and w lie in the set i∈[d] Ci . again by definition of marking procedure, there exists vertices p and p0 such that v 0 and p are V2-connected and also w and p are V2-connected. Since there is a path between p and p0 in the graph G0 \ (Knr ∪ Q0 ∪ Y 0) as argued above, there is a path from v and w as well giving a contradiction. S M Finally we look at the case when both v and w not lie in the set i∈[d] Ci . Since both of these vertices are present in C∩R(W1,P), they are connected as otherwise it contradicts that C is a forbidden set in the graph G[R[W1, Q^ ]] \ (Q^ ∪ Y). Claim 6. There is a a family H of boundaried graphs with an annotated set of vertices such that H contains G0, has size bounded by 2kO(1) and can be computed in 2kO(1) kO(1). First we note that the marking procedure described in the lemma was based on the assumption that the separator Q and K are known to us which is not the case. But since the size of the graph G^ is bounded by kO(1), we can try to guess the right graph by going over all such graphs. We know that G^ is a graph of size kO(1) of which at most k are annotated. The total number of such graphs is bounded by 2kO(1) and these can be enumerated in time 2kO(1) kO(1). This completes the proof of the lemma.

4.3.3 Algorithm for general instances

The following lemma focuses on the particular case when W1 and W2 are already disconnected in G.

Lemma 11. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC where W1 and W2 are in distinct components of G. Let Z be its solution

24 such that W1 exactly occurs in a connected component of G\Z. Also let R(W1) 0 be the set of vertices reachable from W1 in G. Let Z = Z ∩ R(W1). Then 0 (G[R(W1)], |Z |,W1) is a non-separating YES-instance of Disjoint Finite 00 (Π1,Π2,...,Πd)-VDC and conversely for any non-separating solution Z for 0 0 00 (G[R(W1)], |Z |,W1), the set Z^ = (Z \ Z ) ∪ Z is a solution for the original 00 instance such that W1 exactly occurs in a connected component of G \ Z . 0 0 Proof. Suppose Z is not a (Π1,Π2,...,Πd)-modulator for the graph G . Then some component of G0 \ Z0 contains a forbidden set C. The sets Z0 0 and Z \ Z are disjoint as W1 and W2 are disconnected in G. Hence C is also in a connected component of G \ Z giving a contradiction. Hence Z is a 0 0 solution for the instance (G , |Z |,W1). Since the solution Z is such that W1 is contained in a connected component of Z and Z \ Z0 is disconnected from from Z0, Z0 is a non-separating solution. Conversely, suppose Z^ is not a solution for the graph G. Then there exists a forbidden C in a connected component of G \ Z^. Either C is contained in the set R(W1) or in the set NR(W1) = V \ R(W1). If C ⊆ R(W1), C is also present in a connected component of the graph G0 \ Z00 giving a contradiction 00 0 that Z is a (Π1,Π2,...,Πd)-modulator of G . If C ⊆ NR(W1), then C is 0 contained in some connected component of the graph G[NR(W1)] \ (Z \ Z ). Since Z0 is disjoint from C, we conclude that C is a forbidden set in the graph G \ (Z0 ∪ (Z \ Z0)) = G \ Z, giving a contradiction. We have the following reduction rule.

Reduction Rule 2. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)-VDC where W1 and W2 are disconnected in G. Compute a 0 0 0 0 non-separating solution Z for the instance (G , k ,W1) where G = G[R(W1)] 0 0 and k is the least integer i ≤ k for which (G , i, W1) is a YES-instance. 0 0 0 Delete Z and return the instance (G \ Z , k − |Z |,W2). The safeness of Reduction Rule 2 comes from Lemma 11. The running time for the reduction is 2O(k)nO(1) which comes from that of the algorithm in Lemma 6. Henceforth, we assume that Reduction Rule 2 is no longer applicable. We know that every solution Z of (G, k, W1,W2) contains an `-good non-empty W1 − W2 separator X in the graph G. Let us denote Main-Algorithm(G, k, W1,W2) as the main algorithm procedure. We now describe a subroutine Branching-Set((G, k, W1,W2), λ, `) which is used in Main-Algorithm where 0 ≤ ` ≤ k and 1 ≤ λ ≤ k.

Lemma 12. Let (G, k, W1,W2) be an instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC and let 0 ≤ ` ≤ k and 1 ≤ λ ≤ k. There is an algorithm Branching- kO(1) Set((G, k, W1,W2), λ, `) that returns a set R containing at most 2 ver- tices such that for every solution Z of the given instance containing an

25 `-important W1 − W2 separator X of size at most λ in G, the set R intersects Z.

Proof. Since Reduction Rule 2 is applied exhaustively, there is a W1 − W2 path in the graph G. If there is no W1 − W2 separator of size λ in the graph G, we declare the tuple invalid. Else we execute Lemma 9 to obtain a tight W1 − W2 separator sequence I of order λ. We then partition I into `-good and `-bad separators. For this we need a procedure to check whether a given separator P is `-good or not. If both λ, ` < k, we do so by recursively calling the main algorithm procedure Main-Algorithm(G[R[W1,P]], `, W1,P). The recursive call is possible as ` is strictly less than k. We note that since λ ≥ 1, the cardinality of P is non-zero. From the definition of `-good separators, we can conclude that ` < k as the solution set in G[R[W1,P]] is at most k and it contains non-empty set P as its subset. Let P1 be component maximal among all the good separators in I if any exists and P2 be component minimal among all the bad separators in I if any exists. We set R := P1 ∪ P2. For i ∈ {1, 2}, we do the following. We execute the algorithm of Lemma 10, Claim 4 to compute a family H of boundaried graphs with an annotated set of vertices. Then for every r ^ r choice of Pi ⊆ Pi, for every instance G ∈ H with |Pi | terminals and every r possible bijection δ : ∂(G^) P , we construct the glued graph G r = i Pi ,δ ^ r G[R[W1,Pi]]⊗δG, where the boundary of G[R[W1,Pi]] is Pi .We then recursively r 0 0 0 call ((G r \ S,˜ k − j, W ,P \ P ), λ , ` ) for every 0 ≤ λ < λ, Branching-Set Pi ,δ → 1 i i 1 ≤ j ≤ k − 1 and 0 ≤ `0 ≤ `, where S˜ is the set of annotated vertices in G^. We add the union of all the vertices returned by these recursive instances to R and return the resulting set. This completes the description of the algorithm. We now proceed to the proof of correctness. Correctness: We prove by induction on λ. We first consider the base case when λ = 1 where there is a W1 − W2 `-good separator X ⊆ Z of size one. Since X has size one, it cannot be incomparable with the separator P1. Hence either X is equal to P1 or is covered by P1. In either case, we are correct as P1 is contained in R. We now assume that the algorithm correctly runs for all tuples where λ < ^λ for some ^λ ≥ 2. We now look at the case when the algorithm runs on a tuple with λ = ^λ. Let Z be a solution for the instance containing an `-important separator X. If X intersects P1 ∪ P2 we are done as R intersects X. Hence we assume that X is disjoint from P1 ∪ P2. Suppose X is covered by P1. Then we conclude that P1 well-dominates X contradicting that X is `-important. By Lemma 7, since X is `-good and P2 is not, X cannot cover P2. Suppose X covers P1 and itself is covered by P2. Then X must be contained in the maximal

26 Figure 4: The case where X is incomparable with P1

tight separator sequence I contradicting that P1 is component maximal. Finally we are left with the case where X is incomparable with P1 or P2 if P1 does not exist. Without loss of generality, assume X is incomparable with P1. The argument in the case when P1 does not exist follows by simply replacing P1 with P2 in the proof. Let K ⊆ Z be a (Π1,Π2,...,Πd)-modulator for the graph G[R[W1,X]] extending X. If P1 ∩ K is empty, we have that P1 ∩ Z is empty. Since P1 is contained in R, the algorithm is correct as R intersects Z. Hence assume that P1 and K are disjoint. r nr r r Let X = R(W1,P1)∩X and X = X\X . Similarly, define P1 = R(W1,X)∩ nr r r nr r nr P1 and P1 = P1 \ P1. Since X and P1, the sets X ,X ,P1 and P1 are all r r non-empty. Let K = K ∩ R(W1,P1). If there is a vertex in P1 that is not in r the same connected component as W1 in G \ Z, then as X separates P1 from W2, we can conclude that R contains a vertex which is separated from W by r Z implying that the algorithm is correct. Hence assume that P1 is contained in the same connected component as W1 in the graph G \ Z. We observe that the sets defined above satisfy the conditions for Lemma r ^ 10 with P = P1 and Q = X. Therefore there exists a |P1|-boundaried graph G ˜ ^ r with an annotated set S and an appropriate bijection µ : ∂(G) P1 with the properties claimed in the statement of Lemma 10. Now consider the recursive nr 0 0 instance h(G r \ S,˜ k ,W ,P ), λ , ` i where G r is the graph obtained by Pi ,δ 1 1 i Pi ,δ → 0 r r gluing together G[R[W1,P1]] and G^ via a bijection µ , λ = |X |, k1 = |K | and `0 = |Kr|. To apply induction hypothesis on the above tuple, we first show that the nr tuple is valid. We show this by showing that (G r \ S,˜ k ,W ,P ) is a valid Pi ,δ 1 1 1 instance of Disjoint Finite (Π1,Π2,...,Πd)-VDC. For this we need that nr W ∪ P is a (Π ,Π ,...,Π )-modulator for the graph G r \ S˜ which is true 1 1 1 2 d Pi ,δ from Lemma 10, Claim 1. Hence the tuple is valid and we can apply the induction hypothesis. Since X is `-important, from Lemma 10, Claims 2 and 3, it follows that r X must also be k -important in the graph G r \ S˜. By induction hypothesis, 1 Pi ,δ

27 the tuple returns a set R0 which intersects Kr. Since Kr ⊆ Z, we can conclude that R0 intersects Z as well. Bounding the set R: We have the value of λ dropping at every level of the search tree. Since λ ≤ k, the depth of the search tree is bounded by k. The number of branches at each node is at most k3 · k! · 2kO(1) (k3 for choice of λ0, j and `0, k! for the choice of the bijection δ and 2kO(1) for the size of H). Since, at each internal node, we add at most 2k vertices (corresponding to kO(1) P1 ∪ P2), we can conclude that the size of R is bounded by 2 . We now describe the details of Main-Algorithm procedure.

Lemma 13. There is a procedure Main-Algorithm that given an in- stance (G, k, W1,W2) of Disjoint Finite (Π1,Π2,...,Πd)-VDC, runs in 2kO(1) nO(1) and either computes a solution for the instance containing a W1 − W2 separator or concludes that no such solution exists. Proof. Initially, if Reduction Rule 2 is applicable (this is the case when the size of the minimum cut λ in G is zero), we use it to reduce the instance. Hence we 0 can assume that the W1−W2 separator is non-empty. For every 0 ≤ ` ≤ k and 0 0 0 1 ≤ λ ≤ k, we invoke the algorithm Branching-Set((G, k, W1,W2), λ , ` ) from Lemma 12 to compute a set Rλ 0,` 0 . We define R as the union of the 0 0 sets Rλ 0,` 0 for all possible values of λ and ` . After this, we simply branch on every vertex v of R adding v to the solution creating a new instance (G − v, k − 1, W1,W2) of Disjoint Finite (Π1,Π2,...,Πd)-VDC. If k < 0, we return NO. If Reduction Rule 2 applies, we use it to reduce the instance. If this results in a non-separating instance with W = W1 ∪ W2, we apply the algorithm in Lemma 6 to solve the instance. Else we recursively run Main-Algorithm on the new instance. We now bound the running time T(k) for Main-Algorithm. The depth of the branching tree is bounded by k and the branching factor at each node is |R| ≤ 2kO(1) . The time taken at each node is dominated by the time taken for the procedure Branching-Set. Let Q(k) denote the time taken for O(1) Branching-Set. We have T(k) = 2k T(k−1)+Q(k). Let us focus on the search tree for Branching-Set. In Lemma 12, we proved that the depth of the tree is bounded by k and the branching factor is bounded by 2kO(1) . The time spent at each node is dominated by algorithm of Lemma 10 and that of the sub-instances of Main-Algorithm called at the node with strictly smaller values of k which is bounded by 2kO(1) nO(1) + T(k − 1). Hence overall we have Q(k) = 2kO(1) Q(k − 1) + 2kO(1) nO(1) + T(k − 1). Substituting Q(k) in the recurrence relation for the running time of Main-Algorithm and

28 k simplifying, we have T(k) = 2ikO(1) nO(1)T(k − i) ≤ k · 2k·kO(1) nO(1)T(k − 1) i=1 on solving we get T(k) = 2kOP(1) nO(1). The correctness follows from the correctness of Lemma 12, of Reduction Rule 2 and Lemma 6.

kO(1) O(1) Lemma 14. Disjoint Finite (Π1,Π2,...,Πd)-VDC can be solved in 2 n time.

Proof. Let (G, k, W) be the instance of Disjoint Finite (Π1,Π2,...,Πd)- VDC. We first apply Lemma 6 to see if there is a non-separating solution for the instance. If not, we branch over all W1 ⊂ W and for each such choice of W1, apply Lemma 13 to check if (G, k, W1,W2 = W \ W1) has a solution containing a W1 − W2 separator. The correctness and running time follows from those of Lemma 6 and Lemma 13.

Theorem 4. Finite (Π1,Π2,...,Πd) Vertex Deletion can be solved in 2kO(1) nO(1) time.

Proof. As mentioned in Section 4.1, the time taken to solve Finite (Π1,Π2,...,Πd) O(1) O(1) Vertex Deletion is 2k+1 · 2k nO(1) = 2k nO(1).

5 Conclusion

We have initiated a study on vertex deletion problems to scattered graph classes and showed that the problem is FPT when there are a finite number of graph classes, the deletion problem corresponding to each of the finite classes is known to be FPT and the properties that a graph belongs to each of the classes is expressible in CMSO logic. Furthermore, we show that in the case where each graph class has a finite forbidden set, the problem is fixed-parameter tractable by a O∗(2kO(1) ) algorithm. The existence of a polynomial kernel for these cases are natural open problems.

References

[1] Stefan Arnborg, Jens Lagergren, and Detlef Seese. Easy problems for tree-decomposable graphs. Journal of Algorithms, 12(2):308–340, 1991.

[2] Leizhen Cai. Fixed-Parameter Tractability of Graph Modification Prob- lems for Hereditary Properties. Inf. Process. Lett., 58(4):171–176, 1996.

29 [3] Jianer Chen, Yang Liu, and Songjian Lu. An improved parameterized algorithm for the minimum node multiway cut problem. Algorithmica, 55(1):1–13, 2009. [4] Bruno Courcelle. The monadic second-order logic of graphs. i. recogniz- able sets of finite graphs. Information and computation, 85(1):12–75, 1990. [5] Marek Cygan, Fedor V Fomin, L ukasz Kowalik, Daniel Lokshtanov, D´anielMarx, Marcin Pilipczuk, Micha lPilipczuk, and Saket Saurabh. Parameterized algorithms, volume 3. Springer, 2015. [6] Reinhard Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. Springer, 2012. [7] Fedor V Fomin and Yngve Villanger. computation and ex- tremal combinatorics. Combinatorica, 32(3):289–308, 2012. [8] Robert Ganian, M. S. Ramanujan, and Stefan Szeider. Discovering archipelagos of tractability for constraint satisfaction and counting. ACM Trans. Algorithms, 13(2):29:1–29:32, 2017. [9] Pinar Heggernes, Pim van ’t Hof, Bart M. P. Jansen, Stefan Kratsch, and Yngve Villanger. Parameterized complexity of vertex deletion into perfect graph classes. Theor. Comput. Sci., 511:172–180, 2013. [10] John M. Lewis and Mihalis Yannakakis. The node-deletion problem for hereditary properties is np-complete. J. Comput. Syst. Sci., 20(2):219– 230, 1980. [11] Daniel Lokshtanov. Wheel-free deletion is W[2]-hard. In Parameterized and Exact Computation, Third International Workshop, IWPEC 2008, Victoria, Canada, May 14-16, 2008. Proceedings, pages 141–147, 2008. [12] Daniel Lokshtanov and MS Ramanujan. Parameterized tractability of multiway cut with parity constraints. In International Colloquium on Automata, Languages, and Programming, pages 750–761. Springer, 2012. [13] Daniel Lokshtanov, MS Ramanujan, Saket Saurabh, and Meirav Zehavi. Reducing CMSO Model Checking to Highly Connected Graphs. In 45th International Colloquium on Automata, Languages, and Programming (ICALP 2018). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2018. [14] D´anielMarx. Parameterized graph separation problems. Theoretical Computer Science, 351(3):394–406, 2006.

30 [15] Geevarghese Philip, Ashutosh Rai, and Saket Saurabh. Generalized pseudoforest deletion: Algorithms and uniform kernel. SIAM J. Discrete Math., 32(2):882–901, 2018.

[16] Ashutosh Rai and M. S. Ramanujan. Strong parameterized deletion: Bipartite graphs. In 36th IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science, FSTTCS 2016, pages 21:1–21:14, 2016.

[17] Ashutosh Rai and Saket Saurabh. Bivariate complexity analysis of almost forest deletion. Theor. Comput. Sci., 708:18–33, 2018.

[18] Mihalis Yannakakis. Node-deletion problems on bipartite graphs. SIAM J. Comput., 10(2):310–327, 1981.

31