Canonizing Graphs of Bounded Tree Width in Logspace

Graph canonization is the problem of computing a unique representative, a canon, from the isomorphism class of a given graph. This implies that two graphs are isomorphic exactly if their canons are equal. We show that graphs of bounded tree width can be canonized by logarithmic-space (logspace) algorithms. This implies that the isomorphism problem for graphs of bounded tree width can be decided in logspace. In the light of isomorphism for trees being hard for the complexity class logspace, this makes the ubiquitous class of graphs of bounded tree width one of the few classes of graphs for which the complexity of the isomorphism problem has been exactly determined.


Introduction
The graph isomorphism problem ( ) -deciding whether two given graphs are the same up to renaming vertices -is one of the few fundamental problems in NP for which we neither know that it is polynomial-time solvable nor that it is NP-complete.Since NP-hardness would imply a collapse of the polynomial hierarchy to its second level [4,29], significant effort has been put into better understanding the graph-theoretic requirements on input graphs that make polynomial-time solvable.A classical result of Bodlaender [3] shows that is solvable in polynomial time for graphs of bounded tree width [3].Polynomial-time algorithms are also known for other graph classes like planar graphs [17,31] and more general graphs with a crossing-free embedding into a fixed surface [12,13,25].A deeper complexity-theoretic insight behind the polynomial-time algorithms for embeddable graphs is given by the fact that for graphs embeddable into the plane [7] or a fixed surface [11] can be decided by logarithmic-space (logspace) algorithms.These algorithms, which are polynomial-time algorithms using at most a logarithmic amount of memory, define the complexity class L.
So far, it has been an open problem whether for graphs of bounded tree width the isomorphism problem can be solved in logspace.Guided by the goal to determine the exact complexity of the isomorphism problem for these graphs, there has been a sequence of ever stronger partial results.Bodlaender's algorithm [3] placing for graphs of bounded tree width in P was first refined to an upper bound in terms of logarithmic-depth circuits with threshold gates (i.e., circuits defining the complexity class TC 1 ) [16] and later improved to use semi-unbounded fan-in Boolean gates (i.e., circuits defining the complexity class SAC 1 ) [6].Since the chain L ⊆ SAC 1 ⊆ TC 1 ⊆ P is all we know about the inclusion relations of these classes, these works leave the question for a logspace approach that applies to every class of graphs of bounded tree width open.Logspace algorithms are known for small constant bounds on the tree width.Indeed, Lindell's [22] classical approach to testing isomorphism of trees provides us with a logspace algorithm for graphs of tree-width at most 1.This was generalized to graphs of tree width at most 2 [2] and results of [8] for graphs without K 5 as a minor apply to graphs of tree width at most 3.Moreover, k-trees, the maximal tree-width-k graphs, admit logspace isomorphism tests [1] as well as graphs with a bounded tree depth [5].While providing us with ever larger classes of graphs with logspace algorithms for , the general question for bounded tree width graphs remained open.
Results.Our first main result answers the above question in its most general way by showing that the isomorphism problem for graphs of bounded tree width can be solved by logspace algorithms.Together with a result of Jenner et al. [18], showing that the isomorphism problem for trees is L-hard, this pinpoints the complexity of for graphs of bounded tree width.
Theorem 1.1.For every positive k ∈ N, there is a logspace algorithm that decides whether two given graphs of tree width at most k are isomorphic.Moreover, this problem, is complete for L with respect to first-order reductions.
For testing whether two graphs are isomorphic, it is in practice often helpful to perform a two-step approach that first computes a canonical representative for each isomorphism class, called the canon, and then declares the two graphs to be isomorphic exactly if their canons are equal (rather than isomorphic).
To also be able to construct an isomorphism between the input graphs (that means, a bijective function between the vertex sets of given graphs that preserves their edge relations), it is helpful to have additionally access to an isomorphism from the input graphs to their canons.Such an isomorphism to the canon is called a canonical labeling of a graph.An isomorphism between the input graphs can be constructed by composing canonical labelings.
For most isomorphism algorithms that have been developed so far, it was possible, with varying amounts of extra effort, to turn them into an algorithm that computes canons and canonical labelings.Hence, deciding and computing canons are often known to have the same complexity.However, the current situation for graphs of bounded tree width is different: While the approach from [6] puts the isomorphism problem for graphs of bounded tree width into SAC 1 , this is not done by providing a canonization procedure.In fact, the best known upper bound for canonizing graphs of bounded tree width uses logarithmic-depth circuits with unbounded fan-in Boolean gates (i.e., circuits defining the complexity class AC 1 ) [34].Between these classes only the relation SAC 1 ⊆ AC 1 is known.Our second main result clarifies this situation by providing a logspace algorithm for canonizing graphs of bounded tree width.Theorem 1.2.For every k ∈ N, there is a logspace algorithm that, on input of a graph G of tree width at most k, outputs an isomorphism-invariant encoding of G (a canon) and an isomorphism to it (a canonical labeling).
Techniques.The known logspace approaches for canonizing certain classes of bounded tree width graphs are based on first computing an isomorphism-invariant tree decomposition for the given input graph and then adjusting Lindell's tree canonization approach to canonize the graph with respect to the decomposition.For example, for k-trees [1] an isomorphism-invariant tree decomposition arises by taking a graph's maximal cliques and their intersections as the bags of the decomposition and connecting two bags based on inclusion.The resulting tree decomposition is both isomorphism-invariant, which is required for a canonization procedure to be correct, and has width k, which enables the application of an extension of Lindell's approach by taking (the constant number of) orderings of the vertices of the bags into account.
Technique 1: Isomorphism-invariant tree decomposition into bags without clique separators.In general, for graphs of tree width at most k, there is no isomorphism-invariant tree decomposition of width k.A simple example of graphs demonstrating this are cycles, which have tree width 2, but no isomorphism-invariant tree decomposition of width 2. We could hope to find an isomorphism-invariant tree decomposition by allowing approximate tree decompositions (that means, allowing an increase of the width to some constant k ′ ).Again, cycles show that such tree decompositions do not always exist.To address this issue, we could consider not just one tree decomposition, but an isomorphism-invariant and polynomial-size collection of tree decompositions.However, for all k ′ ∈ N, there are graphs of tree width at most 3 for which the smallest isomorphism-invariant collection of tree decompositions of width k ′ has exponential size.Simple graphs demonstrating this fact are given by forming the disjoint union of n cycles of length n, and adding a vertex that is adjacent to every other vertex.
We work around this problem by considering isomorphism-invariant tree decompositions that may have bags of unbounded size, but with bags that are easier from a graph-theoretic and algorithmic perspective than the original graph.An algorithm developed recently [23] (which refined the time complexity for on graphs of tree width k from Bodlaender's n O(k) bound to g(k) • n O (1) for a function g) applies a technique from Leimer [21] that turns the input graph into its isomorphism-invariant collection of maximal induced subgraphs without clique separators called maximal atoms.(In the example above, the maximal atoms are exactly the enriched cycles.)We adapt this idea as a first step for the proofs of our main results, but need to adjust it both with respect to the graph-theoretic concepts as well as the algorithmic ideas involved: While the collection of subgraphs produced by Leimer's approach is isomorphism-invariant, the tree underlying the resulting decomposition highly depends on the order in which subgraphs are considered and, thus, is not isomorphism-invariant.While it is always sufficient to have an isomorphism-invariant set of potential bags capturing a tree decomposition in order to perform polynomial-time isomorphism tests (see [26]), in order to apply or work towards logspace techniques it is necessary to have an isomorphism-invariant tree decomposition.Our first main technical contribution develops a tree decomposition of a graph whose bags are maximal atoms that is isomorphism-invariant, and logspace-computable for graphs of bounded tree width.
Technique 2: Nested tree decomposition and a quasi-complete isomorphism-based ordering.Lindell's approach [22] for canonizing trees is based on using a weak order on the class of all trees whose incomparable elements are exactly the isomorphic ones, and showing that the order can be computed in logspace.Das, Torán, and Wagner [6] extended this to also work for graphs with respect to given tree decompositions of bounded width.This is done by adding the idea that, for bounded width, it is possible in logspace to guess partial isomorphisms between bags and recursively check whether they can be extended to isomorphisms between the whole graphs and the tree decompositions.When working with the tree decompositions into maximal atoms described above, it is not possible to just guess and check partial isomorphisms between bags since they have an unbounded width.
In order to handle the width-unbounded bags of the above decomposition, we use the fact that (as shown in [23]), after appropriate preprocessing, the maximal atoms have polynomial-size isomorphisminvariant families of approximate tree decompositions.To compute these families, we combine an approach for constructing separator-based tree decompositions from [10] to work with the isomorphisminvariant separators from [23].If we choose a bounded width tree decomposition for each atom, and replace each atom by the chosen tree decomposition, we can turn the width-unbounded decomposition into a width-bounded decomposition for the whole graph.However, since each maximal atom may be associated with several decompositions, we need to consider for each atom a family of decompositions.We call the structure that is obtained a nested tree decomposition.In order to extend the approach that canonizes with respect to width-bounded decompositions of [6] to nested tree decompositions, we incorporate a bag refinement step into the weak ordering.It turns root bags of unbounded width into width-bounded tree decompositions.For each candidate tree decomposition of the root bag this triggers a modification of the original tree decomposition.However, it turns out that determining whether there is an isomorphism between two graphs that respects two given nested tree decompositions is as hard as the general graph isomorphism problem (see Remark 5.4).Having a polynomial-time algorithm for this, let alone a logspace algorithm, would thus put the general graph isomorphism problem into P. Consequently, we do not generalize the idea of using isomorphism-based orderings with respect to decompositions in a direct way to nested tree decompositions.Instead, we define an approximation of the isomorphism-based ordering.This approximation has the property that it is isomorphism-invariant (i.e., graphs that are isomorphic with respect to given nested decompositions are incomparable) but is only quasi-complete, by which we mean that graphs that are incomparable must be isomorphic but not necessarily via an isomorphism that respects the nested decompositions.Developing the notion of nested tree decompositions along with just the right notion of a quasi-complete isomorphism-based ordering is our second main technical contribution.
Technique 3: Recursive logspace algorithm implementing the quasi-complete ordering.Trying all choices of a decomposition on all of the atoms yields exponentially many refined decompositions in total.Avoiding this exponential blowup, our third main technical contribution is a dynamic-programming approach along the tree decomposition that shows how to cycle through candidate decompositions of the maximal atoms while, still, canonizing the graph along the coarser tree decomposition in logspace.
Since recursively cycling through tree decompositions of a bag needs space, we cannot just use the polynomial-size family of tree decompositions that we get from applying the results of [10] to those of [23] as described above.In order to implement the recursion in logspace, we compute nested tree decompositions that satisfy a certain additional (quite technical) property, which we call p-boundedness.It allows us to maintain a trade-off between the number of candidate tree decompositions chosen for each bag and the size of the subdecomposition sitting below the bag.This makes a recursive algorithm that uses only logarithmic space possible.
Organization of the paper.Section 2 provides background on standard graph-theoretic notions and logspace.The remaining part of the paper is structured along the proofs of the main theorems: In Section 3 we show how to compute isomorphism-invariant tree decompositions into clique-separator-free graphs in logspace, while Section 4 contains the decomposition approach for graphs without clique separators.Section 5 defines the notion of nested tree decompositions and a weak ordering that is recursively defined along these decompositions, while Section 6 proves that the ordering is logspace-computable for width-bounded and p-bounded decompositions.Section 7 finally proves the paper's main theorems.Section 8 concludes with a summary and an outlook.

Graphs and Connectivity.
For a graph G = (V, E) with vertices V and edges E ⊆ V × V , we define V (G) := V and E(G) := E. All graphs considered in the present paper are finite, undirected and simple (neither parallel edges nor loops are present).We denote the class of all finite graphs by G. To simplify later definitions, we define the coloring function col . If G's vertices or edges are colored, we extend the coloring function to return natural number encodings of colors.
Subgraphs and induced subgraphs are defined as usual.We write G[V ′ ] to denote the subgraph induced by a vertex set V ′ ⊆ V (G) in a graph G.A path is an alternating sequence v 0 e 0 . . .v m−1 e m−1 v m of distinct vertices and edges from G with e i = {v i , v i+1 } for every i ∈ {0, . . ., m − 1}.
A separation of a graph G is a pair (A, B) of subsets of V (G) with (1) A ∪ B = V (G), and (2) The definition of how a separation (A, B) separates parts of a graph commonly distinguishes between whether the separated parts are vertices or sets of vertices: A separator (A, B) separates vertex sets X, Y ⊆ V (G) with X ⊆ A and Y ⊆ B. A separator (A, B) separates vertices x, y ∈ V (G) with x ∈ A \ B and y ∈ B \ A. The connectedness of sets X, Y ⊆ V (G) in a graph is the size of a smallest separator that separates them, it is denoted by κ G (X, Y ).The connectedness of vertices x, y ∈ V (G), denoted by κ G (x, y), is defined in the same way, except that we set κ G (x, y) := ∞ if x and y are adjacent.
Graphs G and H that admit an isomorphism between them are isomorphic.This gives rise to an equivalence relation that partitions G into isomorphism classes.The graph isomorphism problem is the language Here an encoding of the graphs as strings is assumed.(We can assume that the graphs are given as adjacency matrices, which is however irrelevant since the reasonable encodings are logspace equivalent.) A canonization is a mapping can : G → G where G is isomorphic to can(G), such that for every two graphs G and H we have can(G) = can(H) exactly if G and H are isomorphic.The graph can(G) is the canon of G (under can), and an isomorphism ϕ between G and can(G) is a canonical labeling of G (under can).Comparing the canons of two graphs G and H suffices to test whether they are isomorphic, and canonical labelings of two graphs can be used to construct an isomorphism.
A mapping that associates an object inv(G) with every graph G ∈ G, for example a tree decomposition or a family of tree decompositions, is isomorphism-invariant if for every isomorphism ϕ between two graphs the result of applying ϕ and inv is independent of the order in which they are applied.That means, for every isomorphism ϕ from a graph G to a graph H, replacing all occurrences of vertices v ∈ V (G) in inv(G) by their image ϕ(v) yields inv(H).The torso of a node n ∈ V (T ) is the graph obtained from the induced graph G[B n ] by adding for every neighboring node n ′ of n the clique on the adhesion set B n ∩ B n ′ .Given a tree decomposition D = (T, B), its size is |D| := |V (T )|, and its (tree) width is the maximum over all |B n |−1 for n ∈ V (T ).The tree width of G, denoted by tw(G), is the minimum width of a tree decomposition for it.
When working with trees underlying rooted tree decompositions D = (T, B), which have a distinguished root node r ∈ V (T ), we talk about a parent, ancestor, child, and descendant of a node n ∈ V (T ) with respect to the root r ∈ V (T ) in the usual way.Given a rooted tree decomposition D = (T, B), a subdecomposition D ′ = (T ′ , B ′ ) is a decomposition that arises by using a node n ∈ V (T ) and all its ancestor nodes to form a tree decomposition.A child decomposition is a subdecomposition that contains a child of the root node, but not the root.
Tree decompositions are commonly studied in both their unrooted and rooted variants.In the context of logspace and the isomorphism problem, we do not need to restrict ourselves to a particular definition (as formalized by the following fact).However, in order to facilitate a clear presentation, we use rooted tree decompositions.

Fact 2.1.
There is a logspace-computable and isomorphism-invariant mapping that turns an unrooted tree decomposition D for a graph G into a rooted tree decomposition D ′ for G with the same adhesion sets.Fact 2.1 seems to be a folklore and special cases have, for example, been used in [1,7].Its proof takes an unrooted tree decomposition and turns it into a rooted decomposition by declaring the center of the tree, the unique node or edge with the maximum distance to the tree's leafs, to be the root.If the center is an edge, we subdivide it by inserting a new node whose bag is the intersection of the edge's incident bags.
Two graphs G and G ′ are isomorphic with respect to tree decompositions D = (T, B) and D ′ = (T ′ , B ′ ), respectively, if there exists an isomorphism ϕ from G to G ′ and an isomorphism ψ from T to . Under these conditions we say that ϕ respects D and D ′ .Based on this definition and the way of how it refines the isomorphism equivalence relation among graphs, we also consider canons of graphs with respect to tree decompositions.
Logspace.A deterministic Turing machine whose working space is logarithmically bounded by the input length is called a logspace .The functions f : {0, 1} * → {0, 1} * computed by such machines are logspace-computable (or in logspace).The complexity class L, called (deterministic) logspace, contains all languages P ⊆ {0, 1} * whose characteristic functions are in logspace.Functions in logspace are closed under composition [30,19] and also under queries to oracles for languages from L [20].Reingold [28] studied the problem -:= {(G, s, t) | there is a path from s ∈ V (G) to t ∈ V (G) in the undirected graph G}, and showed that it is in L. Furthermore, we can test whether a graph's tree width is bounded by a constant since --k := {G | tw(G) ≤ k} ∈ L for every k ∈ N [10].Details about the circuit complexity classes that are mentioned in the introduction are given in Vollmer's book [33], but we do not require them in the following.

Decomposing graphs into parts without clique separators
A clique is a graph with an edge between every two vertices, including the empty graph by definition.A separation (A, B) is a clique separation with clique separator A ∩ B in a graph G if it (1) separates two vertices x, y ∈ V (G), and (2) G[A ∩ B] is a clique.
We construct isomorphism-invariant tree decompositions for graphs of bounded tree width whose bags induce subgraphs without clique separators and whose adhesion sets are cliques (that means, the torsos are exactly the subgraphs induced by the bags).These tree decompositions serve as an intermediate decomposition step in the proofs of our main theorems.Lemma 3.1.For every k ∈ N, there is a logspace-computable and isomorphism-invariant mapping that turns a graph G with tree width at most k into a tree decomposition D for G in which 1. subgraphs induced by the bags do not contain clique separators, and 2. adhesion sets are cliques.
The tree decomposition we construct to prove the lemma is a refined version of a decomposition of Leimer [21] of graphs into their collections of maximal induced subgraphs without clique separators.The crucial point is that we need to adjust his method to not only output the collection of maximal induced subgraphs without clique separators, which suffices for its application in [23], but also an isomorphisminvariant tree decomposition that is based on it.In order to do that, we replace the approach of [21], which is based on finding clique-separator-free parts in a single phase via computing elimination orderings, by several steps.In these steps we compute graphs that are clique-separator-free with respect to cliques up to a certain size.The size bound grows when going from one step to the next.While Leimer's method runs in polynomial-time and applies to general graphs, our approach needs logarithmic space and applies to graphs of bounded tree width, which suffices for our applications.
Section 3.1 presents the definition and logspace-computability of maximal subgraphs without sizebounded clique separators.Section 3.2 presents a transformation of graphs that is used in Section 3.3 to prove Lemma 3.1

Atoms with respect to constant-size clique separators
Let c ∈ N, which we use as an upper bound on the size of clique separators we consider.A c-atom is a graph that does not contain clique separators of size at most c.Atoms, which are the graphs Leimer [21] deals with, are |V (G)|-atoms (or, alternatively, graphs without clique separators).A maximal c-atom of a graph G is a maximal induced subgraph G[A] for some A ⊆ V (G) that is a c-atom (that means, every extension of it contains a clique separator of size at most c).A maximal atom in a graph G is a maximal |V (G)|-atom.For every c ∈ N, c-atoms are nonempty and connected.
Two vertices a 1 , a 2 ∈ V (G) are c-inseparable (with respect to clique separations in G) if there is no clique separator of size at most c in G separating a 1 and a 2 and c-separable, otherwise.
Note that the definition of induced subgraphs G[A] that are c-atoms only considers separations of G[A] while c-inseparability of a vertex set A is based on separations in the (ambient) graph G.If we look at maximal c-atoms and maximal c-inseparable sets, then these notions coincide.

Lemma 3.2. For every c ∈ N, graph G, and
Proof.(From c-atoms to c-inseparable sets.)Two vertices a 1 and a 2 from a vertex set A is chosen to be maximal c-inseparable, there is a vertex a ′ ∈ A and a clique separator C ′ of size at most c that separates a ′ from x. Since A is c-inseparable in G, C ′ cannot separate elements of A in G. Thus, we know that either C ′ separates x from a 1 or a 1 ∈ C ′ , and either C ′ separates x from a 2 or a 2 ∈ C ′ .That means, the path P , which starts in a 1 , passes through x, and ends in a 2 , must intersect C ′ in some vertex p 1 = x before reaching x, and intersect C ′ again in some vertex p 2 = x after leaving x.Since C ′ is a clique, we can take a shortcut by directly taking the edge {p 1 , p 2 } ∈ E(G) without visiting x.This contradicts the fact that P is a shortest path.
Proof.We first argue that A is c-inseparable: Assume, for sake of contradiction, that vertices To see that A is unique and maximal among the c-inseparable sets containing I, note that every candidate a ∈ V (G) \ A is c-separable from at least one vertex in I.
size at most c whether they are maximal c-inseparable in G, and output the sets that pass the test.To find maximal c-inseparable sets with more than c vertices, we consider every c-inseparable set I ⊆ V (G) with |I| = c + 1 and output A := {a ∈ V (G) | I ∪ {a} is inseparable}.The correctness of the algorithm follows from Lemma 3.3.It can be implemented by a logspace since we only cycle through vertex sets of (constant) size at most c and use oracle calls to -, which is in L [28].The mapping that turns a graph G for a c ∈ N into its family of c-inseparable sets is isomorphisminvariant by definition.

Chordal completions with respect to constant-size clique separators
Instead of working with a given graph G directly, some of Leimer's arguments [21] are based on working with its chordal completion G * , which is the graph that arises from G by replacing every maximal atom in the graph with a clique on the atom's vertices.Interestingly, the vertex sets of the maximal atoms are the same for G and G * .The same property holds when moving from a graph G to the c-chordal completion G c , for every c ∈ N, that arises from G by replacing every maximal c-atom with a clique on its vertex set.For a formal proof of this fact we first show that the intersection of two c-atoms is a clique.

Lemma 3.5. Let G be a graph and A 1 and
has size at most c in order to be contained in two distinct maximal c-inseparable sets by Lemma 3.3.Let a 1 ∈ A 1 \ A 2 and a 2 ∈ A 2 \ A 1 be c-separable vertices and C be a clique separator of size at most c that separates them.Assume, for the sake of contradiction, that there exists a vertex a ′ ∈ (A 1 ∩ A 2 ) \ C. Since both a ′ ∈ A 1 and a ′ ∈ A 2 and both A 1 and A 2 are c-inseparable, we can find a path P a 1 ,a ′ between a 1 and a ′ and a path P a ′ ,a 2 between a ′ and a 2 in G − C. Thus, there is also a path P between a 1 and a 2 .This contradicts the existence of a

and 2. C is a clique separator in G if and only if C is a clique separator in G c
Proof.We start to prove the first property.The arguments of the proof are based on properties of vertex sets of maximal c-atoms, and maximal c-inseparable vertex sets.We can freely switch between both points of view since they are equivalent by Lemma 3.3.
To prove that A is maximal with this property in G c , assume, for the sake of contradiction, that A is not maximal with this property in G c .Then there is a vertex By assumption, C does not separate a from x in G c .Thus, we can find a path P between a and x in G c − C. We show that P can be modified to a path P ′ between a and x in G by observing each of its edges and, if necessary, redirecting it.Let {u, v} be an edge from , we know by the construction of G c that u and v are c-inseparable in G (in particular, they are part of a common maximal c-inseparable set).Thus, we can find a path P {u,v} between u and v in G[A ′ ] − C and modify P to use P {u,v} instead of {u, v}, which is only present in G c .Overall, this leads to constructing a path P ′ in G − C between a and x.This contradicts the fact that C separates a and x in G.
We are left to prove the converse direction.Let a 1 and a 2 be two vertices that are c-inseparable in G c .For the sake of contradiction, assume they are c-separable in G.
edges are constructed between the sets B 1 \ B 2 and B 2 \ B 1 , and C is also a clique separator of size at most c in G c .This contradicts the initial choice of a 1 and a 2 as being c-inseparable vertices in G c .Thus, a 1 and a 2 are c-inseparable in G, too.The arguments above imply that every c-inseparable set of G c is a c-inseparable set in G.In particular, this holds for the maximal c-inseparable sets and, thus, for the maximal c-atoms.
For the second property, let C be a clique separator of size at most c in G, which does not need to be a minimum clique separator.Then C is also a clique separator in G c by the arguments from the last paragraph.For the other direction, let C be a clique separator of size at most c in G c .It also separates two distinct vertices in G and we are left to prove that it is a clique.Since C is a clique separator of size at most c, it lies in the intersection of two distinct maximal c-inseparable sets A 1 and A 1 in G c .The sets A 1 and A 1 are also maximal c-inseparable sets of G by the first property of the lemma proved above, and A 1 ∩ A 2 is a clique by Lemma 3.5.Thus, C is a clique separator in G, too.

Isomorphism-invariant tree decompositions into atoms
Our goal is to compute an isomorphism-invariant tree decomposition of a graph into its c-atoms.
A minimum clique separator (with respect to x and y in a graph G) is an inclusion-wise minimal clique that separates x and y in G.For every c ∈ N and graph G, we define the graph T c = T c (G) whose node set consists of all c-atoms of G and all minimum clique separators of size at most c.An edge is inserted between every c-atom G[A] and minimum clique separator C with C ⊆ A. We define the class of bags The graph T c (G) is typically not a tree.However, as stated by Lemma 3.8, T c (G) is a tree and, moreover, Proof.Instead of working with G, we use the graph G c , whose maximal c-inseparable vertex sets and clique separators of size at most c are exactly the respective ones of G by Lemma 3.6.Thus, we set G := G c throughout the proof, which does not alter the construction of T c .To simplify the notations of the proof, we also set T := T c (G) and B := B c (G).

Claim. T is connected.
Proof of the claim.If T is a single node, the claim holds.If V (T ) ≥ 2, we argue as follows.
Since every clique separator is contained in some maximal c-atom, it suffices to show that distinct maximal c-atoms are connected in T .Let A 1 and A 2 be maximal c-atoms.Since A 1 and A 2 are distinct, there is a clique separator C of size at most c separating A 1 from A 2 in G.For an atom A and a clique separator C separating A from a vertex x ∈ V (G) \ A, define ∆(A, C) to be the minimum c i=1 |P i | among all c-tuples of vertex-disjoint paths P 1 , . . ., P c that start in A and end in C. Such paths exist by Menger's theorem [9] after the preprocessing mentioned above.Note that ∆(A, C) = 0 if and only if C ⊆ A. We show that distinct atoms A 1 and A 2 are connected in T by induction on connected in T by definition.Thus, we assume that for all cliques C of size c separating A 1 and A 2 we have ∆(A 1 , C)+∆(A 2 , C) > 0.
To continue the proof, we distinguish two cases.
For the first case, assume there exists a clique C of size c separating A 1 and For the second case, suppose that for all clique separators C of size c separating A 1 and A 2 , we have ∆(A 1 , C) = 0, or ∆(A 2 , C) = 0. Let C be such a clique separator.Without loss of generality, we may assume If there is an atom A ′ containing C and C ′ , then A ′ is adjacent to A 1 and A 2 and, thus, A 1 and A 2 are connected.Otherwise, there must be a clique separator C ′′ separating a vertex in C from a vertex in C ′ .However, this implies C ′′ A 1 and C ′′ A 2 .This brings us to the previous case with Proof of the claim.Let v 1 be a vertex in A 1 \ A 2 .Such a vertex must exists since A 1 and A 2 are distinct maximal c-atoms.We show for 2 ≤ i ≤ t − 1 that the separator C i contains a vertex v i that is separated from v 1 by C 1 .For i ≥ 2, we choose v i as a vertex in C i \C 1 .Such a vertex exists since the C i are distinct subsets of V (G) of the same size c.To see that C 1 separates v 1 from v i , observe that by induction C 1 separates v 1 from v i−1 , but v i−1 and v i cannot be separated by C 1 since they lie in the same c-atom A i .Since v t−1 ∈ A t , C 1 separates all vertices in A 1 \ A 2 from all vertices in A t \ A 2 .This proves the claim.
To see that T is a tree, assume that A 1 , C 1 , A 2 . . ., C t−1 , A t = A 1 is a cycle.By the second claim, A t = A 1 does not contain a vertex from A 1 \ A 2 , but this contradicts A 1 and A 2 being maximal c-atoms that are distinct.To see that the center of T is a unique node, it suffices to observe that a separator cannot be a leaf of T .
To prove the connectedness property of decompositions, let A 1 , C 1 , A 2 , . . ., C t−1 , A t be a path, such that A 1 and A t contain a common vertex v that is not contained in A i for i ∈ {2, . . ., t − 1}.Since separators are always contained in some adjacent atom, this is the only case that needs to be considered.However, the existence of such a path directly contradicts the second claim above.The covering property of tree decompositions follows from the fact that every edge of G is part of some c-atom.Hence, T is a tree decomposition of G. Since distances in trees are logspace-computable, we can determine the bag closest to the root in the definition above.Thus, T can be constructed in logspace based on constructing T by Lemma 3.8 and T A by induction.
(Correctness of construction.)The tree T is well defined since the intersection of two atoms A 1 and A 2 that are adjacent in D ′ is a clique and every clique must be contained in some bag of a tree decomposition.Moreover, the bags that contain a clique form a connected subtree and the bag closest to the root is well defined.
Isomorphism invariance of T follows from the isomorphism invariance of the decompositions D A , D ′ , and the uniqueness of the bag closest to the root containing a clique.
We argue that T is a tree.It is connected since D ′ and each D A is connected.To argue that it is cycle free, suppose (B 1 , A 1 ), . . ., (B t , A t ) with (B t , A t ) = (B 1 , A 1 ) is a cycle.Note that for two atoms A and A ′ that are adjacent in D ′ the bag B and B ′ for which (B, A) is adjacent to (B, A ′ ) is unique.This implies that either the walk A 1 , . . ., A t contains a cycle, or there are indices ) is a closed walk, which implies that B j , B j+1 , . . ., B t is a cycle.Since both D ′ and D A are acyclic, this yields a contradiction.
It remains to show that with this definition T is a tree decomposition whose adhesion sets are cliques.If two vertices (B 1 , A 1 ) and (B 2 , A 2 ) are adjacent, then B 1 ∩ B 2 is an adhesion set either in D A 1 = D A 2 , or in D. In either case it is a clique.To show the connectivity property of tree decompositions, let (B 1 , A 1 ), . . ., (B t , A t ) be a path in T such that B 1 and B t contain a vertex v that does not appear in B i for 2 ≤ i ≤ t − 1.This implies, since D ′ is a tree decomposition, that v is contained in all A i .In turn, this implies that v is contained in all B i , since each D A is a tree decomposition.
Proof of Lemma 3.1.Let G be the input graph of tree width at most k.Without loss of generality, we assume that it is connected.Then the graph G is a 0-atom.We apply Lemma 3.9 to G with d = 0 and c = k + 1.Since G has tree width at most k, the size of a largest clique in G is bounded by k + 1.Thus, the subgraphs induced by the bags, which do not contain clique separators of size at most k + 1 by their construction, do not contain clique separators (of any size).

