Fixed-parameter Tractable Distances to Sparse Graph Classes

We show that for various classes C of sparse graphs, and several measures of distance to such classes (such as edit distance and elimination distance), the problem of determining the distance of a given graph G to C is fixed-parameter tractable. The results are based on two general techniques. The first of these, building on recent work of Grohe et al. establishes that any class of graphs that is slicewise nowhere dense and slicewise first-order definable is FPT. The second shows that determining the elimination distance of a graph G to a minor-closed class C is FPT.


Introduction
The study of parameterized algorithmics for graph problems has thrown up a large variety of structural parameters of graphs. Among these are parameters that measure the distance of a graph G to a class C in some way. The simplest such measures are those that count the number of vertices or edges that one must delete (or add) to G to obtain a graph in C. A common motivation for studying such parameters is that if a problem one wishes to solve is tractable on the class C, then the distance to C provides an interesting parameterization of that problem (called distance to triviality by Guo et al. [14]). Other examples of this include the study of modulators to graphs of bounded tree-width in the context of kernelization (see [9,11]) or the parameterizations of colouring problems (see [17]). On the other hand, determining the distance of an input graph G to a class C is, in general, a computationally challenging problem in its own right. Such problems have also been extensively studied with a view to establishing their complexity when parameterized by the distance. A canonical example is the problem of determining the size of a minimum vertex cover in a graph G, which is just the vertex-deletion distance of G to the class of edge-less graphs. More generally, Cai [3] studies the parameterized complexity of distance measures defined in terms of addition and deletion of vertices and edges to hereditary classes C. Counting deletions of vertices and edges gives a rather simple notion of distance, and many more involved notions have also been studied. Classic examples include the crossing number of a graph which provides one notion of distance to the class of planar graphs or the treewidth of a graph which can be seen as a measure of distance to the class of trees. Another recently introduced measure is elimination distance, defined in [2] where it was shown that graph isomorphism is FPT when parameterized by elimination distance to a class of graphs of bounded degree.
In this paper we consider the fixed-parameter tractability of a variety of different notions of distance to various different classes C of sparse graphs. We establish two quite general techniques for establishing that such a distance measure is FPT. The first builds on the recent result of Grohe et al. [13] which shows that the problem of evaluating first-order formulas on any nowhere dense class of graphs is FPT with the formula as parameter. We extract from their proof of this result a general statement about the fixed-parameter tractability of definable sparse classes. To be precise, we show that parameterized problems that are both slicewise nowhere dense and slicewise first-order definable (these terms are defined precisely below) are FPT. As an application of this, it follows that if C is a nowhere dense class of graphs that is definable by a first-order formula, then the parameterized problem of determining the distance of a graph G to C is FPT, for various notions of distance that can be themselves so defined. In particular, we get that various forms of edit distance to classes of bounded-degree graphs are FPT (a result established by Golovach [12] by more direct methods). Another interesting application is obtained by considering elimination distance of a graph G to the class C of empty graphs. This is nothing other than the tree-depth of G. While elimination distance to a class C is in general not first-order definable, it is in the particular case where C is the class of empty graphs. Thus, we obtain as an application of our method the result that tree-depth is FPT, a result previously known from other algorithmic meta theorems (see [18,Theorem 17.2]). The method of establishing that a parameterized problem is FPT by establishing that it is slicewise nowhere dense and slicewise first-order definable appears to be a powerful method of some generality which will find application beyond these examples.
Our second general method specifically concerns elimination distance to a minorclosed class C. We show that this measure is fixed-parameter tractable for any such C, answering an open question posed in [2]. Note that while a proper minor-closed class is always nowhere dense, it is not generally first-order definable (for instance, neither the class of acyclic graphs nor the class of planar graphs is), and elimination distance to such a class is also not known to be first-order definable. Thus, our results on the tractability of slicewise first-order definable classes do not apply here. Instead, we build on work of Adler et al. [1] to show that from a finite list of the forbidden minors characterising C, we can compute the set of forbidden minors characterising the graphs at elimination distance k to C. Adler et al. show how to do this for apex graphs, from which one immediately obtains the result for graphs that are k deletions away from C. To extend this to elimination distance k, we show how we can construct the forbidden minors for the closure of a minor closed class under disjoint unions.
In Section 2 we present the definitions necessary for the rest of the paper. Section 3 establishes our result for slicewise first-order definable and slicewise nowhere dense problems and gives some applications of the general method. Section 4 establishes that the problem of determining elimination distance to any minor-closed class is FPT. Some open questions are discussed in Section 5.

