1 Introduction

The graph isomorphism problem (\(\mathsf {GI}\)) is the problem of determining, given a pair of graphs G and H, whether they are isomorphic. This problem has an unusual status in complexity theory as it is neither known to be in \(\mathsf {P}\) nor known to be \(\mathsf {NP}\)-complete, one of the few natural problems for which this is the case. Polynomial-time algorithms are known for a variety of special classes of graphs. Many of these lead to natural parameterizations of \(\mathsf {GI}\) by means of structural parameters of the graphs which can be used to study the problem from the point of view of parameterized complexity. For instance, it is known that \(\mathsf {GI}\) is in \(\mathsf {XP}\) parameterized by the genus of the graph [8, 16], by maximum degree [1, 15] and by the size of the smallest excluded minor [18], or more generally, the smallest excluded topological minor [10]. For each of these parameters, it remains an open question whether the problem is \(\mathsf {FPT}\). On the other hand, \(\mathsf {GI}\) has been shown to be \(\mathsf {FPT}\) when parameterized by eigenvalue multiplicity [5], tree distance width [21], the maximum size of a simplical component [19, 20] and minimum feedback vertex set [12]. Bouland et al. [2] showed that the problem is \(\mathsf {FPT}\) when parameterized by the tree depth of a graph and extended this result to a parameter they termed generalised tree depth. In a recent advance on this, Lokshtanov et al. [14] have shown that graph isomorphism is also \(\mathsf {FPT}\) parameterized by tree width.

Our main result extends the results of Bouland et al. and is incomparable with that of Lokshtanov et al. We show that graph canonisation is \(\mathsf {FPT}\) parameterized by elimination distance to degree d, for any constant d. The structural graph parameter we introduce is an instance of what Guo et al. [11] call distance to triviality and it may be of interest in the context of other graph problems. It should be noted that graphs with degree bounded by d (for \(d\ge 3\)) have unbounded tree-width and the same is a fortiori true of graphs with elimination distance k to degree d.

To put this parameter in context, consider the simplest notion of distance to triviality for a graph G: the number k of vertices of G that must be deleted to obtain a graph with no edges. This is, of course, just the size of a minimal vertex cover in G and is a parameter that has been much studied (see for instance [7]). Indeed, it is also quite straightforward to see that \(\mathsf {GI}\) is \(\mathsf {FPT}\) when parameterized by vertex cover number. Consider two ways this observation might be strengthened. The first is to relax the notion of what we consider to be “trivial”. For instance, as there is, for each d, a polynomial time algorithm deciding \(\mathsf {GI}\) among graphs with maximum degree d, we may take this as our trivial base case. We then parameterize G by the number k of vertices that must be deleted to obtain a subgraph of G with maximum degree d. This yields the parameter deletion distance to bounded degree, which we consider in Sect. 3 below. Alternatively, we relax the notion of “distance” so that rather than considering the sequential deletion of k vertices, we consider the recursive deletion of vertices in a tree-like fashion. To be precise, say that a graph G has elimination distance \(k+1\) from triviality if, in each connected component of G we can delete a vertex so that the resulting graph has distance k to triviality. If triviality is understood to mean the empty graph, this just yields a definition of the tree depth of G. In our main result, we combine these two approaches by parameterizing G by the elimination distance to triviality, where a graph is trivial if it has maximum degree d. We show that, for any fixed d, this gives a structural parameter on graphs for which graph canonisation is \(\mathsf {FPT}\). Along the way, in Sect. 4, we establish a number of characterisations of the parameter that may be interesting in themselves. In particular, we define the notion of an elimination order which is a partial order on the vertices indicating the order in which they need to be eliminated to reduce the degree to d.

It is easy to see that in a graph G that has elimination distance k to degree d, all vertices of sufficiently high degree have to be eliminated, but it may be the case that in an optimal elimination order some low-degree vertices may also need to be eliminated. A key idea in our proof is to show that G contains a canonically defined set of vertices C (which we call its torso), including the high-degree vertices so that if G has elimination distance k to degree d, then we can reduce the degree to d by eliminating just vertices in C, and moreover this yields an elimination order whose height is bounded by a function of k and d. This is established in Sect. 5. It should be noted that the parameter termed generalised tree depth in [2] can be seen as a special case of elimination distance to degree 2.

With this characterisation established, we are able to present the canonisation algorithm in Sect. 6. The central technique used here is inspired by Lindell’s tree canonisation algorithm [13]. We define an order \(\sqsubseteq \) on isomorphism types of coloured graphs equipped with an elimination order recursively on the height of this order, with the base case being a canonical order on coloured graphs of bounded degree. We then show that given a graph G, separated into its torso C and a low-degree part, we can construct an elimination order for G (i.e. a tree-depth decomposition of C) which is \(\sqsubseteq \)-minimal. We use the result of Bouland et al. [2] on canonisation of bounded tree-depth graphs to bound the branching in the search and establish that canonisation is FPT.

2 Preliminaries

2.1 Parameterized Complexity