Decomposing graphs without clique separators
The decomposition procedure from the previous section provides us with a tree decomposition whose bags are clique-separator-free.In the present section, we decompose clique-separator-free graphs further into isomorphism-invariant tree decompositions of bounded width (formalized by Lemma 4.1).This needs two additional assumptions that we later meet during the proofs of Theorems 1.1 and 1.2.First, the decomposition is based on two distinguished nonadjacent vertices from the graph.Second, we assume that the given graph is improved as defined next.
Let impr : G → G be the mapping that takes a graph G and adds edges between all vertices u, v ∈ V (G) with κ(u, v) > tw(G).The impr-operator improves the graph by adding edges of G based on its tree width.To avoid losing information, we introduce a function col impr(G) that colors edges that appear originally in the inputs with a different color than those coming from the improvement.The mapping impr is isomorphism-invariant by definition.Besides this, we use three further properties of the mapping impr.First, the graph we get from applying impr is saturated in the sense that a second application of it does not add new edges.Formally, this means impr(G) = impr(impr(G)) for every graph G as proved in [24,Lemma 2.5].Second, the tree decompositions of a graph G are exactly the tree decompositions of impr(G).This implies tw(G) = tw(impr(G)) and is proved in [24,Lemma 2.6].Third, the mapping impr is logspace-computable for graphs of bounded tree width.This follows from Reingold's algorithm for -, and the fact that the tree width of a graph bounds the size of the separators we need to consider in order to compute impr.Lemma 4.1.For every k ∈ N, there is a k ′ ∈ N and a logspace-computable and isomorphism-invariant mapping that turns every graph G with a distinguished non-edge {u, v} / ∈ E(G), where G 1. has tree width at most k, 2. does not contain clique separators, and 3. is improved (that means, G = impr(G)), into a width-k ′ tree decomposition D = (T, B) for G.
The rest of the section is devoted to the proof of the lemma.The construction of the decomposition is based on recursively splitting the graph into smaller subgraphs using size-bounded and isomorphisminvariant separators.In order to do this, we adapt in a first step the isomorphism-invariant separators from [23] and show their logspace-computability (this is done in Section 4.1).Then we combine this with a logspace approach for handling the recursion involved in this approach from [10] (this is done in Section 4.2).