Preliminaries
First-order logic. We assume some familiarity with first-order logic for Section 3. A (relational) signature σ is a finite set of relation symbols, each with an associated arity. A σ-structure A consists of a set V (A) and for each k-ary relation symbol R ∈ σ a relation R(A) ⊆ V (A) k . Our structures will mostly be (coloured) graphs, so σ = {E} or σ = {E, C 1 , C 2 , . . . , C r } where E is binary and the C i are unary relation symbols. A graph G is then a σ-structure with vertex set V (G), edge relation E(G), and colours C i (G).
A first-order formula ϕ is recursively defined by the following rules: We also use the following abbreviations: The quantifier rank of a formula ϕ is the nesting depth of quantifiers in ϕ. For a more detailed presentation we refer to Hodges [15].
Parameterized Complexity. Parameterized complexity theory is a two-dimensional approach to the study of the complexity of computational problems. We find it convenient to define problems as classes of structures rather than strings. A problem Q ⊆ str(σ) is an (isomorphism-closed) class of σ-structures given some signature σ. A parameterization is a function κ : str(σ) → N. We say that Q is fixed-parameter tractable with respect to κ if we can decide whether an input A ∈ str(σ) is in Q in time O(f (κ(A)) · |x| c ), where c is a constant and f is some computable function. For a thorough discussion of the subject we refer to the books by Downey and Fellows [6], Flum and Grohe [8] and Niedermeier [20]. A parameterized problem (Q, κ) is slicewise first-order definable if there is a computable function f such that: Slicewise definability of problems in a logic was introduced by Flum and Grohe [7].
Graph theory. A graph G is a set of vertices V (G) and a set of edges E(G) ⊆ V (G) × V (G). We assume that graphs are loop-free and undirected, i.e. that E is irreflexive and symmetric. We mostly follow the notation in Diestel [5]. For a set S ⊆ V (G) of vertices, we write G \ S to denote the subgraph of G induced by V (G) \ S.
Let r ∈ N. An r-independent set in a graph G is a set of vertices of G such that their pairwise distance is at least r.
A graph H is a minor of a graph G, written H G, if there is a map, called the minor map, that takes each vertex v ∈ V (H) to a tree T v that is a subgraph of G such that for any u = v the trees are disjoint, i.e. T v ∩ T u = ∅, and such such that for every The set of minimal excluded minors M(C) is the set of graphs in the complement of C such that for each G ∈ M(C) all proper minors of G are in C. By the Robertson-Seymour Theorem [21] the set M(C) is finite for every minor-closed class C. It is a consequence of this theorem that membership in a minor-closed class can be tested in O(n 3 ) time.
Let r ∈ N. A minor H of G is a depth-r minor of G if there is a minor map that takes vertices in H to trees that have radius at most r. A class of graphs C is nowhere dense if for every r ∈ N there is a graph H r such that for no G ∈ C we have H r r G. A nowhere dense class of graphs C is called effectively nowhere dense if there is a computable function f from integers to graphs such that for no G ∈ C and no r we have f (r) r G. We are only interested in effectively nowhere dense classes so we simply use the term nowhere dense to mean effectively nowhere dense.
We say that a parameterized graph problem (Q, κ) is slicewise nowhere dense if there is a computable function h from pairs of integers to graphs such that for all i ∈ N, we have for no G ∈ {H ∈ Q | κ(H) ≤ i} and r that h(i, r) r G. We will call h the parameter function of Q.
For a class of graphs C we denote the closure of C under taking disjoint unions by C. We say that a graph G is an apex graph over a class C of graphs if there is a vertex v ∈ V (G) such that the graph G\{v} ∈ C. The class of all apex graphs over C is denoted The elimination distance of a graph G to a class C defined as follows:

A general method for editing distances
In this section we establish a general technique for showing that certain definable parameterized problems on graphs are FPT. As an application, we show that certain natural distance measures to sparse graph classes are FPT. To be precise, we show that if a parameterized problem is both slicewise first-order definable and slicewise nowhere dense, then it is FPT. In particular, this implies that if we have a class C that is first-order definable and nowhere dense and the distance measure we are interested in is also firstorder definable (that is to say, for each k there is a formula that defines the graphs at distance k from C), then the problem of determining the distance is FPT. More generally, if we have a parameterized problem (Q, κ) that is slicewise nowhere dense and slicewise first-order definable, and a measure of distance to it is definable in the sense that for any values of k and d, there is a first-order formula defining the graphs at distance d to the class {G | G ∈ Q and κ(G) ≤ k}, then the problem of deciding whether a graph has distance at most d to this class is FPT parameterized by d + k. In particular, this yields the result of Golovach [12] as a consequence.
The method is an adaption of the main algorithm in Grohe et al. [13]. Since the proof is essentially a modification of their central construction, rather than give a full account, we state the main results they prove and explain briefly how the proofs can be adapted for our purposes. For a full proof, this section is best read in conjunction with the paper [13]. Section 3.1 gives an overview of the key elements of the construction from [13] and the elements from it which we need to extract for our result. Section 3.2 then gives our main result and Section 3.3 derives some consequences for distance measures.