Parameterized complexity theory is a two-dimensional approach to the study of the complexity of computational problems. A language (or problem) L is a set of strings \(L \subseteq \Sigma ^*\) over a finite alphabet \(\Sigma \). A parameterization is a computable function \(\kappa : \Sigma ^* \rightarrow \mathbb {N}\). We say that L is fixed-parameter tractable with respect to \(\kappa \) if we can decide whether an input \(x \in \Sigma ^*\) is in L in time \(O(f(\kappa (x)) \cdot |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 [4], Flum and Grohe [9] and Niedermeier [17]. We follow notation and terminology from [9].

2.2 Graphs

A graph G is a set of vertices V(G) and a set of edges \(E(G) \subseteq V(G) \times V(G)\). We will usually assume that graphs are loop-free and undirected, i.e. that E is irreflexive and symmetric. If E is not symmetric, we call G a directed graph. We mostly follow the notation in Diestel [3].

If \(v \in G\) and \(S \subseteq V(G)\), we write \(E_G(v, S)\) for the set of edges \(\{vw \mid w \in S\}\) between v and S.

The neighbourhood of a vertex v is \(N_G(v) := \{w \in V(G) \mid vw \in E(G)\}\). The degree of a vertex v is the size of its neighbourhood \(\deg _G(v) := |N_G(v)|\). For a set of vertices \(S \subseteq V(G)\) its neighbourhood is defined to be \(N_G(S) := \bigcup _{v \in S} N_G(v) {\setminus } S\). The degree of a graph G is the maximum degree of its vertices \(\Delta (G) := \max \{\deg _G(v) \mid v \in V(G)\}\). If it is clear from the context what the graph is, we may omit the subscript.

A subgraph H of G is a graph with vertices \(V(H) \subseteq V(G)\) and edges \(E(H) \subseteq (V(H) \times V(H)) \cap E(G)\). If \(A \subseteq V(G)\) is a set of vertices of G, we write G[A] for the subgraph induced by A, i.e. \(V(G[A]) = A\) and \(E(G[A]) = E(G) \cap (A \times A)\). If A is a subset of V(G), we write \(G {\setminus } A\) for \(G[V(G) {\setminus } A]\). For a vertex \(v \in V(G)\), we write \(G {\setminus } v\) for \(G {\setminus } \{v\}\).

A vertex v is said to be reachable from a vertex w in G if \(v=w\) or if there is a sequence of edges \(a_1a_2, \dots , a_{s-1}a_s\in E(V)\) with the \(a_i\) pairwise distinct and \(w=a_1\) and \(v=a_s\). We call the subgraph P of G with vertices \(V(P) = \{a_1, \dots , a_s\}\) and edges \(E(P) = \{a_1a_2, \dots , a_{s-1}a_s\}\) a path from w to v.

Let H be a subgraph of G and \(v, w \in V(G)\). A path through H from w to v is a path P from w to v in G with all vertices, except possibly the endpoints, in V(H), i.e. \((V(P) {\setminus } \{v, w\}) \subseteq V(H)\).

It is easy to see that for undirected graphs reachability defines an equivalence relation on the vertices of G. A subgraph of an undirected graph induced by a reachability class is called a component.

Two graphs G, \(G'\) are isomorphic if there is a bijection \(\varphi : V(G) \rightarrow V(G')\) such that for all \(v, w \in V(G)\) we have that \(vw \in E(G)\) if, and only if, \(\varphi (v)\varphi (w) \in E(G')\). We write \(G \cong G'\) if G and \(G'\) are isomorphic. We write \(\mathsf {GI}\) to denote the problem of deciding, given G and \(G'\) whether \(G\cong G'\).

A (k-)colouring of a graph G is a map \(c : V(G) \rightarrow \{1, \dots , k\}\) for some \(k \in \mathbb {N}\). We call a graph together with a colouring a coloured graph. Two coloured graphs \(G, G'\) with respective colourings \(c : V(G) \rightarrow \{1, \dots , k\}, c' : V(G') \rightarrow \{1, \dots , k\}\) are isomorphic if there is a bijection \(\varphi : V(G) \rightarrow V(G')\) such that:

  • for all \(v, w \in V(G)\) we have that \(vw \in E(G)\) if and only if \(\varphi (v)\varphi (w) \in E(G')\);

  • for all \(v \in V(G)\), we have that \(c(v) = c'(\varphi (v))\).

Note that we require the colour classes to match exactly, and do not allow a permutation of the colour classes.

Let \(\mathsf {C}\) be a class of (coloured) graphs closed under isomorphism. A canonical form for \(\mathsf {C}\) is a function \(F : \mathsf {C}\rightarrow \mathsf {C}\) such that

  • for all \(G \in \mathsf {C}\), we have that \(F(G) \cong G\);

  • for all \(G, H \in \mathsf {C}\), we have that \(G \cong H\) if, and only if, \(F(G) = F(H)\).

A canonical form F for a class \(\mathsf {C}\) gives rise to a natural pre-order on \(\mathsf {C}\), which we denote \(\sqsubseteq _F\) whereby \(G \sqsubseteq _F H\) just in case F(G) is lexicographically smaller than F(H). Then for any pair of graphs G and H in \(\mathsf {C}\), at least one of \(G \sqsubseteq _F H\) or \(H \sqsubseteq _F G\) must hold, and both hold if, and only if, \(G \cong H\).

2.3 Orders

Recall that a partial order is a binary relation \(\le \) on a set S which is reflexive, antisymmetric and transitive. We say a set \(T \subseteq S\) is a chain if it is totally ordered by \(\le \). If \(\le \) is a partial order on S, and for each element \(a \in S\), the set \(\{b \in S \mid b \le a\}\) is a chain, we say \(\le \) is a tree order. (Note that the covering relation of a tree order is not necessarily a tree, but may be a forest.)

Definition 2.1

An elimination order \(\le \) is a tree order on the vertices of a graph G, such that for each edge \(uv \in E(G)\) we have either \(u \le v\) or \(v \le u\).

We say that an order has height k if the length of the longest chain in it is k.

We write \(\mathop {td}(G)\) for the tree-depth of G, which is defined as follows

$$\begin{aligned} \mathop {td}(G) := {\left\{ \begin{array}{ll} 0, &{} \text {if }V(G) = \emptyset ; \\ 1 + \min \{\mathop {td}(G {\setminus } v) \mid v \in V(G)\}, &{} \text {if { G} is connected;} \\ \max \{\mathop {td}(H) \mid H \text { a component of { G}}\}, &{} \text {otherwise.} \end{array}\right. } \end{aligned}$$

Note that there is an elimination order \(\le \) of height k for a graph G if, and only if, \(\mathop {td}(G) \le k\).

2.4 Isomorphism on Bounded-Degree Graphs

Luks [15] shows that isomorphism of bounded-degree graphs is decidable in polynomial time. It is well-known that this result extends, by an easy reduction, to coloured graphs of bounded-degree. Though this reduction is folklore, for the sake of completeness, we present it here explicitly.

Proposition 2.2

The isomorphism problem for coloured graphs of degree d can be reduced to the isomorphism problem of graphs of degree \(d+2\) in polynomial time.

Proof

Let \(G, G'\) be graphs and let \(c, c' : V(G) \rightarrow \{1, \dots , k\}\) be colourings of \(G, G'\) respectively for some \(k \in \mathbb {N}\).

We define H to be the graph whose vertices include V(G) and, additionally, for each \(v \in V(G)\), \(c(v)+1\) new vertices \(u^v_1,\ldots ,u^v_{c(v)+1}\). The edges of H are the edges E(G) plus additional edges so that the vertices v and \(u^v_1,\ldots ,u^v_{c(v)+1}\) form a simple cycle of length \(c(v)+2\). We obtain \(H'\) in a similar way from \(G'\).

We claim that \(G \cong G'\) if, and only if, \(H \cong H'\). Clearly, if \(G \cong G'\) and \(\varphi \) is an isomorphism witnessing this, it can be extended to an isomorphism from H to \(H'\) by mapping \(u^v_i\) to \(u^{\varphi (v)}_i\). For the converse, suppose \(H \cong H'\) and let \(\varphi : H \rightarrow H'\) be an isomorphism. We use it to define an isomorphism \(\varphi '\) from G to \(G'\). Note that, if \(v \in V(G)\) is not an isolated vertex of G, then it has degree at least 3 in H. Since \(\varphi (v)\) has the same degree, it is in \(V(G')\), and we let \(\varphi '(v) = \varphi (v)\). If v is an isolated vertex of G, then its component in H is a simple cycle of length \(c(v)+2\). The image of this component under \(\varphi \) is a simple cycle of \(H'\) which must contain exactly one vertex \(v'\) of \(V(G')\). We let \(\varphi '(v)=v'\). It is easy to see that there is an edge between \(v_1,v_2\) in G if, and only if, there is an edge between \(\varphi '(v_1)\) and \(\varphi '(v_2)\) in \(G'\). To see that \(\varphi '\) also preserves colours, note that \(\varphi \) must map the cycle containing \(u^v_{c(v)}\) to the cycle containing \(u^{\varphi '(v)}_{c(\varphi '(v))}\) and therefore \(c(v) = c(\varphi '(v))\).

Note that if G and \(G'\) are graphs of degree d, then \(H, H'\) are graphs of degree \(d+2\).

As Luks [15] proves that isomorphism of bounded degree graphs can be decided in polynomial time, we have the following:

Theorem 2.3

We can test in polynomial time whether two (coloured) graphs with maximal degree bounded by a constant are isomorphic.

Babai and Luks [1] give a polynomial time canonisation algorithm for bounded degree graphs. Just as above we can reduce canonisation of coloured bounded degree graphs to the bounded degree graph canonisation problem.

Theorem 2.4

Let \(\mathsf {C}\) be a class of (coloured) bounded degree graphs closed under isomorphism. Then there is a canonical form F for \(\mathsf {C}\) that allows us to compute F(G) in polynomial time.

3 Deletion Distance to Bounded Degree

We first study the notion of deletion distance to bounded degree and establish in this section that graph isomorphism is FPT with this parameter. Though the result in this section is subsumed by the more general one in Sect. 6 and also by a result of Kratsch and Schweitzer [12], it provides a useful warm-up and a tighter bound, exponential in the parameter. In the present warm-up we only give an algorithm for the graph isomorphism problem, though the result easily holds for canonisation as well (and this follows from the more general result in Sect. 6). The notion of deletion distance to bounded degree is a particular instance of the general notion of distance to triviality introduced by Guo et al. [11]. In the context of graph isomorphism, we have chosen triviality to mean graphs of degree at most d.

Definition 3.1

A graph G has deletion distance k to degree d if there are k vertices \(v_1, \dots , v_k \in V(G)\) such that \(G {\setminus } \{v_1, \dots , v_k\}\) has degree d. We call the set \(\{v_1, \dots , v_k\}\) a d -deletion set.

Remark

To say that G has deletion distance 0 from degree d is just to say that G has maximum degree d. Also note that if \(d=0\), then a d-deletion set is just a vertex cover and the minimum deletion distance the vertex cover number of G.

We show that isomorphism is fixed-parameter tractable on such graphs parameterized by k with fixed degree d; in particular we give a procedure that computes in linear time a set U of vertices of size polynomial in k so that any deletion set must be found in U if one exists. This then allows for exhaustive search over all potential isomorphisms. We call U a bounding set for the deletion set. The construction is reminiscent of a kernelization result in [6] for the problem of determining whether a graph has deletion distance k to degree d, though that does not yield a bounding set containing all deletion sets.

Theorem 3.2

For any graph G and integers \(d,k > 0\), we can identify in linear time a subgraph \(G'\) of G, a set of vertices \(U \subseteq V(G')\) with \(|U| = O(k(k+d)^2)\) and a \(k' \le k\) such that: G has deletion distance k to degree d if and only if \(G'\) has deletion distance \(k'\) to d and, moreover, if \(G'\) has deletion distance at most \(k'\), then any minimum size d-deletion set for \(G'\) is contained in U.

Proof

Let \(A := \{v \in V(G) \mid \deg (v) > k + d\}\). Now, if R is a minimum size d-deletion set for G and G has deletion distance at most k to degree d, then \(|R| \le k\) and the vertices in \(V(G {\setminus } R)\) have degree at most \(k + d\) in G. So \(A \subseteq R\). This means that if \(|A| > k\), then G must have deletion distance greater than k to degree d and in that case we let \(G' := G, k' := k\) and \(U = \emptyset \).

Otherwise let \(G' := G {\setminus } A\) and \(k' := k - |A|\). We have shown that every d-deletion set of size at most k must contain A. Thus G has deletion distance k to degree d if, and only if, \(G'\) has deletion distance \(k'\) to degree d.

Let \(S := \{v \in V(G') \mid \deg _{G'}(v) > d\}\) and \(U := S \cup N_{G'}(S)\). Let \(R' \subseteq V(G')\) be a minimum size d-deletion set for \(G'\). We show that \(R' \subseteq U\). Let \(v \not \in U\). Then by the definition of U we know that \(\deg _{G'}(v) \le d\) and all of the neighbours of v have degree at most d in \(G'\). So if \(v \in R'\), then \(G {\setminus } (R' \setminus \{v\})\) also has maximal degree d, which contradicts the assumption that \(R'\) is of minimum size. Thus \(v \not \in R'\).

Note that the vertices in \(G' {\setminus } (R' \cup N(R'))\) have the same degree in \(G'\) as in G and thus all have degree at most d. So \(S \subseteq R' \cup N(R')\) and thus \(|U| \le k' + k'(k+d) + k'(k+d)^2 = O(k(k+d)^2)\).

Finally, the sets A and U defined as above can be found in linear time, and \(G', k'\) can be computed from A in linear time.

Remark

It may be noted that the set U is canonical in the sense that if there is an isomorphism from G to a graph H, this must take U to the corresponding set in H. But, this is not essential to our argument below. What is important is that U contains all possible deletion sets for G. In particular, if \(U = \emptyset \) and \(k' > 0\), then there are no d-deletion sets of size at most \(k'\).

Next we see how the bounding set U can be used to determine whether two graphs with deletion distance k to degree d are isomorphic by reducing the problem to isomorphism of coloured graphs of degree at most d.

Suppose we are given two graphs G and H with d-deletion sets \(S = \{v_1, \dots , v_k\}\) and \(T = \{w_1, \dots , w_k\}\) respectively. Further suppose that the map \(v_i \mapsto w_i\) is an isomorphism on the induced subgraphs G[S] and H[T]. We can then test if this map can be extended to an isomorphism from G to H using Theorem 2.4. To be precise, we define the coloured graphs \(G'\) and \(H'\) which are obtained from \(G{\setminus } S\) and \(H{\setminus } T\) respectively, by colouring vertices. A vertex \(u \in V(G')\) gets the colour \(\{i \mid v_i \in N_G(u)\}\), i.e. the set of indices of its neighbours in S. Vertices in \(H'\) are similarly coloured by the sets of indices of their neighbours in T. It is clear that \(G'\) and \(H'\) are isomorphic if, and only if, there is an isomorphism between G and H, extending the fixed map between S and T. The coloured graphs \(G'\) and \(H'\) have degree bounded by d, so Theorem 2.4 gives us a polynomial-time isomorphism test on these graphs.

Now, given a pair of graphs G and H which have deletion distance k to degree d, let A and B be the sets of vertices of degree greater than \(k+d\) in the two graphs respectively. Also, let U and V be the two bounding sets in the graphs obtained from Theorem 3.2. Thus, any d-deletion set in G contains A and is contained in \(A \cup U\) and similarly, any d-deletion set for H contains B and is contained in \(B \cup V\). Therefore to test G and H for isomorphism, it suffices to consider all k-element subsets S of \(A \cup U\) containing A and all k-element subsets T of \(B\cup V\) containing B, and if they are d-deletion sets for G and H, check for all k! maps between them whether the map can be extended to an isomorphism from G to H. As d is constant this takes time \(O^*\left( {{k^3}\atopwithdelims (){k}}^2 \cdot k!\right) \), which is \(O^*\left( 2^{7k\log k}\right) \).

4 Elimination Distance to Bounded Degree

In this section we introduce a new structural parameter for graphs. We generalise the idea of deletion distance to triviality by recursively allowing deletions from each component of the graph. This generalises the idea of elimination height or tree-depth, and is equivalent to it when the notion of triviality is the empty graph. In the context of graph isomorphism and canonisation we again define triviality to mean bounded degree, so we look at the elimination distance to bounded degree.

Definition 4.1

The elimination distance to degree d of a graph G is defined as follows:

$$\begin{aligned} \textstyle {{ed}_d(G)} := {\left\{ \begin{array}{ll} 0, &{} \text {if }\Delta (G) \le d; \\ 1 + \min \{{ed}_d(G {\setminus } v) \mid v \in V(G)\}, &{} \text {if} \Delta (G) > d \quad \text {and} \quad G \quad \text {is connected;} \\ \max \{{ed}_d(H) \mid H \text { a connected component of} \quad G\}, &{} \text {otherwise.} \end{array}\right. } \end{aligned}$$

We first introduce other equivalent characterisations of this parameter. If G is a graph that has elimination distance k to degree d, then we can associate a certain tree order \(\le \) with it as defined below. The idea is that if G is a connected graph we can choose a vertex v so that deleting it strictly reduces the elimination distance to degree d. We make \(v \le u\) for all vertices u and vertices in distinct components of \(G{\setminus } v\) are made incomparable with respect to \(\le \). We proceed in this fashion until we have components with degree at most d and all vertices in these are incomparable (and indeed \({\le }\)-maximal). If C is such a degree d component, then the vertices of \(G {\setminus } C\) that are neighbours of vertices in C must be linearly ordered by \(\le \) and they all precede the vertices of C in the order \(\le \). Thus, if we associate with every vertex v, the set \(S_v\) of neighbours of v that are \(\le \)-incomparable with v we can note the following: \(S_v\) has at most d elements for any v; if \(S_v\) is not empty, then v must be \({\le }\)-maximal; and if \(u \in S_v\) then u and v must have the same \(\le \)-predecessors. This can be taken as the defining property of an elimination order to degree d, as below.

Definition 4.2

A tree order \(\le \) on V(G) is an elimination order to degree d for G if for each \(v \in V(G)\) the set

$$\begin{aligned} S_v := \{u \in V(G) \mid uv \in E(G) \text { and } u \not \le v \text { and } v \not \le u\} \end{aligned}$$

satisfies either:

  • \(S_v = \emptyset \); or

  • v is \({\le }\)-maximal, \(|S_v| \le d\), and for all \(u \in S_v\), we have \(\{w \mid w < u\} = \{w \mid w < v\}\).

Remark

Note that if \(S_v = \emptyset \) for all \(v \in V(G)\), then an elimination order to degree d is just an elimination order, in the sense of Definition 2.1.

Proposition 4.3

A graph G has \({ed}_d(G) \le k\) if, and only if, there is an elimination order to degree d of height k for G.

Proof

Suppose first that \({ed}_d(G) \le k\). We proceed by induction on k. If \(k = 0\), then G has no vertex of degree larger than d and we define the elimination order \(\le \) to be the identity relation on V(G). Then every \(v \in V(G)\) is maximal, we have \(|S_v| \le d\), and for all \(u \in S_v\) we have \(\{w \mid w < u\} = \emptyset = \{w \mid w < v\}\).

Suppose \(k>0\) and the statement is true for smaller values. If G is not connected, we apply the following argument to each component. So in the following we assume that G is connected. Thus, there is a vertex \(a \in V(G)\) such that the components \(C_1, \dots , C_r\) of \(G {\setminus } a\) all have \({ed}_d(C_i) \le k-1\). So by the induction hypothesis each \(C_i\) has a tree order \(\le _i\) to degree d of height at most \(k-1\) with the properties in Definition 4.2. For each \(v \in V(C_i)\) define

$$\begin{aligned} S_v^i := \{u \in V(C_i) \mid uv \in E(G) \text { and } u \not \le _i v \text { and } v \not \le _i u\}. \end{aligned}$$

Let

$$\begin{aligned} {\le } := \{(a, w) \mid w \in V(G)\} \cup \bigcup _i \le _i. \end{aligned}$$

Then \(\le \) is clearly a tree order for G. Note that \(S_a = \emptyset \). Let \(v \in V(G) {\setminus } a\) be a vertex different from a, say \(v \in V(C_i)\). Note \(S_v^i = S_v\). If \(S_v \ne \emptyset \), then v is \({\le _i}\)-maximal, and thus also \({\le }\)-maximal. Moreover, \(|S_v^i| = |S_v| \le d\). Lastly for any \(u \in S_v\):

$$\begin{aligned} \{w \mid w < u\} = \{a\} \cup \{w \mid w <_i u\} = \{a\} \cup \{w \mid w <_i v\} = \{w \mid w < v\}. \end{aligned}$$

Conversely assume there is an elimination order \(\le \) to degree d of height k for G. We again proceed by induction on k. If \(k=0\), then \(\le \) is empty and all vertices v in G are \(\le \)-maximal. Thus, \(S_v\) contains all neighbours of v and therefore v has at most d neighbours. In other words, \(\Delta (G) \le d\) as required.

Now, suppose \(k > 0\). If v is an \(\le \)-minimal element then for any u for which there is a path from v to u, we must have \(v \le u\). Thus, if G is connected, there is a unique \(\le \)-minimal element v. Note that \(\le \) restricted to a component C of \(G {\setminus } v\) has height \(k-1\) and thus by the induction hypothesis we have that \({ed}_d(C) \le k-1\). If G is not connected, this argument can be applied to each component of G.

We can split a graph with an elimination order to degree d in two parts: one of low degree, and one with an elimination order defined on it. So if G is a graph that has elimination distance k to degree d, we can associate an elimination order \(\le \) for a subgraph H of G of height k with G, so that each component of \(G {\setminus } V(H)\) has degree at most d and is connected to H along just one branch (this is defined more formally below).

Proposition 4.4

Let G be a graph and \(\le \) an elimination order to degree d for G of height k. If A is the set of vertices in V(G) that are not \(\le \)-maximal, then:

  1. 1.

    \(\le \) restricted to A is an elimination order of height \(k-1\) of G[A]; and

  2. 2.

    \(G {\setminus } A\) has degree at most d;

  3. 3.

    if C is the vertex set of a component of \(G {\setminus } A\), and \(u, v \in A\) are \(\le \)-incomparable, then either \(E(u, C) = \emptyset \) or \(E(v, C) = \emptyset \).

Proof

As any \(v\in A\) is non-maximal, by Definition 4.2, \(S_v = \emptyset \). Hence if there is an edge between \(u,v \in A\), either \(u < v\) or \(v< u\), and (1) follows.

Since \(G{\setminus } A\) contains the \(\le \)-maximal elements, they are all incomparable. By definition of an elimination order to degree d, this means that each vertex in \(G{\setminus } A\) has at most d neighbours in \(G{\setminus } A\), so this graph has degree at most d, establishing (2).

To show (3), let C be the vertex set of a component of \(G {\setminus } A\) and let \(u, v \in A\) be such that \(E(u, C) \ne \emptyset \) and \(E(v, C) \ne \emptyset \). Then there are \(a, b \in C\) such that \(au, bv \in E(G)\). By Definition 4.2, \(u<a\) and \(v<b\). Moreover, there is a path from a to b through C and as all vertices along this path are \(\le \)-maximal, if \((a',b')\) is an edge in the path, it must be that \(\{w \mid w < a'\} = \{w \mid w < b'\}\). By transitivity, \(\{w \mid w < a\} = \{w \mid w < b\}\), and so \(u < b\) and \(v < a\). Since \(\le \) is a tree-order, the set \(\{w \mid w < a\}\) is linearly ordered and we conclude that u and v are comparable.

We also have a converse to the above in the following sense.

Proposition 4.5

Suppose G is a graph with \(A \subseteq V(G)\) a set of vertices and \(\le _A\) an elimination order of G[A] of height k, such that:

  1. 1.

    \(G {\setminus } A\) has degree at most d;

  2. 2.

    if C is the vertex set of a component of \(G {\setminus } A\), and \(u, v \in A\) are incomparable, then either \(E(u, C) = \emptyset \) or \(E(v, C) = \emptyset \).

Then, \(\le _A\) can be extended to an elimination order to degree d for G of height \(k+1\).

Proof

Let

$$\begin{aligned} {\le } :=&{\le _A} \cup \{(v, v) \mid v \in (V(G) {\setminus } A)\} \\&\cup \{(u, v) \mid u \in A, v \in C, C\quad \text {a component of} G {\setminus } A, E(w, C)\ne \emptyset \quad \text { for some } u \le w\}. \end{aligned}$$

Then it is easily seen that \(\le \) is a tree order on G. Indeed, \(\le _A\) is, by assumption, a tree order on A and for any \(v \in V(G){\setminus } A\), assumption 2 guarantees that \(\{w \mid w \le v\}\) is linearly ordered.

Let \(v \in V(G)\) and let \(S_v\) be as in Definition 4.2. Suppose \(S_v \ne \emptyset \). Then \(v \in (V(G) {\setminus } A)\) and has degree at most d in \(G {\setminus } A\). By the construction v is \(\le \)-maximal. Let \(u \in S_v\). Then there is a component C of \(G {\setminus } A\) that contains both u and v and thus \(\{w \mid w < u\} = \{w \mid w < v\}\).

Remark

In the following, given a graph G and an elimination order \(\le \) to degree d we call the subgraph of V(G) induced by the non-maximal elements of the order \(\le \) the non-maximal subgraph of G under \(\le \).

In the proof of Proposition 4.5 above, a suitable tree order on a subset A of V(G) is extended to an elimination order to degree d of G by making all vertices not in A maximal in the order. This is a form of construction we use repeatedly below.

The alternative characterisations of elimination order to degree d established above are very useful. In the next sections, we use them to construct a canonical elimination order to degree d of G, based on an elimination order of a graph we call the torso of G, which consists of the high-degree vertices of G, along with some additional edges.

5 Separation into High and Low Degree Parts

The aim of this section is to show that if a graph G has elimination distance k to degree d, then there is an elimination order to degree d whose height is still bounded by a function of d and k and in which the set of non-maximal elements is canonical. To be precise, we identify a graph which we call the d-degree torso of G, which contains all the vertices of G of degree more than d and has additional edges to represent paths between these vertices that go through the rest of G. We show that this torso necessarily has tree-depth bounded by a function of k and d and an elimination order witnessing this can be extended to an elimination order to degree d of G. The result is established through a series of lemmas. A pattern of construction that is repeatedly used here is that we define a certain set A of vertices of G and construct an elimination order of G[A]. It is then shown that extending the order by making all vertices in \(V(G){\setminus } A\) maximal yields an elimination order to degree d of G. Necessarily, in this extended order, all the non-maximal elements are in A.

We first do this for graphs of degree bounded by \(k+d\). To be precise, the following lemma establishes that if G has elimination distance k to degree d and moreover the degree of G is at most \(k+d\), then we can construct an alternative elimination order to degree d on G in which all the vertices of degree greater than d are included in the non-maximal subgraph and the height of the new elimination order to degree d is still bounded by a function of k and d.

Lemma 5.1

Let G be a graph with maximal degree \(\Delta (G) \le k+d\). Let \(\le \) be an elimination order to degree d of height k of G with non-maximal subgraph H, and let \(A = V(H) \cup \{v \in V(G) \mid \deg _G(v) > d\}\). Then G has an elimination order \(\sqsubseteq \) to degree d of height at most \(k(k+d+1)\) for which A is the set of non-maximal elements.

Proof

Let GHA and \(\le \) be as in the statement of the lemma. We will adapt \(\le \) to an elimination order \(\sqsubseteq \) of G[A].

For each \(w \in A {\setminus } V(H)\) let \(C_w\) be the component of \(G {\setminus } V(H)\) that contains w. Note that \(N(C_w) \ne \emptyset \), because \(\deg (w) > d\), so at least one vertex in H must be adjacent to w. By Definition 4.2, the vertices in \(N(C_w)\) are linearly ordered by \(\le \). We write b(w) to denote the unique \(\le \)-maximal element of \(N(C_w)\) for each \(w \in A {\setminus } V(H)\). For each \(b \in V(H)\), let \(W_b := \{w \in A {\setminus } V(H) \mid b(w) = b\}\), and let \(\sqsubseteq _b\) be an arbitrary linear order on \(W_b\).

For any \(u, v \in V(G)\), define \(u \sqsubseteq v\) if one of the following holds:

  • \(u = v\);

  • \(u, v \in H\) and \(u \le v\);

  • \(u \in H\), \(v \in G {\setminus } A\) and \(u \le v\);

  • \(u \in H\), \(v \in A{\setminus } V(H)\) and \(u \le b(v)\);

  • \(u \in A {\setminus } V(H)\), \(v \in G {\setminus } A\) and \(b(u) \le v\);

  • \(u, v \in A{\setminus } V(H)\), \(b(u)= b(v)\) and \(u \sqsubseteq _b v\).

It follows from the construction that \(\sqsubseteq \) restricted to A is an elimination order of G[A], and that \(\sqsubseteq \) is an elimination order to degree d of G.

For each \(b \in V(H)\), the set \(\{v \in H \mid v \le b\}\) has at most k elements, by the assumption on the height of the order \(\le \). Since G has maximum degree \(k+d\) and \(W_b \subseteq N(\{v \in H \mid v \le b\})\), we have that \(W_b\) has at most \(k(k+d)\) vertices. Since the height of any \(\sqsubseteq \) chain is at most the height of a \(\le \)-chain plus \(|W_b|\), we conclude that the height of \(\sqsubseteq \) is at most \(k(k+d+1)\).

The lemma above allows us to re-arrange the elimination order so that it includes all vertices of large degree. In contrast, the next lemma gives us a means to re-arrange the elimination order so that all vertices of small degree are made maximal in the order. This is again achieved while keeping the height of the elimination order bounded by a function of k and d.

Lemma 5.2

Let G be a graph. Let \(\le \) be an elimination order to degree d of G of height k with non-maximal subgraph H, such that H contains all vertices of degree greater than d, and let \(A = \{v \in V(H) \mid \deg _G(v) > d\}\). Then, there is an elimination order to degree d of G of height at most \(k((k+1)d)^{2^k}+1\) for which A is the set of non-maximal elements.

Proof

Let GHA and \(\le \) be as in the statement of the lemma. We assume that G is connected—if not, we can apply the argument to each component of G. We construct an elimination order \(\sqsubseteq \) of G[A] from \(\le \), making sure that it has height at most \(k((k+1)d)^{2^k}\), and satisfying the conditions of Proposition 4.5. This then extends to an elimination order to degree d of G by making all vertices not in A maximal, as in that Proposition.

Let \(J := H {\setminus } A\). For \(v \in V(J)\), let \(K_v\) be the set of vertices \(w \in A\) such that:

  1. 1.

    \(v \le w\);

  2. 2.

    there is a path from v to w through \(G {\setminus } A\); and

  3. 3.

    for any u with \(u < v\), there is no path from u to w through \(G {\setminus } A\).

Note that because \(\le \) is a tree order and due to the third condition, the sets \(K_v\) are pairwise disjoint. Let \(\overline{K} := A {\setminus } (\bigcup _{v \in V(J)} K_v)\) be the set of vertices in A that are not contained in \(K_v\) for any v.

For each \(v \in V(J)\), let \(\sqsubseteq _v\) be an arbitrary linear order on \(K_v\). The idea behind the construction below is that we replace v in the elimination order by \(K_v\), ordered by \(\sqsubseteq _v\). Formally, for any \(u, w \in V(G)\), define \(u \sqsubseteq w\) if one of the following holds:

  • \(u = w\);

  • \(u \in K_v\), \(w \in G {\setminus } A\) and \(v \le w\);

  • \(u \in \overline{K}\), \(w \in G {\setminus } A\) and \(u \le w\);

  • \(u, w \in K_v\) and \(u \sqsubseteq _v w\);

  • \(u \in K_v\), \(w \in K_{v'}\) and \(v < v'\);

  • \(u \in \overline{K}\), \(w \in K_v\) and \(u \le v\);

  • \(u \in K_v\), \(w \in \overline{K}\) and \(v \le w\);

  • \(u, w \in \overline{K}\) and \(u \le w\).

We first show that \(\sqsubseteq \) is an elimination order for G[A]. The construction ensures \(\sqsubseteq \) is a tree order. Let \(u, w \in A\). We show that if \(u \le w\), then either \(u \sqsubseteq w\) or \(w \sqsubseteq u\). We go through all possible cases: If \(u = w\), we have \(u \sqsubseteq w\). If there is some \(v \in V(J)\) such that \(u, w \in K_v\), then \(u \sqsubseteq w\) or \(w \sqsubseteq u\). Suppose \(u \in K_v\), \(w \in K_{v'}\) for \(v, v' \in V(J)\). By definition of \(K_v\), \(v \le u\) and similarly \(v' \le w\). Since we also have \(u \le w\), by the tree order property either \(v \le v'\) or \(v' \le v\) and thus \(u \sqsubseteq w\) or \(w \sqsubseteq u\). If \(u \in \overline{K}\) and \(w \in K_v\), then both \(u, v \le w\), so either \(u \le v\) or \(v \le u\), and thus either \(u \sqsubseteq w\) or \(w \sqsubseteq u\). The case where \(u \in K_v\), \(w \in \overline{K}\) is symmetric. Finally, if both \(u, w \in \overline{K}\), then \(u \sqsubseteq w\). Thus if \(uw \in E(G)\), we have \(u \le w\) or \(w \le u\) and therefore \(u \sqsubseteq w\) or \(w \sqsubseteq u\). Hence \(\sqsubseteq \) is an elimination order for G[A].

Let Z be a component of \(G {\setminus } A\). By assumption H contains all vertices of degree greater than d, and hence A also contains all those vertices. Thus Z has maximum degree d.

Suppose \(u, v \in A\) are two vertices that are connected to Z, i.e. \(E_G(u, V(Z)) \ne \emptyset \ne E_G(v, V(Z))\). We show that either \(u \sqsubseteq v\) or \(v \sqsubseteq u\). Note that there is a path P through \(Z \subseteq G {\setminus } A\) from u to v, i.e. all vertices in P, except for the endpoints, lie outside of A. If P contains no vertices from J, then the connected component \(Z'\) of \(G {\setminus } V(H)\) containing \(P {\setminus } \{u,v\}\) satisfies \(E_G(u, V(Z')) \ne \emptyset \ne E_G(v, V(Z'))\) and thus \(u \le v\) or \(v \le u\), and therefore by the above \(u \sqsubseteq v\) or \(v \sqsubseteq u\).

Otherwise, P contains vertices from J. Let w be a \(\le \)-minimal vertex in \(V(P) \cap V(J)\). Then there is a path outside of A from w to u, and also to v (both part of P). Moreover, if neither \(u \le v\) nor \(v \le u\), then \(w \le u\) and \(w \le v\). Thus u and v are in \(K_w\) (or in \(K_{w'}\) for some \(w' < w\)), and therefore \(u \sqsubseteq v\) or \(v \sqsubseteq u\).

It remains to show that the size of \(K_v\) is bounded by \(k((k+1)d)^{2^k}\) for all \(v \in V(J)\). Let \(G'\) be the graph obtained from G by adding an edge between two vertices \(s,t \in V(J)\) whenever there is a path through \(G {\setminus } V(H)\) between s and t. This increases the degree of vertices in V(J) by at most kd, because each of these vertices is connected to at most d components of \(G {\setminus } V(H)\) and each of these is connected to at most k vertices in H. Now there is a path between two vertices \(s,t \in J\) in G outside of A if and only if there is a path between s and t in \(G'[V(J)]\). Moreover, \(\le \) is also an elimination order for \(G'[V(J)]\). So, as \(G'[V(J)]\) has tree-depth at most k it does not contain a path of length more than \(2^k\). Since each vertex on the path has degree at most \((k+1)d\), we can reach at most \(((k+1)d)^{2^k}\) vertices in A on paths only containing vertices outside of A. Thus \(|K_v| \le ((k+1)d)^{2^k}\) and the height of \(\sqsubseteq \) is bounded by \(k|K_v| \le k((k+1)d)^{2^k}\).

Next we introduce the notion of d-degree torso and prove that it captures the properties that we require of an elimination tree to degree d.

Definition 5.3

Let G be a graph, let \(d > 0\) and let H be the subgraph of G induced by the vertices of degree larger than d. The d-degree torso of G is the graph obtained from H by adding an edge between two vertices \(u,v \in H\) if there is a path through \(G {\setminus } V(H)\) from u to v in G.

Lemma 5.4

Let G be a graph and let C be the d-degree torso of G. Let \(H = G[V(C)]\) and let \({\le }\) be an elimination order for H. Then \({\le }\) is an elimination order for C of height h if, and only if, \({\le }\) can be extended to an elimination order to degree d for G of height \(h+1\).

Proof

Let GCH and \(\le \) be as above.

Suppose \(\le \) is an elimination order for C. Since C is a supergraph of H, this means that \(\le \) is an elimination order for H. Let Z be a component of \(G {\setminus } V(H)\). Since C contains all vertices of degree greater than d, Z has maximal degree d. If \(E(Z, u) \ne \emptyset \) and \(E(Z, v) \ne \emptyset \) for two vertices \(u, v \in H\), then there is a path through \(Z \subseteq G {\setminus } V(H)\) connecting u and v, so by the definition of the d-degree torso \(uv \in E(C)\) and thus uv are \(\le \)-comparable. We can extend \(\le \) to a tree order \(\le '\) on V(G) where all the vertices from \(V(G) {\setminus } V(H)\) are maximal.

Conversely assume that \(\le \) can be extended to an elimination order to degree d for G. Let \(uv \in E(C)\). If \(uv \in E(H)\), then u and v must be \(\le \)-comparable. Otherwise \(uv \not \in E(H)\), so there is a path through \(G {\setminus } V(H)\) from u to v in G, i.e. both u and v are connected to a component Z of \(G {\setminus } V(H)\) and thus comparable. Therefore \(\le \) is an elimination order for C.

The next lemma establishes an upper bound on the tree-depth of the torso of a graph when the maximum degree is bounded.

Lemma 5.5

Let G be a graph with elimination distance k to degree d and maximum degree \(\Delta (G) \le k + d\). Let C be the d-degree torso of G and let \(\le \) be a minimum height elimination order for C. Then \(\le \) has height at most \(k(k+d+1)((k(k+d+1)+1)d)^{2^{k(k+d+1)}}\).

Proof

Let \(\sqsubseteq \) be a minimum height elimination order to degree d of G. Since G has elimination distance to degree d at most k, the height of \(\sqsubseteq \) is at most k. Let H be the non-maximal subgraph of G under \(\sqsubseteq \) and define

$$\begin{aligned} A = V(H) \cup \{v \in V(G) \mid \deg _G(v) > d\}. \end{aligned}$$

By Lemma 5.1, the graph G[A] has an elimination order \(\preceq \) of height at most \(k(k+d+1)\) that can be extended to an elimination order to degree d for G.

Let \(A' = \{v \in A \mid \deg _G(v) > d\}\). By Lemma 5.2, the graph \(A'\) has an elimination order \(\le \) of height at most \(k(k+d+1)((k(k+d+1)+1)d)^{2^{k(k+d+1)}}\) that can be extended to an elimination order to degree d for G.

Lastly note that \(A' = V(C)\), so that by Lemma 5.4, \(\le \) is an elimination order for C.

We are now ready to prove the main result:

Theorem 5.6

Let G be a graph that has elimination distance k to degree d. Let \(\le \) be a minimum height elimination order of the d-degree torso G. Then \(\le \) can be extended to an elimination order to degree d of G of height at most

$$\begin{aligned} k((k+1)(k+d))^{2^{k}} + k(1+k+d)(k(1+k+2d))^{2^{k(1+k+d)}}+1. \end{aligned}$$

Proof

We show that the d-degree torso of G has an elimination order of height at most \( k((k+1)(k+d))^{2^{k}} + k(1+k+d)(k(1+k+2d))^{2^{k(1+k+d)}}\). The theorem then follows by Lemma 5.4.

Let C be the \((k+d)\)-degree torso of G. We first show that the tree-depth of C is bounded by \(k((k+1)(k+d))^{2^k}\). To see this, let \(\sqsubseteq \) be an elimination order to degree d of G of minimum height with non-maximal subgraph H. Note that H contains all vertices of degree greater than \(k+d\), because vertices in \(G {\setminus } V(H)\) are adjacent to at most k vertices in H.

Let \(A = \{v \in V(H) \mid \deg _G(v) > k+d\}\). By Lemma 5.2, the graph G[A] has an elimination order \(\preceq \) of depth at most \(h:= k((k+1)(k+d))^{2^k}\) that can be extended to an elimination order to degree \(k+d\) of G of height \(h+1\). Note that \(A = V(C)\), so by Lemma 5.4, the order \(\preceq \) is an elimination order for C. Let \(\preceq '\) denote its extension to G.

Let Z be a component of \(G {\setminus } A\) and let \(C_Z\) be the d-degree torso of Z. By Lemma 5.5, there is an elimination order \(\preceq _Z\) for \(C_Z\) of height at most \(k(k+d+1)((k(k+d+1)+1)d)^{2^{k(k+d+1)}}\). Let \(v_Z\) be the \(\preceq \)-maximal element in C such that there is a \(w \in C_Z\) with \(v_Z \preceq ' w\). Define

$$\begin{aligned} \le ' :=&\preceq \cup \bigcup _Z \preceq _Z \cup \bigcup _Z \{(v,w) \mid v \preceq ' v_Z, w \in C_Z \}. \end{aligned}$$

Observe that \(C \cup \bigcup _{Z} C_Z\) has as a subgraph the d-degree torso of G. Thus \(\le '\) is an elimination order for the d-degree torso of G. The height of \(\le '\) is bounded by

$$\begin{aligned} \mathop {td}(C) + \max \{\mathop {td}(C_Z)\}_Z&\le k((k+1)(k+d))^{2^{k}}\\&\quad + k(1+k+d)(k(1+k+2d))^{2^{k(1+k+d)}}. \end{aligned}$$

\(\square \)

6 Canonisation Parameterized by Elimination Distance to Bounded Degree

In this section we show that graph canonisation, and thus graph isomorphism, is \(\mathsf {FPT}\) parameterized by elimination distance to bounded degree. The algorithm is based on Lindell’s algorithm [13] that decides isomorphism of trees by establishing an ordering on them. We extend a version of this algorithm used by Bouland et al. [2] to decide isomorphism on graphs of bounded tree-depth.

The central idea is to define a pre-order \(\sqsubseteq \) on graphs \((G,{\le })\) equipped with an elimination order to degree d, with the property that \((G,{\le }) \sqsubseteq (G',{\le '})\) and \((G',{\le }) \sqsubseteq (G,{\le '})\) if, and only if, \((G,{\le })\) is isomorphic to \((G',{\le '})\). We then exhibit an algorithm that constructs, given a graph G, the elimination order to degree d on G that makes \((G,{\le })\) \(\sqsubseteq \)-minimal. This serves as a canonical representative of G. Before defining \(\sqsubseteq \) formally, we need some additional terminology.

Definition 6.1

Let G be a graph and let \(\le \) be a tree order for G. The level of a vertex \(v \in V(G)\) is the length of the chain \(\{w \in V(G) \mid w \le v\}\). We denote the level of v by \( level _<(v)\).

Definition 6.2

Let G be a graph. We denote the number of connected components of G by \(\#G\).

The definition of \(\sqsubseteq \) is by induction on the height of the order \(\le \). Inductively, we need to consider coloured graphs and so formally, \(\sqsubseteq _k\) is a pre-order on triples \((G,\chi ,{\le })\) where \(\chi : V(G) \rightarrow X\) is a colouring of G and \(\le \) is an elimination order to degree d of G. We always assume that the set of colours X is an initial segment of the natural numbers and so, in particular, linearly ordered.

Definition 6.3

For a graph G, with a colouring \(\chi : V(G) \rightarrow X\) and a vertex \(v \in V(G)\), we write \(\chi _v\) for the colouring of \(G{\setminus } v\) given by \(\chi _v: V(G{\setminus } v) \rightarrow X \times \{0,1\}\) where \(\chi _v(u) = (\chi (u),1)\) if \((u,v) \in E(G)\) and \(\chi _v(u) = (\chi (u),0)\) if \((u,v) \not \in E(G)\).

By Theorem 2.4 we can find a canonical form of each coloured graph Z of degree at most d in polynomial time, and thus a pre-order \(\sqsubseteq _0\) such that for every pair of \(Z,Z'\) of such graphs, either \(Z \sqsubseteq _0 Z'\) or \(Z' \sqsubseteq _0 Z\) and \(Z \cong Z'\) if, and only if, both \(Z \sqsubseteq _0 Z'\) and \(Z' \sqsubseteq _0 Z\).

In the following definition we extend this to a pre-order \(\sqsubseteq \) on coloured graphs with an elimination order to degree d by induction on the height of the order.

Definition 6.4

Let \(G, G'\) be graphs with colourings \(\chi \) and \(\chi '\) and respective elimination orders \(\le , \le '\) to degree d. We say that \((G, \chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) if one of the following holds:

  1. 1.

    \(\mathrm {height}(\le ) < \mathrm {height}(\le ')\);

  2. 2.

    \(\mathrm {height}(\le ) = \mathrm {height}(\le ') = 0\) and \((G, \chi ) \sqsubseteq _0 (G', \chi ')\);

  3. 3.

    \(\mathrm {height}(\le ) = \mathrm {height}(\le ') > 0\) and \(\#G < \#{G'}\);

  4. 4.

    \(\mathrm {height}(\le ) = \mathrm {height}(\le ') > 0\), \(\#G = \#{G'} = 1\) and \(\chi (v) < \chi '(v')\) where \(v, v'\) are minimal elements of \(G, G'\) with respect to \({\le }, {\le '}\) respectively;

  5. 5.

    \(\mathrm {height}(\le ) = \mathrm {height}(\le ') > 0\), \(\#G = \#{G'} = 1\) and

    $$\begin{aligned} (G {\setminus } v,\chi _v, {\le }) \sqsubseteq (G' {\setminus } v', \chi '_{v'},{\le '}), \end{aligned}$$

    where \(v, v'\) are minimal elements of \(G, G'\) with respect to \({\le }, {\le '}\) respectively;

  6. 6.

    \(\mathrm {height}(\le ) = \mathrm {height}(\le ') > 0\), \(s = \#G = \#{G'} > 1\), and there is an enumeration \(G_1, \dots , G_s\) of the components of G and \(G_1', \dots , G_s'\) of the components of \(G'\) such that

    1. (a)

      whenever \(i \le j\), \((G_i,\chi ,{\le }) \sqsubseteq (G_j, \chi ,{\le })\) and \((G_i', \chi ',{\le '}) \sqsubseteq (G_j', \chi ',{\le '})\); and

    2. (b)

      if for any i, \((G_i,\chi ,{\le }) \not \sqsubseteq (G_i', \chi ',{\le '})\), then there is a \(j < i\) such that \((G_j', \chi ',{\le '}) \not \sqsubseteq (G_j, \chi ,{\le })\).

To see that this inductive definition is well-founded, note that the recursive use of \(\sqsubseteq \) is on graphs either equipped with an elimination order to degree d of strictly smaller height [clause (5)] or with strictly fewer components [clause (6)]. The next two propositions are aimed at showing that this definition establishes a linear pre-order on coloured graphs with an elimination order that classifies them up to isomorphism

Proposition 6.5

For any pair \((G,\chi , {\le })\), \((G', \chi ', {\le '})\) of coloured graphs with an elimination order to degree d, at least one of \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) or \((G',\chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\) holds.

Proof

The proof is by induction on the height k of \(\le \) and for a fixed k, by induction on the number of components. If \(k=0\), then either \(\mathrm {height}(\le ') > 0\) and \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) by clause (1) of the definition, or \(\mathrm {height}(\le ') = 0\) and at least one of \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) or \((G',\chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\) must hold by clause (2) and the definition of \(\sqsubseteq _0\).

Now suppose \(k > 0\). If one of the first four conditions of Definition 6.4 is satisfied, we are done. So suppose they fail and suppose \(\#G = \#{G'} = 1\). Then, if v and \(v'\) are the minimal elements of \(G, G'\) with respect to \({\le }, {\le '}\), the height of these orders on \(G {\setminus } v\) and \(G' {\setminus } v'\) is strictly less than k. By induction hypothesis, either \((G {\setminus } v,\chi _v, {\le }) \sqsubseteq (G' {\setminus } v', \chi '_{v'},{\le '})\) or \((G' {\setminus } v',\chi _{v'}, {\le '}) \sqsubseteq (G {\setminus } v, \chi _{v},{\le })\), so the claim follows.

Finally, suppose \(\mathrm {height}(\le ) = \mathrm {height}(\le ') > 0\) and \(s = \#G = \#{G'} > 1\) and we argue that in all such cases, clause (6) ensures the result. By the induction hypothesis and the previous case, for any pair of components \(G_i\) and \(G_j\) of G, one of \((G_i,\chi ,{\le }) \sqsubseteq (G_j, \chi ,{\le })\) or \((G_j,\chi ,{\le }) \sqsubseteq (G_i, \chi ,{\le })\) must hold and similarly for the components of \(G'\). Thus, the components of each can be ordered so that whenever \(i \le j\), \((G_i,\chi ,{\le }) \sqsubseteq (G_j, \chi ,{\le })\) and \((G_i', \chi ',{\le '}) \sqsubseteq (G_j', \chi ',{\le '})\). Also, by the induction hypothesis, we have for each i, either \((G_i,\chi ,{\le }) \sqsubseteq (G_i', \chi ',{\le '})\) or \((G_i',\chi ',{\le '}) \sqsubseteq (G_i, \chi ,{\le })\). If the first case holds for all i, then \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\). If the second case holds for all i, then \((G',\chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\). If neither holds for all i, consider the least i such that either \((G_i,\chi ,{\le }) \not \sqsubseteq (G_i', \chi ',{\le '})\) or \((G_i',\chi ',{\le '}) \not \sqsubseteq (G_i, \chi ,{\le })\). In the former case, we have \((G',\chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\) and in the latter \((G_i,\chi ,{\le }) \sqsubseteq (G_i', \chi ',{\le '})\). In all cases, the proposition is established.

This proposition implies that it is always possible to enumerate the components \(G_1, \dots , G_s\) of G in \(\sqsubseteq \)-order. The next proposition shows that this order is, essentially, unique.

Proposition 6.6

Let \(G, G'\) be graphs with colourings \(\chi \) and \(\chi '\) and let \({\le }, {\le '}\) be elimination orders to degree d on \(G, G'\) respectively.

Then both \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) and \((G', \chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\) if, and only if, \((G, \chi , {\le }) \cong (G', \chi , {\le '})\).

Proof

Suppose \((G, \chi , {\le }) \cong (G', \chi , {\le '})\) and suppose, without loss of generality that \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\). We aim to show that also \((G', \chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\), and we do this by induction on the height k of \(\le \) and for a fixed k, by cases on the number of components. If \(k = 0\) then since \((G,\chi ) \cong (G',\chi ')\), the conclusion follows from the definition of \(\sqsubseteq _0\) and clause (2) of Definition 6.4. If \(k > 0\) and \(\# G = 1\) then the induction hypothesis and the fact that \((G {\setminus } v,\chi _v, {\le }) \cong (G' {\setminus } v', \chi '_{v'},{\le '})\) together imply that \((G {\setminus } v,\chi _v, {\le }) \sqsubseteq (G' {\setminus } v', \chi '_{v'},{\le '})\) and \((G' {\setminus } v',\chi '_{v'}, {\le '}) \sqsubseteq (G {\setminus } v, \chi _{v},{\le })\), so the proposition holds by clause (4) of Definition 6.4. Finally, suppose that \(k > 0\) and \(\# G > 1\) and let \(G_1,\ldots ,G_s\) enumerate the components of G in \(\sqsubseteq \) order. By the isomorphism between \((G,\chi , {\le })\) and \((G', \chi ', {\le '})\) and the induction hypothesis, it follows that for the corresponding enumeration \(G_1',\ldots ,G_s'\) of components of \(G'\) in \(\sqsubseteq \) order, we have that \((G_i, \chi , {\le }) \cong (G_i', \chi , {\le '})\) for each i. Then by clause (6) of Definition 6.4, both \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) and \((G', \chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\) hold.

For the other direction, suppose \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) and \((G', \chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\) If \(\mathrm {height}(\le ) < \mathrm {height}(\le ')\), then \((G', \chi ', {\le '}) \not \sqsubseteq (G, \chi , {\le })\), so assume that \(\mathrm {height}(\le ) = \mathrm {height}(\le ') = k\) and we proceed by induction on k. If \(k=0\), we have by clause (2) that \((G, \chi ) \sqsubseteq _0 (G', \chi ')\) and \((G',\chi ') \sqsubseteq _0 (G, \chi )\) which, by definition of \(\sqsubseteq _0\) means that \((G, \chi ) \cong (G', \chi )\), and the two orders are both trivial.

Suppose then that \(k > 0\) and assume first that G and \(G'\) are both connected. Then both \(G, G'\) have minimal elements \(v, v'\) with respect to \({\le }, {\le '}\). By the induction hypothesis we have \((G {\setminus } v, \chi _v {\le }) \cong (G' {\setminus } v', \chi _{v'},{\le '})\), so let \(\sigma : V(G {\setminus } v) \rightarrow V(G' {\setminus } v')\) be an isomorphism witnessing this. Extend this to \(\hat{\sigma } : V(G) \rightarrow V(G')\) by setting \(\hat{\sigma }(v) = v'\) and we claim that this is an isomorphism between \((G,\chi , {\le })\) and \((G',\chi ', {\le '})\). It is clear that \(\hat{\sigma }\) takes the order \(\le \) to \(\le '\) since v and \(v'\) are minimal for these respective orders. Also, \(\hat{\sigma }\) preserves colours since the colourings \(\chi _v\) and \(\chi _{v'}\) refine the colourings \(\chi \) and \(\chi '\) respectively and by clause (4) we have \(\chi (v) = \chi '(v')\). Finally, we need to verify that \(\hat{\sigma }\) preserves the edge relation. Since \(\sigma \) preserves all edges, we only need to verify that \(uv \in E(G)\) if, and only if, \(\hat{\sigma }(u)v' \in E(G')\). But, this follows from the fact that \(\chi _v(u) = \chi '_{v'}(\sigma (u))\).

Now, if G and \(G'\) have different number of connected components, then we cannot have both \((G,\chi , {\le }) \sqsubseteq (G', \chi ', {\le '})\) and \((G', \chi ', {\le '}) \sqsubseteq (G, \chi , {\le })\). So, we are left with the case where \(\#G = \#G' = s > 1\). Let \(G_1 \sqsubseteq \cdots \sqsubseteq G_s\) be the connected components of G and let \(G_1' \sqsubseteq \cdots \sqsubseteq G_s'\) be the connected components of \(G'\). Then by definition of \(\sqsubseteq \) we have that both \((G_i,\chi ,{\le }) \sqsubseteq (G_i',\chi ',{\le '})\) and \((G_i',\chi ',{\le '}) \sqsubseteq (G_i,\chi ,{\le })\) for each \(i \le s\). By the argument for connected graphs above, we have \((G_i,\chi ,{\le }) \cong (G_i',\chi ',{\le '})\) for each i and we are done.

figure a

In order to define an algorithm for constructing a minimal elimination order to degree d, we need one further ingredient. For a graph G of tree-depth k, we say that a vertex v is a potential root of a minimal elimination order on G if \(\mathop {td}(G {\setminus } v) < k\). We know from Bouland et al. [2] that there is a computable function f such that the number of potential roots in any graph of tree-depth k is at most f(k). Moreover, the set of all such vertices can be found by an algorithm running in time \(f(k)n^3\) where n is the number of vertices in G. This now allows us to define Algorithm 1 which computes a minimal elimination order to degree d. The algorithm is started with the graph G, its d-degree torso C, the level \(\ell \) initially set to 0 and the degree d. It then recursively chooses a potential root and returns the order that is minimal with respect to \(\sqsubseteq \).

With this, we are able to establish our main result.

Theorem 6.7

Graph Canonisation is \(\mathsf {FPT}\) parameterized by elimination distance to bounded degree.

Proof

Suppose we are given a graph G with \(|V(G)| = n\). We first compute the d-degree torso C of G in \(O(n^4)\) time. Using Algorithm 1 we compute a \(\sqsubseteq \)-minimal elimination order \(<\) to degree d on G. By the analysis from Bouland et al. [2, Theorem 11], this takes time \(O(h(k)n^3log(n))\) for some computable function h. Note for the base case that we can compute the canonical representation of a component Z with \(\Delta (Z) \le d\) by Theorem 2.4 in polynomial time (where the degree of the polynomial depends on d).

Note that the order \(\sqsubseteq \) also induces a natural order on the vertices of G and we can thus enumerate the vertices of G in a canonical way in linear time.

Corollary 6.8

Graph Isomorphism is \(\mathsf {FPT}\) parameterized by elimination distance to bounded degree.

7 Conclusion

We introduce a new way of parameterizing graphs by their distance to triviality, i.e. by elimination distance. In the particular case of graph canonisation, and thus also graph isomorphism, taking triviality to mean graphs of bounded degree, we show that the problem is \(\mathsf {FPT}\).

A natural question that arises is what happens when we take other classes of graphs for which graph isomorphism is known to be tractable as our “trivial” classes. For instance, what can we say about \(\mathsf {GI}\) when parameterized by elimination distance to planar graphs? Unfortunately techniques such as those deployed in the present paper are unlikely to work in this case. Our techniques rely on identifying a canonical subgraph which defines an elimination tree into the trivial class. In the case of planar graphs, consider graphs which are subdivisions of \(K_5\), each of which is deletion distance 1 away from planarity. However the deletion of any vertex yields a planar graph and it is therefore not possible to identify a canonical such vertex.

More generally, the notion of elimination distance to triviality seems to offer promise for defining tractable parameterizations for many graph problems other than isomorphism. This is a direction that bears further investigation.

It is easy to see that if a class of graphs \(\mathsf {C}\) is characterised by a finite set of excluded minors, that the class \(\hat{\mathsf {C}}\) of graphs with bounded elimination distance to \(\mathsf {C}\) is characterised by a finite set of excluded minors as well. An interesting question is whether we can, given the set of excluded minors for \(\mathsf {C}\), compute the excluded minors for \(\hat{\mathsf {C}}\) as well?