Constructing isomorphism-invariant separators
Lokshtanov et al. [23] identified an isomorphism-invariant family of separators that can be used as part of a recursive algorithm for constructing isomorphism-invariant tree decompositions.We adapt their approach of constructing separators, which is tailored to find (time-efficient) algorithms proving fixedparameter tractability, to work in logspace.For this we need to adjusted some terminology.
For a graph G and a set of vertices V ′ ⊆ V (G), we define the neighborhood of V ′ in G to be the set A graph with interface is a pair (G, I) consisting of a graph G and an interface I ⊆ V (G) where 1. G \ I is connected, and We split a graph into several components based on separators for its interface.Let G be a graph and X, Y ⊆ V (G).It is well-known (see, for example, [23]) that there is a unique separator sep(X, Y ), otherwise.
The following proposition follows from the definition of sep s (G, I), and the constant bound on the tree width of the given graphs.In this case, in order to compute sep s (G, I), we only need to enumerate vertex sets of constant size combined with reachability queries in undirected graphs.Moreover, for s ∈ N, we know that (G, I) → sep s (G, I) is isomorphism-invariant by definition.

Constructing isomorphism-invariant tree decompositions
To construct isomorphism-invariant tree decompositions using the previously defined (isomorphisminvariant) separators for graphs, we encapsulate their recursive computation using the concept of descriptor decompositions from [10].We slightly adjust the terminology from [10] by using graphs with interfaces directly instead of using descriptors.
A descriptor decomposition for a graph G is a pair (M, R) consisting of a directed graph M and a collection R of subgraphs with interfaces R n = (H, I) for every node n ∈ V (M ) where (V (G) \ (V (H) \ I), V (H)) is a separator in G. Beside this, (M, R) contains a root node r with R r = (G, I) for some I.Moreover, for every node n ∈ V (M ) with R n = (H, I) and children n 1 , . . ., n m of n in M with R n i = (H i , I i ) for i ∈ [m] the following properties hold: 1. for each Descriptor decompositions contain tree decompositions in the following way [10,Lemma III.4].Given a descriptor decomposition (M, R) rooted at r ∈ V (M ), the subgraph of M reachable from r is a tree T that can be turned into a tree decomposition (T, B) by setting B n for each n ∈ V (T ) to be the union of the interface I of R n = (H, I) and all vertices x that are in interfaces of at least two of the I, I 1 , . . ., I m .The width of (M, R) is the width of (T, B).
Mapping a descriptor decompositions (M, d) to its tree decompositions (T, B) is isomorphisminvariant.Moreover, from [10, Lemma III.5] we know that turning descriptor decompositions into their tree decompositions is logspace-computable.In the light of these facts, all we need to do to, finally, prove Lemma 4.1 is to construct an isomorphism-invariant descriptor decomposition (M, R) inv of a bounded (approximate) width k ′ ∈ N. Lemma 4.4.For every k ∈ N, there is a k ′ ∈ N and a logspace-computable and isomorphism-invariant mapping that turns every graph G with a distinguished non-edge {u, v} / ∈ E(G), where G 1. has tree width at most k, 2. is an atom, and 3. is improved, into a width-k ′ descriptor decomposition (M, R).
Proof.Let small, medium, large : N → N be the functions satisfying Fact 4.3.We consider the directed graph M whose nodes correspond to all subgraphs with interfaces (H, I) where (V (G) \ (V (H) \ I), V (H)) is a separation in G with separator size |I| ≤ medium(tw(G)).We insert an edge from a node n to a node n ′ if the graph with interface of n ′ arises (as a component) by applying Fact 4.3 to the one of n.In addition, we insert an edge from n to a node (G[S], S), which represents the corresponding separator S. We declare the graph with interface (G, ∅) to be the root r of (M, R) and, in addition, connect it to all (G[C ∪ {u, v}], {u, v}) where C ⊆ V (G) is the vertex set of a component of G − {u, v}.
For a constant bound on the tree width, constructing (M, R) can be done by iterating over all candidate subgraphs with interfaces of a given graph G and using Proposition 4.2 to construct the corresponding separator and connecting it with the children.
To show that (M, R) is a descriptor decomposition, we first observe that it has a root node r where R r is G with interface {u, v}.Moreover, we need to check Properties (1) to (4) of descriptor decompositions: Property (1) follows from the fact that each separator covers the interface I and extends it.Properties (2) and (3) follow from the fact that we always consider nonempty components that are disjoint, respectively.Every edge is contained in G[I], in G[S], or in a component.The edges that are only in G[S] are covered by (G[S], S), which ensures Property (4).The bound on the width follows from the definition of S.
Proof of Lemma 4.1.To prove the lemma, we first apply Lemma 4.4 in order to construct a descriptor decomposition (M, R) that is isomorphism-invariant and has a bounded width.We turn it into a tree decomposition (T, B) of the same width as discussed which is an isomorphism-invariant mapping.Thus, the combined mapping from G with distinguished pair {u, v} to the tree decomposition is isomorphism-invariant as well.