Evaluating Formulas on Nowhere Dense Classes
The key result of [13] is: [13], Theorem 1.1). For every nowhere dense class C and every ǫ > 0, every property of graphs definable in first-order logic can be decided in time O(n 1+ǫ ) on C.
We first give a sketch of the algorithm from Theorem 3.1 with an emphasis on the changes needed for our purposes. We refer to [13] for several definitions and results.
The algorithm developed in the proof of Theorem 3.1 uses a locality-based approach, similar to that used by Frick and Grohe [10] to show that first-order evaluation is FPT on graphs of local bounded treewidth and developed in [4] for application to graph classes with locally excluded minors . The idea is that any first-order formula ϕ is, by Gaifman's theorem, equivalent to a Boolean combination of local formulae, that is formulae that assert the existence of neighbourhoods satisfying certain conditions. In classes of sparse graphs where the size (or other parameter) of neighbourhoods of a given radius can be bounded, this yields an efficient evaluation algorithm.
In nowhere dense classes of graphs, we cannot in general bound the size of neighbourhoods. For example, the class of apex graphs is nowhere dense, but a graph may contain a vertex whose neighbourhood is the whole graph. However, nowhere dense classes are quasi-wide [18], which means that we can remove a small (i.e. parameter-dependent) set of vertices (the bottleneck) to ensure that there are many vertices that are far away from each other. Grohe et al. [13] use this approach to iteratively transform the input graph into a coloured graph where key bottleneck vertices are removed and vertices are coloured to keep relevant information. At the same time the formula ϕ to be evaluated is also transformed so that it can be evaluated on the modified graph. This procedure terminates on nowhere dense classes of graphs within a constant number of steps.
A key data structure used in the algorithm is a neighbourhood cover, i.e. a collection of connected subgraphs, called clusters, so that each neighbourhood of a vertex is contained in one of the clusters. The radius of a cover is the maximum radius of any of its clusters. The degree of a vertex in a cover is the number of clusters the vertex is contained in. An important result from [13] is that graphs from a nowhere dense class allow for small covers and that such a cover can be efficiently computed.
Theorem 3.2 (Grohe et al. [13], Theorem 6.2). Let C be a nowhere dense class of graphs. There is a function f such that for all r ∈ N and ǫ > 0 and all graphs G ∈ C with n ≥ f (r, ǫ) vertices, there exists an r-neighbourhood cover of radius at most 2r and maximum degree at most n ǫ and this cover can be computed in time f (r, ǫ) · n 1+ǫ . Furthermore, if C is effectively nowhere dense, then f is computable.
In this theorem, f is a function of r and ǫ and depends on the class C in the sense that it is determined, for an effectively nowhere dense C by its parameter function. To be precise, the algorithm needs to order the vertices of G to witness a weak colouring number of less than n ǫ . The weak colouring number is an invariant of the graph that is guaranteed to be low for graphs from a nowhere dense class. The time bound f (r, ǫ)·n 1+ǫ is obtained using an algorithm for this from Nesetril and Ossona de Mendez [19].
While the algorithm of [13] assumes that the input graph G comes from the class C, we can say something more. For a fixed nowhere dense class C, where we know the parameter function h, we can, given G, r and ǫ, compute a bound on the running time of the algorithm from Theorem 3.2 . By running the algorithm to this bound, we have the following as a direct consequence of the proof of Theorem 3.2 .
There is a computable function f and an algorithm A which given any graph G with n vertices and for any r ∈ N and ǫ > 0 either computes an r-neighbourhood cover of radius at most 2r and maximum degree at most n ǫ or determines that G ∈ C.
At the core of the proof of Theorem 3.1 is the Rank-Preserving Locality Theorem. Given a neighbourhood cover X in a graph G, the algorithm iteratively removes bottleneck vertices and adds colours to the neighbourhoods of removed vertices to obtain a coloured graph denoted G ⋆ q+1 X q. Here q is an integer parameter obtained from the first-order formula ϕ that we wish to evaluate in G. At the same time, ϕ is transformed into a formulaφ that is (a) in the expanded signature of the G ⋆ q+1 X q; and (b) in a logic FO + which enriches FO by allowing us to assert distances between vertices without the need for quantifiers. This ensures that the local sentenceφ has the same quantifier rank as ϕ, giving us the Rank-Preserving Locality Theorem below. In the following statement, a (q + 1, r)-independence sentence is a formula asserting the existence of a distance-r-independent set of size q + 1 of a particular colour. For every q ∈ N there is an r such that for every FO-formula ϕ(x) of quantifier rank q there is an FO + -formulaφ(x), which is a Boolean combination of (q + 1, r)-independence sentences and atomic formulas, such that for any graph G every r-neighbourhood cover X of G, and every v ∈ V (G), Furthermore,φ is computable from ϕ, and r is computable from q.
An important tool for constructing G ⋆ q+1 X q is a game characterisation of nowhere dense classes. The game has three parameters: ℓ, m, r. In the (ℓ, m, r) Splitter game two players Connector and Splitter play against each other. In each round Connector chooses a vertex u, and Splitter has to respond with a set A of vertices of size at most m in the r-neighbourhood of u. In the next round the graph is the neighbourhood of u with the vertices from A removed. If the graph is empty, Splitter wins. If Connector survives for more than ℓ rounds, she wins. Grohe et al. [13] prove [13,Theorem 4.2] that if C is a nowhere dense class, then there are ℓ, m such that Splitter has a winning strategy on the (ℓ, m, 2r) Splitter game on every graph in C.
The Splitter's strategy on a graph G (which can be efficiently computed) is the essential tool in the construction of G ⋆ q+1 X q. The inductive procedure used to compute G ⋆ q+1 X q from G is outlined in [13, Proof of Theorem 8.1]. We note that the termination of the algorithm depends on the length of the game -which is bounded by a constant since C is nowhere dense. The strategy to compute Splitter's moves is described in [13,Remark 4.3]. Since the run time of the algorithm to compute G ⋆ q+1 X q only depends on q and the length of the Splitter game and we can compute this in advance, we can once again extract the fact that if we start with an arbitrary graph G, we can efficiently either transform it into G ⋆ q+1 X q or determine that it is not in the class C. This is summed up in the following lemma.
Lemma 3.5. Let C be a nowhere dense class of graphs. There is an algorithm that runs in time O(q) which given a graph G returns G ⋆ q+1 X q or determines that G ∈ C.
Theorem 3.4 reduces the problem of evaluating a formula of first-order logic to deciding a series of distance-r-independent set problems. So, the final ingredient is to show that this is tractable. Formally, the problem is defined as follows: Distance Independent Set Input: A graph G and k, r ∈ N. Parameter: k + r Problem: Does G contain an r-independent set of size k? The problem is shown to be FPT on nowhere dense classes of graphs [13, Theorem 5.1]. Since the runtime of the algorithm depends on the length of the Splitter game and Splitter's strategy, and this can be bounded in advance, [13, Theorem 5.1] can be restated as follows: Lemma 3.6. Let C be a nowhere dense class of graphs. Then there is an algorithm A and a computable function f such that for every ǫ > 0 A runs in time f (ǫ, r, k) and either solves the Distance Independent Set problem or determines that G ∈ C. This is all we need to evaluateφ on G ⋆ q+1 X q, which is equivalent to evaluating ϕ on G by Theorem 3.4.

