Stacks and queues are fundamental data structures in computer science. But what is more powerful, a stack or a queue? In 1992, Heath et al.  developed a graph-theoretic formulation of this question, where they defined the graph parameters stack-number and queue-number which respectively measure the power of stacks and queues to represent a given graph. Intuitively speaking, if some class of graphs has bounded stack-number and unbounded queue-number, then we would consider stacks to be more powerful than queues for that class (and vice versa). It is known that the stack-number of a graph may be much larger than the queue-number. For example, Heath et al.  proved that the -vertex ternary Hamming graph has queue-number at most and stack-number at least . Nevertheless, it is open whether every graph has stack-number bounded by a function of its queue-number, or whether every graph has queue-number bounded by a function of its stack-number [60, 49].
Planar graphs are the simplest class of graphs where it is unknown whether both stack and queue-number are bounded. In particular, Buss and Shor  first proved that planar graphs have bounded stack-number; the best known upper bound is 4 due to Yannakakis . However, for the last 27 years of research on this topic, the most important open question in this field has been whether planar graphs have bounded queue-number. This question was first proposed by Heath et al.  who conjectured that planar graphs have bounded queue-number.111Curiously, in a later paper, Heath and Rosenberg  conjectured that planar graphs have unbounded queue-number. This paper proves this conjecture. Moreover, we generalise this result for graphs of bounded Euler genus, and for every proper minor-closed class of graphs.222The Euler genus of the orientable surface with handles is . The Euler genus of the non-orientable surface with cross-caps is . The Euler genus of a graph is the minimum integer such that embeds in a surface of Euler genus . Of course, a graph is planar if and only if it has Euler genus 0; see  for more about graph embeddings in surfaces. A graph is a minor of a graph if a graph isomorphic to can be obtained from a subgraph of by contracting edges. A class of graphs is minor-closed if for every graph , every minor of is in . A minor-closed class is proper if it is not the class of all graphs. For example, for fixed , the class of graphs with Euler genus at most is a proper minor-closed class.
First we define the stack-number and queue-number of a graph . Let and respectively denote the vertex and edge set of . Consider disjoint edges in a linear ordering of . Without loss of generality, and and . Then and are said to cross if and are said to nest if . A stack (with respect to ) is a set of pairwise non-crossing edges, and a queue (with respect to ) is a set of pairwise non-nested edges. Stacks resemble the stack data structure in the following sense. In a stack, traverse the vertex ordering left-to-right. When visiting vertex , because of the non-crossing property, if are the neighbours of to the left of in left-to-right order, then the edges will be on top of the stack in this order. Pop these edges off the stack. Then if are the neighbours of to the right of in left-to-right order, then push onto the stack in this order. In this way, a stack of edges with respect to a linear ordering resembles a stack data structure. Analogously, the non-nesting condition in the definition of a queue implies that a queue of edges with respect to a linear ordering resembles a queue data structure.
For an integer , a -stack layout of a graph consists of a linear ordering of and a partition of into stacks with respect to . Similarly, a -queue layout of consists of a linear ordering of and a partition of into queues with respect to . The stack-number of , denoted by , is the minimum integer such that has a -stack layout. The queue-number of a graph , denoted by , is the minimum integer such that has a -queue layout. Note that -stack layouts are equivalent to -page book embeddings, first introduced by Ollmann , and stack-number is also called page-number, book thickness, or fixed outer-thickness.
Stack and queue layouts are inherently related to depth-first search and breadth-first search respectively. For example, a DFS ordering of the vertices of a tree has no two crossing edges, and thus defines a 1-stack layout. Similarly, a BFS ordering of the vertices of a tree has no two nested edges, and thus defines a 1-queue layout. Hence every tree has stack-number 1 and queue-number 1.
As mentioned above, Heath et al.  conjectured that planar graphs have bounded queue-number. This conjecture has remained open despite much research on queue layouts [93, 31, 49, 60, 61, 59, 80, 84, 43, 47, 46, 44, 2, 11, 30]. We now review progress on this conjecture.
Pemmaraju  studied queue layouts and wrote that he “suspects” that a particular planar graph with vertices has queue-number . The example he proposed had treewidth 3; see Section 2.2 for the definition of treewidth. Dujmović et al.  proved that graphs of bounded treewidth have bounded queue-number. So Pemmaraju’s example in fact has bounded queue-number.
The first bound on the queue-number of planar graphs with vertices was proved by Heath et al. , who observed that every graph with edges has a -queue layout using a random vertex ordering. Thus every planar graph with vertices has queue-number , which can also be proved using the Lipton-Tarjan separator theorem. Di Battista et al.  proved the first breakthrough on this topic, by showing that every planar graph with vertices has queue-number . Dujmović  improved this bound to with a simpler proof. Building on this work, Dujmović et al.  established (poly-)logarithmic bounds for more general classes of graphs. For example, they proved that every graph with vertices and Euler genus has queue-number , and that every graph with vertices excluding a fixed minor has queue-number .
Recently, Bekos et al.  proved a second breakthrough result, by showing that planar graphs with bounded maximum degree have bounded queue-number. In particular, every planar graph with maximum degree has queue-number at most . Subsequently, Dujmović et al.  proved that the algorithm of Bekos et al.  in fact produces a -queue layout. This was the state of the art prior to the current work.333Wang  claimed to prove that planar graphs have bounded queue-number, but despite several attempts, we have not been able to understand the claimed proof.
1.1 Main Results
The fundamental contribution of this paper is to prove the conjecture of Heath et al.  that planar graphs have bounded queue-number.
The queue-number of planar graphs is bounded.
The best upper bound that we obtain for the queue-number of planar graphs is .
We extend Theorem 1 by showing that graphs with bounded Euler genus have bounded queue-number.
Every graph with Euler genus has queue-number at most .
The best upper bound that we obtain for the queue-number of graphs with Euler genus is .
We generalise further to show the following:
Every proper minor-closed class of graphs has bounded queue-number.
These results are obtained through the introduction of a new tool, layered partitions, that have applications well beyond queue layouts. Loosely speaking, a layered partition of a graph consists of a partition of along with a layering of , such that each part in has a bounded number of vertices in each layer (called the layered width), and the quotient graph has certain desirable properties, typically bounded treewidth. Layered partitions are the key tool for proving the above theorems. Subsequent to the initial release of this paper, layered partitions have been used for other problems. For example, our results for layered partitions were used by Dujmović et al.  to prove that planar graphs have bounded nonrepetitive chromatic number, thus solving a well-known open problem of Alon et al. . As above, this result generalises for any proper minor-closed class.
The remainder of the paper is organized as follows. In Section 2 we review relevant background including treewidth, layerings, and partitions, and we introduce layered partitions.
Section 3 proves a fundamental lemma which shows that every graph that has a partition of bounded layered width has queue-number bounded by a function of the queue-number of the quotient graph.
In Section 4, we prove that every planar graph has a partition of layered width 1 such that the quotient graph has treewidth at most . Since graphs of bounded treewidth are known to have bounded queue-number , this implies Theorem 1 with an upper bound of . We then prove a variant of this result with layered width 3, where the quotient graph is planar with treewidth 3. This variant coupled with a better bound on the queue-number of treewidth- planar graphs  implies Theorem 1 with an upper bound of .
In Section 5, we prove that graphs of Euler genus have partitions of layered width such that the quotient graph has treewidth . This immediately implies that such graphs have queue-number . These partitions are also required for the proof of Theorem 3 in Section 6. A more direct argument that appeals to Theorem 1 proves the bound in Theorem 2.
In Section 6, we extend our results for layered partitions to the setting of almost embeddable graphs with no apex vertices. Coupled with other techniques, this allows us to prove Theorem 3. We also characterise those minor-closed graph classes with the property that every graph in the class has a partition of bounded layered width such that the quotient has bounded treewidth.
In Section 7, we provide an alternative and helpful perspective on layered partitions in terms of strong products of graphs. With this viewpoint, we derive results about universal graphs that contain all planar graphs. Similar results are obtained for more general classes.
In Section 8, we prove that some well-known non-minor-closed classes of graphs, such as -planar graphs, also have bounded queue-number.
Section 9 explores further applications and connections. We start off by giving an example where layered partitions lead to a simple proof of a known and difficult result about low treewidth colourings in proper minor-closed classes. Then we point out some of the many connections that layered partitions have with other graph parameters. We also present other implications of our results such as resolving open problems on 3-dimensional graph drawing.
Finally Section 10 summarizes and concludes with open problems and directions for future work.
Undefined terms and notation can be found in Diestel’s text . Throughout the paper, we use the notation to refer to a particular linear ordering of a set .
The following well-known definitions are key concepts in our proofs, and that of several other papers on queue layouts [44, 43, 47, 11, 45]. A layering of a graph is an ordered partition of such that for every edge , if and , then . If then is an intra-level edge. If then is an inter-level edge.
If is a vertex in a connected graph and for all , then is called a BFS layering of . Associated with a BFS layering is a BFS spanning tree obtained by choosing, for each non-root vertex with , a neighbour in , and adding the edge to . Thus for each vertex of .
These notions extend to disconnected graphs. If are the components of , and is a vertex in for , and for all , then is called a BFS layering of .
2.2 Treewidth and Layered Treewidth
First we introduce the notion of -decomposition and tree-decomposition. For graphs and , an -decomposition of consists of a collection of subsets of , called bags, indexed by the vertices of , and with the following properties:
for every vertex of , the set induces a non-empty connected subgraph of , and
for every edge of , there is a vertex for which .
The width of such an -decomposition is . The elements of are called nodes, while the elements of are called vertices.
A tree-decomposition is a -decomposition for some tree . The treewidth of a graph is the minimum width of a tree-decomposition of . Treewidth measures how similar a given graph is to a tree. It is particularly important in structural and algorithmic graph theory; see [58, 82, 13] for surveys. Tree decompositions were introduced by Robertson and Seymour ; the more general notion of -decomposition was introduced by Diestel and Kühn .
As mentioned in Section 1, Dujmović et al.  first proved that graphs of bounded treewidth have bounded queue-number. Their bound on the queue-number was doubly exponential in the treewidth. Wiechert  improved this bound to singly exponential.
Lemma 4 ().
Every graph with treewidth has queue-number at most .
Alam, Bekos, Gronemann, Kaufmann, and Pupyrev  also improved the bound in the case of planar 3-trees. The following lemma that will be useful later is implied by this result and the fact that every planar graph of treewidth at most is a subgraph of a planar -tree .
Graphs with bounded treewidth provide important examples of minor-closed classes. However, planar graphs have unbounded treewidth. For example, the planar grid graph has treewidth . So the above results do not resolve the question of whether planar graphs have bounded queue-number.
Dujmović et al.  and Shahrokhi  independently introduced the following concept. The layered treewidth of a graph is the minimum integer such that has a tree-decomposition and a layering such that for every bag and layer . Applications of layered treewidth include graph colouring [44, 72, 66], graph drawing [44, 10], book embeddings , and intersection graph theory . The related notion of layered pathwidth has also been studied [39, 10]. Most relevant to this paper, Dujmović et al.  proved that every graph with vertices and layered treewidth has queue-number at most . They then proved that planar graphs have layered treewidth at most 3, that graphs of Euler genus have layered treewidth at most , and more generally that a minor-closed class has bounded layered treewidth if and only if it excludes some apex graph.444A graph is apex if is planar for some vertex . This implies bounds on the queue-number for all these graphs, and was the basis for the bound for proper minor-closed classes mentioned in Section 1.
2.3 Partitions and Layered Partitions
The following definitions are central notions in this paper. A vertex-partition, or simply partition, of a graph is a set of non-empty sets of vertices in such that each vertex of is in exactly one element of . Each element of is called a part. The quotient (sometimes called the touching pattern) of is the graph, denoted by , with vertex set where distinct parts are adjacent in if and only if some vertex in is adjacent in to some vertex in .
A partition of is connected if the subgraph induced by each part is connected. In this case, the quotient is the minor of obtained by contracting each part into a single vertex. Our results for queue layouts do not depend on the connectivity of partitions. But we consider it to be of independent interest that many of the partitions constructed in this paper are connected. Then the quotient is a minor of the original graph.
A partition of a graph is called an -partition if is a graph that contains a spanning subgraph isomorphic to the quotient . Alternatively, an -partition of a graph is a partition of indexed by the vertices of , such that for every edge , if and then (and is called an intra-bag edge) or (and is called an inter-bag edge). The width of such an -partition is . Note that a layering is equivalent to a path-partition.
A tree-partition is a -partition for some tree . Tree-partitions are well studied with several applications [34, 35, 97, 90, 14]. For example, every graph with treewidth and maximum degree has a tree-partition of width ; see [97, 34]. This easily leads to a upper bound on the queue-number . However, dependence on seems unavoidable when studying tree-partitions , so we instead consider -partitions where has bounded treewidth greater than 1. This idea has been used by many authors in a variety of applications, including cops and robbers , fractional colouring [83, 89], generalised colouring numbers , and defective and clustered colouring . See [36, 37] for more on partitions of graphs in a proper minor-closed class.
A key innovation of this paper is to consider a layered variant of partitions (analogous to layered treewidth being a layered variant of treewidth). The layered width of a partition of a graph is the minimum integer such that for some layering of , each part in has at most vertices in each layer .
Throughout this paper we consider partitions with bounded layered width such that the quotient has bounded treewidth. We therefore introduce the following definition. A class of graphs is said to admit bounded layered partitions if there exist such that every graph has a partition with layered width at most such that has treewidth at most . We first show that this property immediately implies bounded layered treewidth.
If a graph has an -partition with layered width at most such that has treewidth at most , then has layered treewidth at most .
Let be a tree-decomposition of with bags of size at most . Replace each instance of a vertex of in a bag by the part corresponding to in the -partition. Keep the same layering of . Since , we obtain a tree-decomposition of with layered width at most . ∎
Lemma 6 means that any property that holds for graphs of bounded layered treewidth also holds for graphs that have a partition of bounded layered width, where the quotient graph has bounded treewidth. For example, Norin proved that every -vertex graph with layered treewidth at most has treewidth less than (see ). With Lemma 6, this implies that if an -vertex graph has a partition with layered width such that the quotient graph has treewidth at most , then has treewidth at most . This in turn leads to balanced separator theorems for such graphs.
Lemma 6 suggests that having a partition of bounded layered width, whose quotient has bounded treewidth, seems to be a more stringent requirement than having bounded layered treewidth. Indeed the former structure leads to bounds on the queue-number, instead of bounds obtained via layered treewidth. That said, it is open whether graphs of bounded layered treewidth have bounded queue-number. It is even possible that graphs of bounded layered treewidth have partitions of bounded layered width, whose quotient has bounded treewidth.
Before continuing, we show that if one does not care about the exact treewidth bound, then it suffices to consider partitions with layered width 1.
If a graph has an -partition of layered width with respect to layering , for some graph of treewidth at most , then has an -partition of layered width 1 with respect to the same layering, for some graph of treewidth at most .
Let be an -partition of of layered width with respect to layering , for some graph of treewidth at most . Let be a tree-decomposition of with width at most . Let be the graph obtained from by replacing each vertex of by an -clique and replacing each edge of by a complete bipartite graph between and . For each , let . Observe that is a tree-decomposition of of width at most . For each vertex of , and layer , there are at most vertices in . Assign each vertex in to a distinct element of . We obtain an -partition of with layered width 1, and the treewidth of is at most . ∎
3 Queue Layouts via Layered Partitions
The next lemma is at the heart of all our results about queue layouts.
For all graphs and , if has a -queue layout and has an -partition of layered width with respect to some layering of , then has a -queue layout using vertex ordering , where is some ordering of . In particular,
The next lemma is useful in the proof of Lemma 8.
Let be the vertex ordering in a 1-queue layout of a graph . Let be the graph obtained from by replacing each vertex by a ‘block’ of at most consecutive vertices in the ordering, and by replacing each edge by a complete bipartite graph between and . Then this ordering admits an -queue layout of .
A rainbow in a vertex ordering of a graph is a set of pairwise nested edges (and thus a matching). Say is a rainbow in the ordering of . Heath and Rosenberg  proved that a vertex ordering of any graph admits a -queue layout if and only if every rainbow has size at most . Thus it suffices to prove that . If the right endpoints of belong to at least two different blocks, and the left endpoints of belong to at least two different blocks, then no endpoint of the innermost edge in and no endpoint of the outermost edge in are in a common block, implying that the corresponding edges in have no endpoint in common, and therefore are nested. Since no two edges in are nested, without loss of generality, the left endpoints of belong to one block. Hence there are at most left endpoints of , implying , as desired. ∎
In what follows, the graph in Lemma 9 is called an -blowup of .
Proof of Lemma 8.
Let be an -partition of such that for all and . Let be the vertex ordering and be the queue assignment in a -queue layout of .
We now construct a -queue layout of . Order each layer by
where each set is ordered arbitrarily. We use the ordering of in our queue layout of . It remains to assign the edges of to queues. We consider four types of edges, and use distinct queues for edges of each type.
Intra-level intra-bag edges: Let be the subgraph formed by the edges , where for some and . Heath and Rosenberg  noted that the complete graph on vertices has queue-number . Since , at most queues suffice for edges in the subgraph of induced by . These subgraphs are separated in . Thus queues suffice for all intra-level intra-bag edges.
Intra-level inter-bag edges: For and , let be the subgraph of formed by those edges such that and for some edge . Let be the -queue layout of the subgraph of on all edges in queue . Observe that is a subgraph of the graph isomorphic to the -blowup of . By Lemma 9, admits an -queue layout of . As the subgraphs for fixed but different are separated in , queues suffice for edges in for each . Hence admits an -queue layout of the intra-level inter-bag edges.
Inter-level intra-bag edges: Let be the subgraph of formed by those edges such that and for some and . Consider the graph with ordered vertex set
and edge set . Then no two edges in are nested. Observe that is isomorphic to a subgraph of the -blowup of . By Lemma 9, admits an -queue layout of the intra-level inter-bag edges.
Inter-level inter-bag edges: We partition these edges into sets. For , let be the spanning subgraph of formed by those edges where and for some and for some edge of in , with in the ordering of . Similarly, for , let be the spanning subgraph of formed by those edges where and for some and for some edge of in , with in the ordering of .
For , let be the graph with ordered vertex set
and edge set . Suppose that two edges in nest. This is only possible for edges and , where . Thus, in , we have and . By the definition of , we have and . Hence , which contradicts that . Therefore no two edges are nested in .
Observe that is isomorphic to a subgraph of the -blowup of . By Lemma 9, admits an -queue layout of . An analogous argument shows that admits an -queue layout of . Hence admits a -queue layout of all the inter-level inter-bag edges.
In total, we use queues. ∎
The upper bound of in Lemma 8 is tight, in the sense that the vertex ordering allows for a set of this many pairwise nested edges, and thus at least that many queues are needed.
If a graph has a partition of layered width such that has treewidth at most , then has queue-number at most .
4 Proof of Theorem 1: Planar Graphs
Our proof that planar graphs have bounded queue-number employs Corollary 10. Thus our goal is to show that planar graphs admit bounded layered partitions, which is achieved in the following key contribution of the paper.
Every planar graph has a connected partition with layered width such that has treewidth at most . Moreover, there is such a partition for every BFS layering of .
We now set out to prove Theorem 11. The proof is inspired by the following elegant result of Pilipczuk and Siebertz : Every planar graph has a partition into geodesics such that has treewidth at most . Here, a geodesic is a path of minimum length between its endpoints. We consider the following particular type of geodesic. If is a tree rooted at a vertex , then a non-empty path in is vertical if for some for all we have . The vertex is called the upper endpoint of the path and is its lower endpoint. Note that every vertical path in a BFS spanning tree is a geodesic. Thus the next theorem strengthens the result of Pilipczuk and Siebertz .
Let be a rooted spanning tree in a connected planar graph . Then has a partition into vertical paths in such that has treewidth at most .
Proof of Theorem 11 assuming Theorem 12.
We may assume that is connected (since if each component of has the desired partition, then so does ). Let be a BFS spanning tree of . By Theorem 12, has a partition into vertical paths in such that has treewidth at most . Each path in is connected and has at most one vertex in each BFS layer corresponding to . Hence is connected and has layered width 1. ∎
The proof of Theorem 12 is an inductive proof of a stronger statement given in Lemma 14 below. A plane graph is a graph embedded in the plane with no crossings. A near-triangulation is a plane graph, where the outer-face is a simple cycle, and every internal face is a triangle. For a cycle , we write if are pairwise disjoint non-empty paths in , and the endpoints of each path can be labelled and so that for , where means . This implies that .
Proof of Theorem 12 assuming Lemma 14..
Let be the root of . Let be a plane triangulation containing as a spanning subgraph with on the outer-face of . Let be the plane triangulation obtained from by adding one new vertex into the outer-face of and adjacent to every vertex on the boundary of the outer-face of . Let be the spanning tree of obtained from by adding and the edge . Consider to be rooted at . The three vertices on the outer-face of are vertical (singleton) paths in . Thus satisfies the assumptions of Lemma 14, which implies that has a partition into vertical paths in such that has treewidth at most . Note that is a subgraph of (since and ). Hence has treewidth at most . ∎
Lemma 13 (Sperner’s Lemma).
Let be a near-triangulation whose vertices are coloured , with the outer-face where each vertex in is coloured . Then contains an internal face whose vertices are coloured .
Let be a plane triangulation, let be a spanning tree of rooted at some vertex on the outer-face of , and let for some , be pairwise disjoint vertical paths in such that is a cycle in . Let be the near-triangulation consisting of all the edges and vertices of contained in and the interior of .
Then has a partition into vertical paths in where , such that the quotient is planar and has a tree-decomposition in which every bag has size at most 9 and some bag contains all the vertices of corresponding to .
The proof is by induction on . If , then is a 3-cycle and . The partition into vertical paths is . The tree-decomposition of consists of a single bag that contains the vertices corresponding to .
For we wish to make use of Sperner’s Lemma on some (not necessarily proper) 3-colouring of the vertices of . We begin by colouring the vertices of , as illustrated in Figure 1. There are three cases to consider:
If then, since is a cycle, has at least three vertices, so for two distinct vertices and . We set , and .
If then we may assume without loss of generality that has at least two vertices so . We set , and .
If then we group consecutive paths by taking , and . Note that in this case each consists of one or two of .
For , colour each vertex in by . Now, for each remaining vertex in , consider the path from to the root of . Since is on the outer-face of , contains at least one vertex of . If the first vertex of that belongs to is in then assign the colour to . In this way we obtain a 3-colouring of the vertices of that satisfies the conditions of Sperner’s Lemma. Therefore, by Sperner’s Lemma there exists a triangular face of whose vertices are coloured respectively.
For each , let be the path in from to the first ancestor of in that is contained in . Observe that , , and are disjoint since consists only of vertices coloured . Note that may consist of the single vertex . Let be minus its final vertex
. Imagine for a moment that cycleis oriented clockwise, which defines an orientation of , and . Let be the subpath of that contains and all vertices that precede it, and let be the subpath of that contains and all vertices that succeed it. Again, and may be empty if is the first and/or last vertex of .
Consider the subgraph of that consists of the edges and vertices of , the edges and vertices of , and the edges and vertices of . This graph has an outer-face, an inner face , and up to three more inner faces where , where we use the convention that and . Note that may be empty in the sense that may consist of a single edge .
Consider any non-empty face . Note that these four paths are pairwise disjoint, and thus is a cycle. If and are non-empty, then each is a vertical path in . Furthermore, each of and consists of at most two vertical paths in . Thus, is the concatenation of at most six vertical paths in . Let be the near-triangulation consisting of all the edges and vertices of contained in and the interior of . Observe that contains and but not the third vertex of . Therefore satisfies the conditions of the lemma and has fewer than vertices. So we may apply induction on to obtain a partition of into vertical paths in , such that has a tree-decomposition in which every bag has size at most 9, and some bag contains the vertices of corresponding to the at most six vertical paths that form . We do this for each such that is non-empty.
We now construct the desired partition of and tree-decomposition of .
We start by defining . Initialise . Then add each to , provided it is non-empty. Finally for , each path in is either fully contained in or it is an internal path with none of its vertices on . Add all these internal paths of to . By construction, partitions into vertical paths in and it contains .
The graph obtained from by contracting each path in is planar since is planar and is connected for each .
Next we exhibit the desired tree-decomposition of . Let be the tree obtained from the disjoint union of , and by adding one new node adjacent to , and . (Recall that is the node of for which the bag contains the vertices of obtained by contracting the paths that form .) For each node , initialise . Let the bag contain all the vertices of corresponding to . It is helpful to think of as being rooted at . Since , .
The resulting structure, , is not yet a tree-decomposition of since some bags may contain vertices of that are not necessarily vertices of (namely, vertices of that are obtained by contracting paths in that are on .) We remedy that now. Recall that vertices of , , correspond to contracted paths in . Each path that is in the cycle is either a path or a subpath of for some . For each such path , for , in bag , replace each instance of the vertex of corresponding to by the vertex of corresponding to . This completes the description of . Clearly, for every . In remains to prove that is indeed a tree-decomposition of .
We first show that the above renaming of vertices does not cause any problems. In particular, it is possible that some pair of distinct vertices of is replaced by a single vertex of corresponding to some path . However, by construction, this only happens for two vertices of that correspond to two consecutive paths of on , thus these two vertices are adjacent in . Consequently, the two subtrees of whose corresponding bags contain these two vertices have at least one node in common and thus the set of nodes of whose bags contain the vertex corresponding to is a subtree of . In fact, renaming these two vertices is equivalent to contracting the edge between them in . Similarly, if there is an edge between a pair of vertices in then some bag contains both of these vertices and therefore some bag (where ) contains the corresponding vertex or vertices of .
Now we are ready to show that, for each vertex of , the set forms a subtree of . The only vertices of that may appear in and for are those in . The vertices of obtained by contracting each of these paths are the only vertices of that may appear in more than one of our tree-decompositions of , and . The bag contains all of these vertices. If one such vertex appears in the tree-decomposition of for some , then the set of nodes of whose bags contain is a subtree of by the above explanation on the effects of vertex replacing. The vertex is in and is in . Since and are adjacent in , the set of nodes of whose bags contain is a subtree of .
Finally we show that, for every edge of , there is a bag that contains and . If and are both obtained by contracting any of , then and both appear in . If and are both in for some , then some bag contains both and , by the above explanation on the effects of vertex replacing. The only possibility that remains is that is obtained by contracting a path in and is obtained by contracting a path not in . But in this case separates from so the edge is not present in . ∎
4.1 Reducing the Bound
Every planar graph has a partition with layered width such that has treewidth at most . Moreover, there is such a partition for every BFS layering of .