Isomorphism-based ordering of nested tree decompositions
Nested tree decompositions are tree decompositions whose parts are not just bags, but where every bag is associated with a family of tree decompositions for the bag's torso.We use polynomial-size nested tree decompositions to represent exponential-size families of width-bounded tree decompositions that arise by replacing bags with tree decompositions from their families.In order to solve the isomorphism problem with the help of nested tree decompositions, we use a recursively defined weak ordering on pairs of graphs and nested tree decompositions.Incomparable elements in this weak ordering represent isomorphic graphs.
In Section 5.1 we define nested tree decompositions.To define the ordering on nested tree decompositions in Section 5.3, we first define concepts related to weak orderings in Section 5.2.

Definition of nested tree decompositions
A nested (tree) decomposition D = (T, B, D) for a graph G consists of a tree decomposition (T, B) for G, and a family D = (D n ) n∈V (T ) where every D n is a family of tree decompositions D ∈ D n for the torso of n.Normal tree decompositions can be viewed as nested decompositions where D n is empty for every n ∈ V (T ).We adjust some terminology that usually applies to tree decompositions for the use with nested decompositions.Let D = (T, B, D) be a nested decomposition.The definition of the width of a bag B n in a nested decomposition depends on whether D n is empty or contains a set of tree decompositions.Refining a nested decomposition D = (T, B, D) with respect to a tree decomposition D ∈ D r for the root r ∈ V (T ) and an ordered root set σ is done as follows.First, we decompose G[B r ] using D.Then, for each child bag B c of B r in D, we find the highest bag in D that contains the adhesion set B {r,c} = B r ∩ B c and make B c adjacent to it.A bag of this kind exists since, by definition, D is a tree decomposition of the torso of B r .We add a new bag containing the elements of σ.This bag is the new root of the obtained decomposition and adjacent to the highest bag in D that contains all elements of σ (in particular, this operation may change which bag of D is highest).The newly constructed nested decomposition is said to be obtained by refining D and denoted by DD,σ .The size of a nested decomposition decreases when it is refined.That means | DD,σ | < | D| holds.We use this property for proofs by induction.
To be able to distinguish original bags and bags from refining decompositions, we could mark the bags of D, which arise from the refinement step.We circumvent the need to mark the bags by assuming that the bags B n with empty D n are exactly the marked ones.In turn, we require from all nested decompositions D we consider that the set of bags B n with empty D n form a connected subtree in D containing the root.