Deciding Definable nowhere dense Problems
The main result of [13] establishes that checking whether G |= ϕ is FPT when parameterized by ϕ provided that G comes from a known nowhere dense class C. Thus, the formula is arbitrary, but the graphs come from a restricted class. In Section 3.1 above we give an account of this proof from which we can extract the observation that the algorithm can be modified to work for an arbitrary input graph G with the requirement that the algorithm may simply reject the input if G is not in C. This suggests a tractable way of deciding G |= ϕ provided that ϕ defines a nowhere dense class. Now the graphs is arbitrary, but the formula comes from a restricted class. We formalise the result in the following theorem: Theorem 3.7. Let (Q, κ) be a problem that is slicewise first-order definable and slicewise nowhere dense. Then (Q, κ) is fixed-parameter tractable.
Proof. In the following, for ease of exposition, we assume that an instance of the problem consists of a graph G and κ(G) = i for some positive integer i.
Step 1: Compute ϕ and the parameters function. Since (Q, κ) is slicewise first-order definable, we can compute from i a first-order formula ϕ which defines the class of graphs C i = {H | H ∈ Q and κ(H) ≤ i}. Moreover, since (Q, κ) is slicewise nowhere dense, we can compute from i an algorithm that computes the parameter function h for C i .
Step 2: Obtainφ from ϕ. By the Rank-Preserving Locality Theorem (Theorem 3.4), we can compute from ϕ the formulaφ and a radius r.
Step 3: Find a small cover X for G. By Lemma 3.3, we can either find a cover X for G, or reject if the algorithm determine that G ∈ C i .
Step 4: Simulate Splitter game to compute G ⋆ q+1 X q. By Lemma 3.5 we obtain G⋆ q+1 X q or reject if the algorithm determines that G ∈ C i .
Step 5: Evaluateφ on G ⋆ q+1 X q. Finally we evaluateφ on G⋆ q+1 X q. To do this, we need to solve the distance independent set problem. We can do this by Lemma 3.6.
Since evaluatingφ on G ⋆ q+1 X q is equivalent to evaluating ϕ on G this allows us to decide whether G ∈ Q.

