In this section we illustrate the power of Theorem 4 by showing that a number of known fixed-parameter tractability results can be obtained as direct consequences of the theorem. In Sect. 4.1, we start with the simple observation that if a parameterized problem is slicewise first-order definable than so is deletion distance to the problem (suitably parameterized). Examples of this include previous results of Moser and Thilikos [26]. We consider more general edit distances in Sect. 4.2 and show that of Mathieson [23, 25] can be obtained as special cases of our result. Finally, in Sect. 4.3, we consider the problem of computing the tree-depth of a graph. Again, this problem is known to be FPT, and the novelty here is in constructing the first-order definitions that show it is slicewise first-order definable. The consideration of tree-depth also leads naturally to considering, more generally, elimination distance to sparse classes and this topic is taken up in Sect. 5.
Deletion Distance
A graph G has deletion distance
k to a class \(\mathcal {C}\) if there exists a set S of k vertices in G so that \(G{\setminus } S\in \mathcal {C}\). Suppose \((Q,\kappa )\) is a parameterized graph problem. We define the problem of deletion distance to Q as follows:
Proposition 1
If \((Q,\kappa )\) is slicewise nowhere dense and slicewise first-order definable then Deletion Distance to
Q is \(\mathrm {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 \(\varphi _i\) is the first-order formula that defines the class of graphs \(\mathcal {C}_i = \{G \mid \kappa (G) \le i \text{ and } G \in Q\}\), then the class of graphs at deletion distance k to \(\mathcal {C}_i\) is given by:
$$\begin{aligned} \exists w_1, \dots , w_{k} \varphi _i^{[x.\theta _k]} \end{aligned}$$
where \(\theta _k(x)\) is the formula \(\bigwedge _{1\le i\le k} x \ne w_i \).
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 depth-r-minor of any graph in \(\mathcal {C}_i\). Then a graph which has deletion distance k to \(\mathcal {C}_i\) cannot have \(K_{m+k}\) as a depth-r-minor. Indeed, suppose
and \(G{\setminus } S \in \mathcal {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
, a contradiction.\(\square \)
Consider as an example deletion distance k to maximum degree d.
Example 1
We can express that a vertex has no more than d different neighbours using the following formula:
$$\begin{aligned} \varphi _d(v) := \lnot \exists v_1, \dots , v_{d+1} \left( \left( \bigwedge _{i< j} v_i \ne v_j\right) \wedge \left( \bigwedge _{i} E(v, v_i) \right) \right) . \end{aligned}$$
So a graph G has maximum degree bounded by d if and only if \(G \models \forall v \phi _d(v)\). Let \(\mathcal {C}_d\) be the class of graphs with maximum degree bounded by d. Then the following formula captures deletion distance k to maximum degree d:
$$\begin{aligned}&\exists w_1, \dots , w_{k} \forall v \left( \bigwedge _i v \ne w_i \right) \rightarrow \\&\quad \left( \lnot \exists v_1, \dots , v_{d+1} \left( \left( \bigwedge _{i, j} v_i \ne w_j\right) \wedge \left( \bigwedge _{i< j} v_i \ne v_j\right) \wedge \left( \bigwedge _{i} E(v, v_i) \right) \right) \right) . \end{aligned}$$
Thus the technique introduced in this section is sufficient to show that deletion distance k to maximum degree d is fixed-parameter tractable parameterized by \(k+d\).
Moser and Thilikos [26] showed that deleting k vertices to obtain a d-regular graph is fixed-parameter tractable parameterized by \(k + d\). Since the class of d-regular graphs is also first-order definable and nowhere dense for any d, their result is also a consequence of Theorem 4.
Edit Distances to Graph Classes Defined by Degree Constraints
Instead of deletion distance (defined by deleting vertices), we can also consider more general graph editing distances (defined through more general edit operations on the graph), e.g. modifying the graph by adding or deleting edges.
For example, to obtain a formula that defines the graphs that are one edge addition away from a class of graphs \(\mathcal {C}\) defined by the formula \(\varphi \), we construct \(\hat{\varphi }\) from \(\varphi \) by replacing all occurrences of \(E(w_1, w_2)\) in \(\varphi \) by:
$$\begin{aligned} (w_1 = u \wedge w_2 = v) \vee (w_1 = v \wedge w_2 = u) \vee E(w_1, w_2). \end{aligned}$$
Then the formula \(\exists u \exists v \hat{\varphi }\) defines the class of graphs with edge addition distance 1 to \(\mathcal {C}\), i.e. \( G \models \exists u \exists v \hat{\varphi }\) if, and only if, G with an additional edge satisfies \(\varphi \). This can easily be generalised to k edge additions: From a formula \(\varphi \) we can obtain a formula \(\hat{\varphi }_k\) such that for any graph G we have that \(G \models \hat{\varphi }\) if, and only if, there are pairs of vertices \(u_1, v_1, \dots , u_k, v_k \in V(G)\) such that G, with additional edges \(u_1v_1, \dots u_kv_k\), satisfies \(\varphi \).
Similarly, given a formula \(\psi \) that defines a graph class \(\mathcal {C}\), we can define a formula \(\hat{\psi }\) by replacing all occurrences of \(E(w_1, w_2)\) in \(\psi \) by:
$$\begin{aligned} (w_1 \ne u \vee w_2 \ne v) \wedge (w_1 \ne v \vee w_2 \ne u) \wedge E(w_1, w_2). \end{aligned}$$
Then \(\exists u \exists v \hat{\psi }\) defines the class of graphs with edge deletion distance 1 to \(\mathcal {C}\). It should be clear that this can also be generalised to k edge deletions.
Thus, an analogue of Proposition 1 can be obtained for any edit distance where the allowed edit operations are a combination of vertex and edge deletions and additions. In the following we discuss this in more detail, where the class we are editing to is defined by degree constraints.
In his doctoral thesis Mathieson [23] studies the parameterized complexity of such graph editing problems with the aim to satisfy a variety of degree constraints. He defines the general template of Weighted Degree Constrained Editing (or just WDCE). In the following we explore one instance (that he refers to as WDCE
\(_1^r\)) of a number of more general templates that also allow for weight functions of vertices and edges, as well as a different degree target for each vertex and a target for the sum of edge weights. This is just for the sake of simplicity here, the more general operations are also definable in first-order logic and give rise to nowhere dense graph classes. In the following we abbreviate the editing operations vertex deletion, edge deletion and edge addition as v, e and a respectively. Then for each non-empty \(S \subseteq \{v, e, a\}\) define WDCE(S) as:
Mathieson [25] shows that the problem is fixed-parameter tractable for any S and parameter \(k + d\). Inspired by Stewart [31], Mathieson shows that the problem is first-order definable (with the size of the formula depending on k and d), by considering the incidence graph as a relational structure. (For the weighted version of the problem, he adds a unary relation for every possible weight.) Since a graph that can be edited to be regular must its degree bounded by \(k + d\) it is therefore also nowhere dense. Thus the result also follows directly from Theorem 4.
Building on this, Golovach [16] gives a concrete algorithm that edits a graph so that every vertex has a given degree at most d using at most k edge additions/deletions.
More recently, Mathieson [24] looks at more general versions of degree constraint problems. He considers three notions of regularity: edge-degree-regular, edge-regular and strongly-regular. He studies the problems of editing to these three notions of regularity.
The edge-degree of an edge uv is the sum of the degrees of the endpoints of \(d(u) + d(v)\) and a graph is edge-degree-regular if all edges uv have the same edge-degree.
The two other notions combine the degrees of vertices and common neighbourhoods of endpoints of edges (and non-edges). A graph is \((r,\lambda )\)
-edge-regular if every vertex has degree r and every edge uv has \(|N(u) \cap N(v)| = \lambda \). A graph is \((r, \lambda , \mu )\)
-strongly-regular if it is \((r, \lambda )\)-edge-regular and for every pair u, v of non-adjacent vertices we have \(|N(u) \cap N(v)| = \mu \). This is the standard notion of a strongly regular graph as introduced by Bose [2].
Just as above we abbreviate the editing operations vertex deletion, edge deletion and edge addition as v, e and a respectively. We also abbreviate the three notions of regularity edge-degree regular, edge-regular and strongly regular as \(r_1, r_2, r_3\) respectively. Then for each non-empty \(S \subseteq \{v, e, a\}\) and each \(r \in \{r_1, r_2, r_3\}\) define RCE(S) as:
Mathieson [24] shows that editing to these three notions of regularity is \(\mathrm {FPT} \) parameterized by \(k + d\), where d is the degree we are editing to and k is the number of allowed edits. This also follows from our meta-theorem: Just as in Example 1, it is easy to show that the class of graphs with edit distance k to an d-regular graph is first-order definable and has bounded degree, and is thus also nowhere dense. The additional constraints are also first-order definable, for example \(|N(u) \cap N(v)| = \lambda \) can be expressed as follows:
$$\begin{aligned} \exists x_1 \dots \exists x_\lambda . \left( \bigwedge _{i < j} x_i \ne x_j \bigwedge _{i} (E(x_i, u) \wedge E(x_i, v)) \wedge \lnot \exists y \left( \bigwedge _i (x_i \ne y) \wedge (E(u, y) \wedge E(v, y)) \right) \right) \end{aligned}$$
So each of these problems is first-order definable and nowhere-dense, so it follows directly from Theorem 4 that these problems are fixed-parameter tractable with the combined parameter \(k + d\).
Tree-Depth
Recall that 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, and can itself be interpreted as a distance measure (elimination distance to the empty graph). For convenience we give the usual definition here:
Definition 2
The tree-depth of a graph G, written \( td (G)\), is defined as follows:
$$\begin{aligned} td (G) := {\left\{ \begin{array}{ll} 0, &{}\quad \text {if }V(G) = \emptyset ; \\ 1 + \min \{ td (G {\setminus } v) \mid v \in V(G)\}, &{}\quad {\text {if}}\,G\,\text {is connected;} \\ \max \{ td (H) \mid H \text { a component of } { G}\}, &{}\quad \text {otherwise.} \end{array}\right. } \end{aligned}$$
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 \(\mathrm {FPT} \), with tree-depth as the parameter (see [28, Theorem 7.2]). We now give an alternative proof of this, using Theorem 4. 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 2
For each \(k \in \mathbb {N}\) there is a first-order formula \(\varphi _k\) such that a graph G has tree-depth k if and only if \(G \models \varphi _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\) [28, Section 6.2]. 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\).
Recall that \(\mathrm {dist}_d(u,v)\) is 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 \(\mathrm {dist}_d^{[x.x \ne w]}(u,v)\) 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 \(\phi _k\) by induction. Only the empty graph has tree-depth 0, so \(\phi _0 := \lnot \exists v(v = v)\).
Suppose that \(\phi _k\) defines the graphs of tree-depth at most k, let
$$\begin{aligned} \theta _{k} := \left( \forall u,v \, \mathrm {dist}_{2^{k+1}}(u,v)\right) \wedge \exists w \left( \varphi _k^{[x.x \ne w]}\right) . \end{aligned}$$
The formula \(\theta _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 \(\varphi _{k+1}\) as follows.
$$\begin{aligned} \varphi _{k+1} := \left( \forall u,v \, \mathrm {dist}_{2^{k+1}+1}(u,v) \rightarrow \mathrm {dist}_{2^{k+1}}(u,v)\right) \wedge \forall w \theta _k^{\left[ x.\mathrm {dist}_{2^{k+1}}(w,x)\right] }. \end{aligned}$$
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 \(\theta _k\) holds in its connected component, namely those vertices which are at distance at most \(2^{k+1}\) from w.\(\square \)
While the proof of Proposition 1 shows that deletion distance to any slicewise first-order definable class is also slicewise first-order definable, Proposition 2 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—that remains an open question. We conjecture that elimination distance to a slicewise nowhere dense class is not first-order definable.