Isomorphism-based ordering of graphs with vertex sequences
In order to define the isomorphism-based ordering for nested decompositions, we review notions related to composed orderings and define an ordering of graphs with given vertex sequences.
Let ≺ be a weak ordering on a set M , and a ≡ a ′ denote that two elements a, a ′ ∈ M are incomparable with respect to ≺.That means, neither a ≺ a ′ nor a ′ ≺ a holds.We define the weak ordering on sequences from M * := ∪ n∈N M n with respect to ≺ as follows.We set a = a 1 . . .a s ≺ a ′ 1 . . .a ′ t = a ′ for a, a ′ ∈ M * if s < t, or s = t and there is an i ∈ [s] with a i ≺ a ′ i while a j ≡ a j holds for every j ∈ [i − 1].The weak ordering on tuples from M 1 × • • • × M k with respect to weak orderings ≺ i for sets M i , respectively, is defined in the same way except that tuples always have the same length.We denote it by ≺ (1,...,k) .We define a weak ordering on finite subsets of M by setting M 1 ≺ M 2 for two finite M 1 , M 2 ⊆ M based on comparing the sequences we get by sorting their elements to be monotonically increasing with respect to ≺.
We write the concatenation of sequences σ and τ as στ .Suppose that (G, σ) and (G ′ , σ ′ ) are pairs consisting of graphs G and G ′ with sequences of vertices σ = v 1 . . .v s and σ with respect to the (standard) ordering < of N. We write (G, σ) ≡ seq (G ′ , σ ′ ) if (G, σ) and (G ′ , σ ′ ) are incomparable with respect to ≺ seq .The ordering ≺ seq is logspace-computable by enumerating all pairs of vertices in lexicographic order of the indices.
Graphs G and G ′ are isomorphic with respect to sequences of vertices σ = v 1 . . .v s and σ ′ = v ′ 1 . . .v ′ t from the respective graphs if s = t and there is an isomorphism ϕ from G to G ′ with ϕ(v i ) = v ′ i for every i ∈ [s].We say that ϕ respects σ and σ ′ in this case.Based on this definition, we also consider canons of graphs with respect to vertex sequences.
Due to the following statement, which we immediately get from the definition, we call ≺ seq an isomorphism-based ordering of graphs with vertex sequences.

Proposition 5.2. Let G and G ′ be graphs with sequences of vertices
from the respective graphs.
-("invariance"-property.) If G and G ′ are isomorphic with respect to σ and σ ′ , then ] are isomorphic with respect to σ and σ ′ .