Applications
In this Section we discuss some applications of Theorem 3.7 that demonstrate its power. We begin by considering simple edit distances.
Edit Distances A graph G has deletion distance k to a class C if there exists a set S of k vertices in G so that G \ S ∈ C. Suppose (Q, κ) is a parameterized graph problem. We define the problem of deletion distance to Q as follows: Deletion Distance to Q Input: A graph G and k, d ∈ N. Parameter: k + d Problem: Does G contain a set S of k vertices so that κ(G\S) ≤ d and G\S ∈ Q? In many of the examples below, we define formulas of first-order logic by relativisation. For convenience, we define the notion here. The key idea here is that if ϕ [x.ψ] is true in a graph G if ϕ is true in the subgraph of G induced by the vertices that satisfy ψ(x). Note that the variable x that is free is ψ is bound in ϕ [x.ψ] . Other variables that appear free in ψ remain free in ϕ [x.ψ] . We stress this as it is needed in Proposition 3.11 where nested relativisations are used. Proposition 3.9. If (Q, κ) is slicewise nowhere dense and slicewise first-order definable then Deletion Distance to Q is FPT.
Proof. It suffices to show that Deletion Distance to Q is also slicewise nowhere dense and slicewise first-order definable. For the latter, note that if ϕ i is the first-order formula that defines the class of graphs C i = {G | κ(G) ≤ i and G ∈ Q}, then the class of graphs at deletion distance k to C i is given by: To see that Deletion Distance to Q is also slicewise nowhere dense, let h be the parameter function for Q. If the graph h(i, r) has m vertices, then K m is not a depthr-minor of any graph in C i . Then a graph which has deletion distance k to C i cannot have K m+k as a depth-r-minor. Indeed, suppose K m+k r G and G \ S ∈ C i where S is a set of k vertices. Vertices from S can appear in the images of at most k vertices from K m+k under the minor map. Thus, this minor map also witnesses that K m r G \ S, a contradiction.
Instead of deleting vertices, we can also consider editing the graph by adding or deleting edges. It is easily seen that we can modify a first-order formula ϕ to define the class of graphs G that can be made to satisfy ϕ by k edge additions or deletions. An added or deleted edge is identified by a pair of vertices uv ∈ E(G). If we want to add the edge uv we can replace all occurrences of E(w 1 , w 2 ) in ϕ by: Similarly we delete an edge uv by replacing all occurrences of E(w 1 , w 2 ) in ϕ by: Thus, an analogue of Proposition 3.9 is obtained for any combination of vertex and edge deletions and additions. Golovach [12] proved that that editing a graph to degree d using at most k edge additions/deletions is FPT parameterized by k + d. Since the class of graphs of degree d is first-order definable and nowhere dense for any d, the result also follows directly from Theorem 3.7.
Tree-depth. Tree-depth is a graph parameter that lies between the widely studied parameters vertex cover number and tree width. It has interesting connections to nowhere dense graph classes. It is usually defined as follows: Definition 3.10. The tree-depth of a graph G, written td (G), is defined as follows: Note that a graph has tree-depth k if and only if it has elimination distance k to the class of empty graphs. So one can think of elimination distance as a natural generalisation of tree-depth.
It is known that the problem of determining the tree-depth of graph is FPT, with tree-depth as the parameter (see [18,Theorem 7.2]). We now give an alternative proof of this, using Theorem 3.7. It is clear that for any k, the class of graphs of tree-depth at most k is nowhere dense. We show below that it is also first-order definable.
Proposition 3.11. For each k ∈ N there is a first-order formula ϕ k such that a graph G has tree-depth k if and only if G |= ϕ k .
Proof. We use the fact that in a graph of tree-depth less than k, there are no paths of length greater than 2 k . This allows us, in the inductive definition of tree-depth above, to replace the condition of connectedness (which is not first-order definable) with a first-order definable condition on vertices at distance at most 2 k .
Let dist d (u, v) denote the first-order formula with free variables u and v that is satisfied by a pair of vertices in a graph G if, and only if, they have distance at most d in G. Note that the formula dist is then a formula with three free variables u, v, w which defines those u, v which have a path of length d in the graph obtained by deleting the vertex w.
We can now define the formula ϕ k by induction. Only the empty graph has tree-depth 0, so ϕ 0 := ¬∃v(v = v).
Suppose that ϕ k defines the graphs of tree-depth at most k, let ).
The formula θ k defines the connected graphs of tree depth at most k +1. Indeed, the first conjunct ensures that the graph is connected as no pair of vertices has distance greater than 2 k+1 and the second conjunct ensures we can find a vertex w whose removal yields a graph of tree-depth at most k.
We can now define the formula ϕ k+1 as follows.
The formula asserts that there are no pairs of vertices whose distance is strictly greater than 2 k+1 and that for every vertex w, the formula θ k holds in its connected component, namely those vertices which are at distance at most 2 k+1 from w.
While the proof of Proposition 3.9 shows that deletion distance to any slicewise firstorder definable class is also slicewise first-order definable, Proposition 3.11 shows that elimination distance to the particular class of empty graphs is slicewise first-order definable. It does not establish this more generally for elimination distance to any slicewise nowhere dense class.

Elimination distance to classes characterised by excluded minors
In this section we show that determining the elimination distance of a graph to a minorclosed class C is FPT when parameterized by the elimination distance. More generally, we formulate the following parameterized problem where the forbidden minors of C are also part of the parameter.