Isomorphism-based ordering of graphs with nested tree decompositions
We define an ordering of graphs with nested decompositions by recursively ordering the child decompositions and combining this with the root bags.If a root bag has no refining tree decompositions, this is r ′ | = 0, we are dealing with the "decomposition"-case.Let c i be a child of r and consider the (isomorphic) child c ′ j = ψ(c i ) of r ′ .Moreover, consider an ordering τ ∈ Π(c i ) and the (isomorphic) ordering τ ′ = ϕ(τ ) ∈ Π(c ′ j ).By construction of τ and τ ′ we know (G, στ ) ≡ seq (G ′ , σ ′ τ ′ ) and by applying the induction hypothesis we also know (G i , Di , τ ) ≡ dec (G ′ j , D′ j , τ ′ ).Since this observation holds for all children c i of r and all τ ∈ Π(c i ), we have (G, D, σ) ≡ dec (G ′ , D′ , σ ′ ). If we deal with the "refinement"-case.We know that there exists a bijection π = π r from D r to D ′ r ′ , such that ϕ restricted to the vertices from B r and B ′ r ′ respects every pair of tree decompositions D ∈ D r and π(D) ∈ D r ′ via some isomorphism ψ D .We claim that G and G ′ are also isomorphic with respect to each pair of refined nested decompositions DD,σ and Dπ(D),σ ′ as well as ordered root sets σ and σ ′ .Since the size of nested decompositions decreases when refining them, this claim implies (G, D, σ) ≡ dec (G ′ , D′ , σ ′ ) by induction.To prove it, we start to use the above isomorphism ϕ from G to G ′ .We construct an isomorphism ρ from the tree T D,σ underlying DD,σ to the tree T ′ π(D),σ ′ underlying D′ π(D),σ ′ as follows.The newly established root node of T D,σ , whose bag is consists of the vertices of σ, is mapped to the newly established root node of T ′ π(D),σ ′ , whose bag is consist of the vertices of σ ′ .Every other node is mapped according to either ψ or ψ D depending on whether it is a tree node of either D or D, respectively.The only property we need to show is that ρ preserves the newly established edges, which lie between nodes from D and D as well as nodes from π(D) and D′ .Let m be a node of D that gets connected to a node c of D during the refinement process.Then m is the highest bag that contains all vertices of B r ∩ B c .Due to the definition of ψ and ψ D , we know that ψ D (m) is a bag in π(D) that contains all vertices of B ψ(r) ∩ B ψ(c) .Thus, there is also an edge from ψ D (m) to ψ(c) in D′ π(D),σ ′ .This proves the claim.(Proof of the "quasi-completeness"-property.)For this direction, assume we are in the "recursive"-comparison.Thus, we can choose a bijection π from By induction, we can choose for each i ∈ [s] orderings τ i ∈ Π(c i ) and τ ′ π(i) ∈ Π(c π(i) ), such that there is an isomorphism from the graph G i decomposed by Di to the graph G ′ π(i) decomposed by D′ π(i) that respects τ i and τ ′ π(i) .If subgraphs G i and G j of G that correspond to child decompositions Di and Dj , respectively, contain a common vertex, then this vertex appears in σ.Moreover, the same property holds for the same kind of subgraphs of G and σ ′ .Since (G, στ i ) ≡ seq (G ′ , σ ′ τ ′ π(i) ), the mapping of common vertices agrees with the isomorphisms chosen for G i and G j .Thus, we can find a common extension to map G to G ′ that respects σ and σ ′ . If Since the size of nested decompositions decreases when refining them, we know by induction that G and G ′ are isomorphic with respect to σ and σ ′ .
Remark 5.4.The ordering ≺ dec is defined in order to satisfy the "quasi-completeness"-property stated in Lemma 5.3, but not a "completeness"-property saying that (G, D, σ) ≡ dec (G ′ , D′ , σ ′ ) implies that G and G ′ are isomorphic with respect to σ and σ ′ as well as D and D′ , too.The reason behind this lies in the fact that deciding an ordering of this kind for nested decompositions of a bounded width is as hard as the (general) graph isomorphism problem.(In fact, this even holds in the case of, more restrictive, p-bounded decompositions as defined in Section 6.)This can be seen by the following reduction.Take two graphs G and H for which we want to know whether they are isomorphic.Consider now two (empty) graphs decomposition by starting with a single bag B = V (G ′ ).Then, for each edge {v, w} ∈ E(G), construct a refining decomposition whose tree is a star graph where the center bag equals {v, w} and the adjacent bags each contain a single vertex of G ′ .The nested decomposition for H ′ is constructed in the same way.Since the refining decompositions exactly encode the edges of the respective graphs, G and H are isomorphic exactly if G ′ and H ′ are isomorphic with respect to their nested decompositions.Thus, if ≡ dec were defined as to be in exact correspondence with isomorphisms respecting nested decompositions, then deciding whether G ′ ≡ dec H ′ would be graph isomorphism complete even on graphs without edges.

Computing the ordering for nested tree decompositions
We now investigate methods to space-efficiently evaluate the isomorphism based ordering described in the previous section.The nested decompositions we are working with always have a bounded width.This makes it possible to implement the "recursive"-comparison of the isomorphism-based ordering spaceefficiently.If the child decompositions are small enough (more precisely, they are smaller by a constant fraction in comparison to their parent), then it is possible to store a constant amount of information, and in particular to store orderings of the size-bounded root bag, before descending into recursion, without exceeding a desired logarithmic space bound.If there is a large child decomposition, of which there can be only one, then we can use Lindell's classic technique of precomputing the recursive information before storing anything at all.However, for the "refinement"-comparison, a space-efficient approach turns out to be more challenging.In this case, the ordering asks us to compare various refinements of the root bag.Cycling through these refinements as part of a recursive approach requires too much space, even if the number of decompositions is bounded by a polynomial in the size of the root bag.While it is not clear how to remedy this difficult in general, the nested decompositions we construct in the proofs of our main theorems satisfy an additional technical condition, called p-boundedness below.This makes it possible to find a trade-off between the recursive space requirement and the space required for cycling through the refinements.
Let D be a nested decomposition.Consider a bag n with |D n | > 1.Let c 1 , . . ., c t be the children of n sorted by monotonically decreasing size of the respecting subdecompositions D 1 , . . ., D t .If it exists, let j ∈ [t] be maximal such that G[A n ] with is a clique, and |D j | > |D j+1 | holds or j = t holds.Otherwise, set j := 0 and A n := ∅.We call the children c 1 , . . ., c j of n the special children and A n is the attachment clique of the special children.A nested decomposition D is p-bounded for a polynomial p : N → N if for every n ∈ V (T ) and non-special child c of n we have |D n | ≤ p(| D|/| Dc |).For non-special nodes we use the p-boundedness condition to trade the number of candidate refining decompositions against the size of subdecompositions.This enables an overall space-efficient recursion.In Section 6.1 we review a technique of Lindell [22] used to compute (composed) weak orderings on sets space-efficiently.Section 6.2 contains the proof of Lemma 6.1.

Comparing sets via cross comparing elements
We repeatedly apply a technique of Lindell [22] to compare two sets A and A ′ with respect to a weak ordering ≺ defined for their elements.Comparing A and A ′ is performed by repeatedly comparing a single element of A with a single element of A ′ .Such a comparison is called a cross comparison.To apply the technique subsequently, we state it as an abstract fact as follows.Let ≺ be a weak ordering for elements of a set M and A, A ′ ⊆ M finite subsets of M .The cross comparison matrix of A = {a 1 , . . ., a s } and Fact 6.2.Let ≺ be a weak ordering of elements of a set M .There is a logspace that, given the cross comparison matrix C A,A ′ for sets A, A ′ ⊆ M (which are not part of the input), decides A ≺ A ′ .
To apply Fact 6.2, it is important to observe that inputs to its consist only of the cross comparison matrix without encodings of the sets A and A ′ .Thus, the space used by the machine is in O(log(|A| • |A ′ |)).The fact can be used to build an algorithm for comparing sets on top of an algorithm for comparing individual elements.Proposition 6.3.Let ≺ be a weak ordering of elements of a set M that can be decided by a in space at most s(a, a ′ ) for every a, a ′ ∈ M .There is a that, given sets We apply the proposition in a scenario where the weak ordering ≺ is partially known: A weak ordering ≺ ′ is coarser than a weak ordering ≺ if a 1 ≺ ′ a 2 implies a 1 ≺ a 2 .In our application, the weak ordering ≺ ′ compares nested subdecompositions based on their sizes, which can be done during a logspace reduction before the more challenging recursive computation starts.

Proof of Lemma 6.1
A child decomposition Di of a nested decomposition D is large if | Di | > | D|/2; the size bound implies that every nested decomposition has at most one large child.
Proof of Lemma 6.1.The logspace procedure (•, •) we design implements the recursive definition of ≺ dec .To streamline the recursion, it is more convenient to perform a computational task that is slightly more general than the one required by the lemma.On input of graphs G and G ′ with nested tree decompositions D and D′ and unordered root sets M and M ′ (not ordered root sets σ and σ ′ as described by the lemma), the output of ((G, D, M ), (G ′ , D′ , M ′ )) is the cross comparison matrix of the sets {(G, D, σ) | σ is an ordering of M } and {(G ′ , D′ , σ ′ ) | σ ′ is an ordering of M ′ } with respect to ≺ dec .
The recursive procedure starts at the root bags of both decompositions and descends into them in order to compute the recursively-defined ordering.To have access to the current positions in the decompositions, we do not use a stack, but maintain node pointers to the current node and the previous node of the recusive process in each decomposition.These pointers direct us to nodes from the coarser, nested decompositions as well as to nodes from refining decompositions.They only require a logarithmic amount of space.In order to be able to reconstruct vertex sequences as well as already refined parts of the decomposition, we store sequences of vertices in a bag relative to the bag using the pointers.Thus, to store an ordering of a bag of bounded size we only require a constant amount of space, provided we have the pointer to the bag at hand.
To analyze the space requirement apart from these pointers, we use two separate tapes.A decomposition tape is used to store data related to the "recursive"-comparison and a refinement tape is used to store data related to the "refinement"-comparison.We prove separately for each tape that the used space is bounded by O(log(| D| + | D′ |)).
The procedure closely follows the definition of the isomorphism-based ordering and, in particular, distinguishes the same cases.
("size"-comparison.)By counting refining decompositions and nodes in decompositions, we can de- The descent into the large children can be performed without storing data on the decomposition tape by just updating the node pointers.The comparison matrix of (constant) size s large ∈ O((k!) 2 ) is stored on the decomposition tape.
After handling large children, we continue to compare {((G i , Di , τ ), στ with respect to ≺ (dec,seq) .In order to apply Proposition 6.3 with a smaller space requirement, we we first define a weak order ≺ ′ (dec,seq) that is coarser than ≺ (dec,seq) by setting Ordering the child decompositions with respect to ≺ can now be done by first ordering with respect to ≺ ′ with higher priority and, then, applying the cross comparison idea behind Proposition 6.3 to pairs whose child decompositions are of the same size.Moreover, we do not need to recurse on large children.Note that in order to compare {((G i , Di , τ ), στ } with respect to ≺ (dec,seq) it suffices to know the result of the call ((G i , Di , N ), (G ′ j , D′ j , N ′ )) where N and N ′ denote the unordered sets of the ordered root sets in Π(c i ) and Π(c ′ j ), respectively.We investigate the space requirement of the method.We first observe that there are at most ℓ ≤ | D|/m child decompositions of size m.Moreover m ≤ | D|/2 for non-large children and, thus, m ≤ min{| D|/2, | D|/ℓ}.By Fact 6.2, we can compare sets of size at most ℓ using O(log(ℓ 2 )) space, plus the space required for the recursion, which is at most O(min{log(| D|/2), log(| D|/ℓ)}) by induction.The current orderings σ and σ ′ are stored using space s stack ∈ O((k!) 2 ) on the decomposition tape.(Recall that sequences are stored relative to pointers to nodes of the decomposition as described above.)Defining s dec (n) to be the space requirement for the recursive comparison of decompositions of size n where s dec (1) depends on the constant k, we have we need to describe how our procedure handles the recursive refinement of the root bag.In the simplest case, if |D r | = |D ′ r ′ | = 1 holds, we choose the unique refinement and recurse without using any space on the refinement tape.If there are multiple refining decompositions for the roots, we first handle the special children before taking refining decompositions into account.
For the special children, we compute and store all information about comparisons between them that might ever be required subsequently as follows.Let C and C ′ be the attachment cliques of the special child decompositions of D and D′ , respectively.Consider arbitrary P ⊆ pow(C) and P ′ ⊆ pow(C ′ ), where pow(•) is the power set operator.Let τ be an ordering of C and τ ′ be an ordering of C ′ .Given τ and τ ′ , we want to compare the special children whose adhesion set is in P or P ′ .Let Z P = (G P , DP , C) be defined as follows.G P is the subgraph of G induced by the vertices in C and all vertices contained in a special child of D with an adhesion set in P and DP is the decomposition of G P obtained by replacing the root of D with the set C and out of the child decompositions of the root only maintaining the special child decompositions with adhesion sets in P .Note that Z P is a graph with a nested decomposition and unordered root set.We define Z ′ M ′ similarly for G ′ .With this definition we compute and store all cross comparison matrices (Z P , Z ′ P ′ ) for all choices of P ⊆ pow(C) and P ′ ⊆ pow(C ′ ).Since the sets have only bounded size, the entire outcome of the computation can be stored using (constant) space s clique ∈ O(2 2 k k!).This outcome will be stored on the refinement tape.We argue that all of this information can be computed recursively without exceeding the logarithmic space bound.Indeed, there is at most one large child decomposition DL of D with graph G L and at most one large child decomposition D′ L of D′ with graph G ′ L .Before using any space, we first compute the recursive call , where M L and M ′ L are the unordered root sets of DL and D′ L , respectively.The result is stored using a constant amount of space on the refinement tape.We then compute for all choices of P ⊆ pow(C) and P ′ ⊆ pow(C ′ ) the result of (Z P , Z ′ P ′ ).Recall that s clique denotes the amount of refinement space required to store the entire outcome.Since the size of every non-large child decompositions of Z P is at most | D|/2, we obtain a recursion for the space satisfying Having computed (Z P , Z ′ P ′ ) for all choices of P ⊆ pow(C) and P ′ ⊆ pow(C ′ ) our goal is now to compare the sets )} for all orderings σ and σ ′ of M and M ′ , respectively.Using Fact 6.2 we can compare these sets using space, which we will write on the refinement tape, in addition to the recursive space required to compare two elements (G, DD,σ , σ) and (G, DD ′ ,σ ′ , σ ′ ).For two such elements, whenever we would go into recursion, if a recursive result is contained in the precomputed information for special children, we will not go into recursion and rather use the precomputed information.Note that this means that we will never have to recursively descend into a special child of D or D′ again.This observation uses the fact that in D the set of bags n with |D n | > 0 (and similarly in D′ ) forms a connected subtree containing the root.
For the refinement space consumption we now note the following.Since comparisons of special children are precomputed, due to the p-boundedness for every subsequent recursive call, the size of the decompositions of the recursive call is at most max{| D|/|D r |, | D′ |/|D ′ r ′ |}.Thus, we obtain the recursive space requirement of Thus, the total space requirement of our procedure is logarithmic.

Testing isomorphism and canonizing bounded tree width graphs
We show how to compute isomorphism-invariant width-bounded and p-bounded nested decompositions for graphs of bounded tree width and, then, apply this to prove Theorems 1.1 and 1.2.
To compute nested decompositions, we combine the decomposition into atoms described in Section 3 with the decomposition of atoms into width-bounded tree decompositions described in Section 4. Lemma 7.1.For every k ∈ N, there is a k ′ ∈ N, a polynomial p : N → N, and a logspace-computable and isomorphism-invariant mapping that turns every graph G of tree width at most k into a nested decomposition D for G that 1. has width at most k ′ , and 2. is p-bounded.
Proof.Instead of the original input graph G, we work with its improved version, which we can compute in logspace since the tree width of G is bounded by k.Mapping the input graph to its improved version is isomorphism-invariant and the improved version has exactly the same tree decompositions.In the following, we denote the improved version of the input graph by G.
Let D = (T, B) be the isomorphism-invariant tree decomposition we get from G by applying Lemma 3.1.Since the lemma guarantees that in D the adhesion sets are cliques, the torso of each bag is equal to the bag itself.To turn D into a nested decomposition if thus suffices to find a family of tree decompositions of width at most k for each bag.We will apply Lemma 4.1 to find such a family.Since D decomposes an improved graph and the adhesion sets are cliques, every G[B n ] for n ∈ V (T ) is also improved.
Thus, based on D, we construct a nested decomposition D by considering every node n of D and defining an isomorphism-invariant family D n of tree decompositions of the bag B n .If B n has size at most k + 1, we let the family D n consist of a single tree decomposition that is just B n .Note that by this choice, the bag B n satisfies both the width bounded and the p-boundedness restriction (for every polynomial p with p(i) ≥ 1 for all i ∈ N).If the size of B n exceeds k + 1, we would like to apply Lemma 4.1 to further decompose B n .However, for the lemma, we need a pair {u, v} / ∈ E(G) in B n to serve as the root of the decomposition.We cannot simply iterate over all {u, v} / ∈ E(G) in B n since the result may violate the p-boundedness condition.We proceed as follows.Let c 1 , . . ., c t be the children of n sorted by decreasing size of the respecting child decompositions D c 1 , . . ., D ct .If it exists, let j ∈ [t] be the maximum, such that G[A n ] with is a clique, and |D c j | > |D c j+1 | holds or j = t holds.Otherwise, set j := 0 and A n := ∅.Thus, A n is the attachment clique of the special children as defined above.We construct a collection of tree decompositions D n for B n based on whether we have j < t or j = t.We have assembled all the required tools to prove our main theorems showing that isomorphism of graphs of bounded tree width and canonization of graphs of bounded tree width can be performed in logarithmic space.
Proof of Theorem 1.1.Given two graphs G and G ′ , by Lemma 7.1 we can compute in logarithmic space isomorphism-invariant p-bounded nested decompositions D and D′ .By Lemma 5.3, the graphs are isomorphic if and only if there exist ordered root sets σ and σ ′ with (G, D, σ) ≡ dec (G ′ , D′ , σ ′ ).By Lemma 6.1, this can be checked in logarithmic space by iterating over all suitable choices of σ and σ ′ .
The L-hardness for every positive k ∈ N follows from the L-hardness of the isomorphism problem for trees (connected graphs of tree width at most 1) proved by Jenner et al. [18].
For our canonization procedure we would like to recursively order the vertices according to ≺ dec .However, due to the fact that there is no exact correspondence between ≺ dec and isomorphism for graphs with nested decompositions and ordered root sets (recall Remark 5.4 and that we only have a "quasicompleteness"-property not a "completeness"-property), we need to ensure that the process is canonical.However, as the following proof shows, to ensure canonicity it is sufficient to work with an isomorphisminvariant decomposition.
Proof of Theorem 1.2.We use the isomorphism-invariant mapping from Lemma 7.1 to turn G into a width-bounded and p-bounded nested decomposition D = (T, B, D).The canonical sequence of G's vertices is based on (G, D, σ) where σ is the empty vertex sequence.In order to compute a canonical sequence with respect to ≺ dec , we repeatedly apply Lemma 6.1.
Ties are broken arbitrarily, for example by considering the smallest vertex in the child according to the input ordering.For each child Di we compute an ordering τ i ∈ Π(c i ) that minimizes (G i , Di , τ i ).We recursively create a canonical sequence outputting the canonical sequence of (G i , Di , τ i ) for each child in the order of children just defined.
If |D r | > 0, we iterate over all decompositions in D r and choose a tuple from {(G, DD,σ , σ) | D ∈ D B )} that is minimal with respect to ≺ dec .Ties are, again, broken based on the input ordering.For computing the canonical sequence we continue recursively on a minimal (G, DD,σ , σ) only.In order to obtain a canonical sequence, we alter the nested decomposition slightly whenever we go into the recursion using colored edges.More specifically, Lemma 7.1 constructs D based on two vertices u and v that form a distinguished non-edge.We insert an edge between u and v and color it with a color that does not appear in G (for example, we use −2).In other words, we set col G (u, v) = −2.This modification is isomorphism-invariant based on the choice of D. The new edge is covered by a bag of D by construction.Inserting the edge only depends on D and, thus, it is stored recursively in an implicit way.The modification has the consequence that distinguished edges are preserved under isomorphism.
The logspace-computability of the sequence follows from Lemma 6.1.Thus, we are left to prove that the sequence is canonical.For this we need to show that whenever a tie is broken arbitrarily between two options, then the two options are equivalent.There are two situations when a tie can occur.
For the first one suppose {(G i , Di , τ ), (G, στ ) | τ ∈ Π(c i )} ≡ (dec,seq) {((G j , Dj , τ ), (G, στ )) | τ ′ ∈ Π(c j )} for two child decompositions both containing a vertex not in σ.By Lemma 5.3, there is an isomorphism from the graph induced by the vertices in Di to the graph induced by the vertices in Dj fixing σ.This extends to an automorphism of G by fixing all vertices neither in Di nor Dj .Since D is isomorphism-invariant this automorphism respects D therefore mapping Di to Dj .
For the other case where a tie can occur, suppose (G i , ( Di ) D,σ , σ) ≡ (dec,seq) ((G j ), ( Dj ) D ′ ,σ , σ).By Lemma 5.3, there is an isomorphism from G i to G j .This isomorphism preserves the distinguished edge.This isomorphism extends to an automorphism of G that fixes all vertices that neither appear in ( Di ) D,σ nor in ( Dj ) D ′ ,σ .Since D is isomorphism-invariant, this automorphism of G respects D and since the distinguished edge is preserved it maps ( Di ) D,σ to ( Dj ) D ′ ,σ .
This shows that the computed sequence is canonical.
be done in logspace for graphs of bounded tree width.For the proof we first developed a tree decomposition into clique-separator-free subgraphs that is isomorphism-invariant and logspace-computable.Then we showed how to compute, for each bag, an isomorphism-invariant family of width-bounded tree decompositions in logspace.Finally, we combined both decomposition approaches to construct nested tree decompositions and developed a recursive canonization procedure that works on nested tree decompositions.
Outlook.Testing for graphs that are embeddable into the plane [7] as well as any fixed surface [11] can be done in logspace.These graph classes can be described in terms of forbidding fixed minors, which also holds for classes of graphs whose tree width is bounded by constants.This opens up the question of whether these logspace results generalize to any class of graphs excluding fixed minors.For these classes polynomial-time procedures are known [27].Partial results are known for graphs that exclude the minors K 5 or K 3,3 [8], but the available techniques are tailored to the respective graph Looking at algorithmic proofs related to the structure of graphs excluding fixed minors [14,15], it seems promising to combine the earlier logspace approach for embeddable graphs [11] with our logspace approach for bounded tree width graphs.
Of course, the basic question concerning the complexity of on general graphs remains open.With respect to this question, our work might help to clarify the difference between graphs to which the best known complexity-theoretic lower bounds for [32] apply, which are given in terms of classes defined via nondeterministic logarithmic-space-bounded Turing machines, and graphs for which (deterministic) logspace algorithms are possible.
Tree decompositions.A (tree) decomposition D = (T, B) of a graph G is a tree T together with a family of bags B = (B n ) n∈V (T ) with B n ⊆ V (G) for each n ∈ V (T ), such that -(connectedness property) for each vertex v ∈ V (G) the induced subtree T {n ∈ V (T ) | v ∈ B n } is nonempty and connected, and -(covering property) for each edge {u, v} ∈ E(G) there is a node n ∈ V (T ) with {u, v} ⊆ B n .For every edge {n, m} ∈ E(T ), B {n,m} := B n ∩ B m is the adhesion set between nodes n and m.