Elimination Distance to Excluded Minors
Input: A graph G, a natural number k ∈ N and a set of graphs M Parameter: k + G∈M |G| Problem: Does G have elimination distance k to the class C characterised by M(C) = M? It is not difficult to show that the class of graphs which have elimination distance k to a minor-closed class C is also a minor-closed class. Indeed, this can be seen directly from an alternative characterisation of elimination distance that we establish below. The characterisation is in terms of the iterated closure of C under the operation of disjoint unions and taking the class of apex graphs. We introduce a piece of notation for this in the next definition. Recall that we write C apex for the class of all the apex graphs over C, and that we write C for the closure of C under disjoint unions. We show next that the class C k is exactly the class of graphs at elimination distance k from C. Proposition 4.2. Let C be a class of graphs and k ≥ 0. Then C k is the class of all graphs with elimination distance at most k to C.
Proof. We prove this by induction. Only the graphs in C have elimination distance 0 to C, so the statement holds for k = 0.
Suppose the statement holds for k. If G ∈ C k+1 , then G is a disjoint union of graphs G 1 , . . . , G s from C k apex , so we can remove at most one vertex from each of the G i and obtain a graph in C k . Thus the elimination distance of G to C k is 1, and by induction the elimination distance to C is k + 1. Conversely, if G has elimination distance k + 1 to C, then we can remove a vertex from each component of G to obtain a graph G ′ with elimination distance k to C. Using the induction hypothesis each component of G ′ is in C k , and thus G ∈ C k+1 .
It is easy to see that if C is a minor-closed class of graphs then so is C k for any k. Indeed, it is well-known that C apex is minor-closed for any minor-closed C, so we just need to note that C is also minor-closed. But it is clear that if H is a minor of a graph G that is the disjoint union of graphs G 1 , . . . , G s , then H itself is the disjoint union of (possibly empty) minors of G 1 , . . . , G s . Thus, the class of graphs of elimination distance at most k to a minor-closed class C is itself minor-closed. We next show that we can construct the set of its minimal excluded minors from the corresponding set for C.
To obtain M(C k ), we need to iteratively compute M(C apex ) and M(C) from M(C). Adler et al. [1] show that from the set of minimal excluded minors M(C) of a class C, we can compute M(C apex ): We next aim to show that from M(C) we can also compute compute M(C). Together with Theorem 4.3 this implies that from M(C) we can compute M(C k ), the set of minimal excluded minors for the class of graphs with elimination distance k to C.
We begin by characterising minor-closed classes that are closed under disjoint unions in terms of the connectedness of their excluded minors. Proof. Let C be a minor-closed class of graphs, and let M(C) = {H 1 , . . . , H s } be its set of minimal excluded minors.
Suppose each of the graphs in M(C) is connected. Let H ∈ M(C) and let G = G 1 ⊕ · · · ⊕ G r be the disjoint union of graphs G 1 , . . . , G r ∈ C. Because H is connected, we have that H G if and only if H G i for one 1 ≤ i ≤ r. So, since all the G i ∈ C, we have H G and thus G ∈ C. This shows that C is closed under taking disjoint unions.
Conversely assume one of the graphs H ∈ M(C) is not connected and let A 1 , . . . , A t be its components . Then A 1 , . . . , A t ∈ C, since each A i is a proper minor of H, and H is minor-minimal in the complement of C. However, A 1 ⊕ · · · ⊕ A t = H ∈ C.
Definition 4.5. For a graph G with connected components G 1 , . . . , G r , let H denote the set of connected graphs H with V (H) = V (G) and such that the subgraph of H induced by V (G i ) is exactly G i . We define the connection closure of G to be the set of all minimal (under the subgraph relation) graphs in H. The connection closure of a set of graphs is the union of the connection closures of the graphs in the set.
Note that if G has e edges and m components, then any graph in the connection closure of G has exactly e + m − 1 edges. This is because it has G as a subgraph and in addition m−1 edges corresponding to a tree on m vertices connecting the m components.
Lemma 4.6. Let C be a minor-closed class of graphs. Then M(C) is the set of minorminimal graphs in the connection closure of M(C).
Proof. Let C be a minor-closed class of graphs, with M(C) its set of minimal excluded minors, and letM be the connection closure of M(C).
Let G be a graph such thatĤ G for allĤ ∈M . Suppose for a contradiction that G is not a disjoint union of graphs from C. Then there is a component G ′ of G that is not in C and therefore there is a graph H ∈ M(C) such that H G ′ . We show that one of the graphs in the connection closure of H is a minor of G ′ .
Let {w 1 , . . . , w s } be the vertex set of H and consider the image T 1 , . . . , T s of the minor map from H to G ′ . Let T be a minimal subtree of G ′ that contains all of the T i . Such a tree must exist since G ′ is connected. LetĤ be the graph with the same vertex set as H, and an edge between two vertices w i , w j whenever either w i w j ∈ E(H) or when there is a path between T w i and T w j in T that is disjoint from any T w k with w i = w k = w j . We claim thatĤ is in the connection closure of H. By construction,Ĥ is connected and contains all components of H as disjoint subgraphs, so we only need to argue minimality. H has no vertices besides those in H so no graph obtained by deleting a vertex would contain all components of H as subgraphs. To see that no edge ofĤ is superfluous, we note it has exactly e + m − 1 edges and thus no proper subgraph could be connected and have all components of H as disjoint subgraphs. By the constructionĤ G ′ G, so by the transitivity of the minor relation we have thatĤ G.
Conversely let G be an arbitrary graph and assume thatĤ ∈M andĤ G. Becausê H is connected, there is a connected component G ′ of G such thatĤ G ′ . Now there must be a graph H ∈ M(C) such thatĤ is in the connection closure of H, and since H is a subgraph ofĤ, H Ĥ . Then, by the transitivity of the minor relation, H G ′ and thus G ′ ∈ C. Therefore G is not a disjoint union of graphs from C. Now we can put everything together and prove our main theorem: Theorem 4.7. There is a computable function which takes a set M of excluded minors characterising a minor-closed class C and k ≥ 0 to the set M(C k ).
Proof. The proof is by induction. For k = 0, the set of minimal excluded minors of C 0 is M(C 0 ) = M(C), which is given. For k > 0, we have that C k = C k−1 apex . By the induction hypothesis we can compute M(C k−1 ), by Theorem 4.3 we can compute M(C k−1 apex ) and using Lemma 4.6 we can compute the connection closure of M(C k−1 apex ) to obtain M(C k−1 apex ) = M(C k ).
So by the Robertson-Seymour Theorem we have the following: Corollary 4.8. Let C be a minor-closed graph class. Then the problem Elimination Distance to Excluded Minors is FPT.