Lemma 3 . 8 .
For every positive c ∈ N and (c − 1)-atom G, (T c (G), B c (G)) is a tree decomposition for G.Moreover, T c (G) has a unique center.

Lemma 3 . 9 .
For every d, c ∈ N, with d < c, there is a logspace that, given a d-atom G, outputs a tree decomposition D = (T, B) 1. whose bags are c-atoms, 2. whose adhesion sets are cliques, and 3. where the mapping is isomorphism-invariant.Proof.We show the lemma by induction on c − d.If c − d = 0, then the c-atom G is the unique bag of the tree decomposition D, which satisfies all requirements of the lemma.If c − d > 0, we construct and prove the correctness of the constructed tree decomposition as follows.(Construction.)We use Lemma 3.8 to construct a tree decomposition D ′ = (T ′ , B ′ ) whose bags are the graph's (d + 1)-atoms and minimum clique separators.Applying the induction hypothesis, we compute for each (d + 1)-atom A an isomorphism-invariant tree decomposition D A = (T A , B A ) into its c-atoms.We continue combining D ′ with the decompositions D A to construct D = (T, B).We use nodes V (T ) := {(B, A) | B ∈ V (T A ) and A ∈ V (T ′ )} for T .Two nodes (B 1 , A 1 ) and (B 2 , A 2 ) of T are adjacent if (1) A 1 = A 2 and B 1 and B 2 are adjacent in D A 1 , or (2) A 1 and A 2 are adjacent in T and for each i ∈ {1, 2}, B i contains A 1 ∩ A 2 and is closest to the root with this property in D A i .To each node of (B, A) of T , B assigns the bag B (B,A) = B.
(A, B) for X and Y of minimum size and (inclusion-wise) minimal A. We denote it by (A X , B Y ) and set sep(X, Y ) := A X ∩ B Y .Exactly the same property holds when considering vertices x, y ∈ V (G).In this case we denote the corresponding separation by (A x , B y ), and set sep(x, y) := A x ∩B y .We use these separations to define the separator sep s (G, I) of a graph with interface (G, I) with respect to a threshold value s ∈ N: If |I| ≤ s, we set sep s (G, I) := I ∪ x,y∈I, x =y, and κ G (x,y)≤tw(G) sep(x, y), and sep s (G, I) := I ∪ X,Y ⊆I, X∩Y =∅, |X|=|Y |=tw(G)+1, and κ G (X,Y )≤tw(G)

Proposition 4 . 2 .
For every k ∈ N, there is a logspace that, given a graph with interface (G, I) where tw(G) ≤ k and s ∈ N, outputs sep s (G, I).The following fact on size bounds for separators and neighborhoods follows from the statements and proofs of[24, Lemmata 3.3 and 3.4].

Fact 4 . 3 .
There are functions small ∈ O(k), medium ∈ O(k 3 ), and large ∈ O(2 k log k ) with the following properties: Let (G, I) be a graph with interface, such that tw(G) ≤ k, G is improved and an atom such that 1. G[I] is not a clique, and 2. |I| ≤ medium(tw(G)).Moreover, let S := sep small(tw(G)) (G, I).Then S \ I = ∅, |S| ≤ large(tw(G)), and for every component C i of G \ S with its graph with interface unordered) root set M of a nested decomposition D = (T, B, D) is a subset M ⊆ B r of the root bag B r of D with (1) M = B r in case |D r | = 0, and (2) every D ∈ D r has a bag B with M ⊆ B in case |D r | > 0. An ordered root set σ is an ordering of an unordered root set.

Proposition 5 . 1 .
The mapping that turns a nested decomposition D = (T, B, D) with decomposition D ∈ D r and an ordered root set σ into DD,σ is logspace-computable and isomorphism-invariant.

Lemma 6 . 1 .
For every k ∈ N and polynomial p : N → N, there is a logspace that, on input of graphs G and G ′ along with respective nested decompositions D and D′ and ordered root sets σ and σ ′ where D and D′ 1. have width at most k, and 2. are p-bounded, decides (G, D, σ) ≺ dec (G ′ , D′ , σ ′ ).
termine whether | D| = | D′ | or |D r | = |D ′ r ′ | and in either case directly decide (G, D, σ) ≺ dec (G ′ , D′ , σ ′ ) for all orderings σ and σ ′ of M and M ′ , respectively.("bag"-comparison.)If | D| = | D′ | = 1 (and, thus, |D r | = |D ′ r ′ | = 0), we decide (G, D, σ) ≺ dec (G ′ , D′ , σ ′ ) for all orderings σ and σ ′ of M and M ′ , respectively, based on the definition of ≺ seq in logspace.("recursive"-comparison.)If | D| = | D′ | > 1 and |D r | = |D ′ r ′ | = 0, we handle large and non-large children differently.If D has a large child decomposition Di and D′ has a large child decomposition Dj , we first compute the comparison matrix of the sets { If j < t, let m ≥ 1 be the largest integer with |D c j+1 | = |D c j+m |.By construction, we can find at least one and at most ((k + 1)(m + 1)) 2 pairs of nonadjacent vertices {u, v} in G[A ′ n ] forA ′ n := A n ∪ (B n ∩ B c j+1 ) ∪ • • • ∪ (B n ∩ B c j+m ) .We define D n to be the collection of tree decompositions we obtained by applying Lemma 4.1 to G[B n ] with pairs {u, v} of nonadjacent vertices in G[A ′ n ].We have |D n | ≤ ((k + 1)(m + 1)) 2. This set of decompositions satisfies the p-boundedness restriction with the polynomial p(m) = ((k + 1)(m + 1))2 .If j = t, we consider every pair of nonadjacent vertices {u, v} in B n .Again, for every such {u, v}, we construct a decomposition for G[B] using Lemma 4.1.We have 1 ≤ |D n | ≤ |B n | 2 in this case, satisfying the p-boundedness condition, since B n only has special children.Since the construction of the collections D n is isomorphism-invariant, the entire construction is isomorphism-invariant.