Conclusion
We are motivated by the study of the fixed-parameter tractability of edit distances in graphs. Specifically, we are interested in edit distances such as the number of vertex or edge deletions, as well as more involved measures like elimination distance. Aiming at studying general techniques for establishing tractability, we establish an algorithmic meta-theorem showing that any slicewise first-order definable and slicewise nowhere dense problem is FPT. This yields, for instance, the tractability of counting the number of vertex and edge deletions to a class of bounded degree. As a second result, we establish that determining elimination distance to any minor-closed class is FPT, answering an open question of [2]. A natural open question raised by these two results is whether elimination distance to the class of graphs of degree d is FPT. When d is 0, this is just the tree-depth of a graph, and this case is covered by our first result. For positive values of d, it is not clear whether elimination distance is first-order definable. Indeed, a more general version of the question is whether for any nowhere dense and first-order definable C, elimination distance to C is FPT.
Another interesting case that seems closely related to our methods, but is not an immediate consequence is that of classes that are given by first-order interpretations from nowhere dense classes of graphs. For instance, consider the problem of determining the deletion distance of a graph to a disjoint union of complete graphs. This problem, known as the cluster vertex deletion problem is known to be FPT (see [16]). The class of graphs that are disjoint unions of cliques is first-order definable but certainly not nowhere dense and so the method of Section 3 does not directly apply. However, this class is easily shown to be interpretable in the nowhere dense class of forests of height 1. Can this fact be used to adapt the methods of Section 3 to this class?