1 Introduction
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. [60] developed a graphtheoretic formulation of this question, where they defined the graph parameters stacknumber and queuenumber which respectively measure the power of stacks and queues to represent a given graph. Intuitively speaking, if some class of graphs has bounded stacknumber and unbounded queuenumber, then we would consider stacks to be more powerful than queues for that class (and vice versa). It is known that the stacknumber of a graph may be much larger than the queuenumber. For example, Heath et al. [60] proved that the vertex ternary Hamming graph has queuenumber at most and stacknumber at least . Nevertheless, it is open whether every graph has stacknumber bounded by a function of its queuenumber, or whether every graph has queuenumber bounded by a function of its stacknumber [60, 49].
Planar graphs are the simplest class of graphs where it is unknown whether both stack and queuenumber are bounded. In particular, Buss and Shor [18] first proved that planar graphs have bounded stacknumber; the best known upper bound is 4 due to Yannakakis [101]. 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 queuenumber. This question was first proposed by Heath et al. [60] who conjectured that planar graphs have bounded queuenumber.^{1}^{1}1Curiously, in a later paper, Heath and Rosenberg [62] conjectured that planar graphs have unbounded queuenumber. This paper proves this conjecture. Moreover, we generalise this result for graphs of bounded Euler genus, and for every proper minorclosed class of graphs.^{2}^{2}2The Euler genus of the orientable surface with handles is . The Euler genus of the nonorientable surface with crosscaps 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 [75] 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 minorclosed if for every graph , every minor of is in . A minorclosed 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 minorclosed class.
First we define the stacknumber and queuenumber 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 noncrossing edges, and a queue (with respect to ) is a set of pairwise nonnested edges. Stacks resemble the stack data structure in the following sense. In a stack, traverse the vertex ordering lefttoright. When visiting vertex , because of the noncrossing property, if are the neighbours of to the left of in lefttoright 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 lefttoright 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 nonnesting 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 stacknumber of , denoted by , is the minimum integer such that has a stack layout. The queuenumber 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 [76], and stacknumber is also called pagenumber, book thickness, or fixed outerthickness.
Stack and queue layouts are inherently related to depthfirst search and breadthfirst search respectively. For example, a DFS ordering of the vertices of a tree has no two crossing edges, and thus defines a 1stack layout. Similarly, a BFS ordering of the vertices of a tree has no two nested edges, and thus defines a 1queue layout. Hence every tree has stacknumber 1 and queuenumber 1.
As mentioned above, Heath et al. [60] conjectured that planar graphs have bounded queuenumber. 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 [80] studied queue layouts and wrote that he “suspects” that a particular planar graph with vertices has queuenumber . The example he proposed had treewidth 3; see Section 2.2 for the definition of treewidth. Dujmović et al. [43] proved that graphs of bounded treewidth have bounded queuenumber. So Pemmaraju’s example in fact has bounded queuenumber.
The first bound on the queuenumber of planar graphs with vertices was proved by Heath et al. [60], who observed that every graph with edges has a queue layout using a random vertex ordering. Thus every planar graph with vertices has queuenumber , which can also be proved using the LiptonTarjan separator theorem. Di Battista et al. [30] proved the first breakthrough on this topic, by showing that every planar graph with vertices has queuenumber . Dujmović [38] improved this bound to with a simpler proof. Building on this work, Dujmović et al. [44] established (poly)logarithmic bounds for more general classes of graphs. For example, they proved that every graph with vertices and Euler genus has queuenumber , and that every graph with vertices excluding a fixed minor has queuenumber .
Recently, Bekos et al. [11] proved a second breakthrough result, by showing that planar graphs with bounded maximum degree have bounded queuenumber. In particular, every planar graph with maximum degree has queuenumber at most . Subsequently, Dujmović et al. [45] proved that the algorithm of Bekos et al. [11] in fact produces a queue layout. This was the state of the art prior to the current work.^{3}^{3}3Wang [92] claimed to prove that planar graphs have bounded queuenumber, 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. [60] that planar graphs have bounded queuenumber.
Theorem 1.
The queuenumber of planar graphs is bounded.
The best upper bound that we obtain for the queuenumber of planar graphs is .
We extend Theorem 1 by showing that graphs with bounded Euler genus have bounded queuenumber.
Theorem 2.
Every graph with Euler genus has queuenumber at most .
The best upper bound that we obtain for the queuenumber of graphs with Euler genus is .
We generalise further to show the following:
Theorem 3.
Every proper minorclosed class of graphs has bounded queuenumber.
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. [41] to prove that planar graphs have bounded nonrepetitive chromatic number, thus solving a wellknown open problem of Alon et al. [5]. As above, this result generalises for any proper minorclosed class.
1.2 Outline
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 queuenumber bounded by a function of the queuenumber 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 queuenumber [43], 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 queuenumber of treewidth planar graphs [2] 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 queuenumber . 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 minorclosed 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 wellknown nonminorclosed classes of graphs, such as planar graphs, also have bounded queuenumber.
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 minorclosed 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 3dimensional graph drawing.
Finally Section 10 summarizes and concludes with open problems and directions for future work.
2 Tools
Undefined terms and notation can be found in Diestel’s text [32]. Throughout the paper, we use the notation to refer to a particular linear ordering of a set .
2.1 Layerings
The following wellknown 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 intralevel edge. If then is an interlevel 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 nonroot 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 treedecomposition. 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 nonempty 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 treedecomposition is a decomposition for some tree . The treewidth of a graph is the minimum width of a treedecomposition 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 [85]; the more general notion of decomposition was introduced by Diestel and Kühn [33].
As mentioned in Section 1, Dujmović et al. [43] first proved that graphs of bounded treewidth have bounded queuenumber. Their bound on the queuenumber was doubly exponential in the treewidth. Wiechert [93] improved this bound to singly exponential.
Lemma 4 ([93]).
Every graph with treewidth has queuenumber at most .
Alam, Bekos, Gronemann, Kaufmann, and Pupyrev [2] also improved the bound in the case of planar 3trees. 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 [71].
Graphs with bounded treewidth provide important examples of minorclosed 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 queuenumber.
Dujmović et al. [44] and Shahrokhi [91] independently introduced the following concept. The layered treewidth of a graph is the minimum integer such that has a treedecomposition 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 [42], and intersection graph theory [91]. The related notion of layered pathwidth has also been studied [39, 10]. Most relevant to this paper, Dujmović et al. [44] proved that every graph with vertices and layered treewidth has queuenumber 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 minorclosed class has bounded layered treewidth if and only if it excludes some apex graph.^{4}^{4}4A graph is apex if is planar for some vertex . This implies bounds on the queuenumber for all these graphs, and was the basis for the bound for proper minorclosed classes mentioned in Section 1.
2.3 Partitions and Layered Partitions
The following definitions are central notions in this paper. A vertexpartition, or simply partition, of a graph is a set of nonempty 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 intrabag edge) or (and is called an interbag edge). The width of such an partition is . Note that a layering is equivalent to a pathpartition.
A treepartition is a partition for some tree . Treepartitions are well studied with several applications [34, 35, 97, 90, 14]. For example, every graph with treewidth and maximum degree has a treepartition of width ; see [97, 34]. This easily leads to a upper bound on the queuenumber [43]. However, dependence on seems unavoidable when studying treepartitions [97], 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 [7], fractional colouring [83, 89], generalised colouring numbers [64], and defective and clustered colouring [66]. See [36, 37] for more on partitions of graphs in a proper minorclosed 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.
Lemma 6.
If a graph has an partition with layered width at most such that has treewidth at most , then has layered treewidth at most .
Proof.
Let be a treedecomposition 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 treedecomposition 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 [44]). 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 queuenumber, instead of bounds obtained via layered treewidth. That said, it is open whether graphs of bounded layered treewidth have bounded queuenumber. 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.
Lemma 7.
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 .
Proof.
Let be an partition of of layered width with respect to layering , for some graph of treewidth at most . Let be a treedecomposition 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 treedecomposition 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.
Lemma 8.
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.
Lemma 9.
Let be the vertex ordering in a 1queue 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 .
Proof.
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 [61] 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.
Intralevel intrabag edges: Let be the subgraph formed by the edges , where for some and . Heath and Rosenberg [61] noted that the complete graph on vertices has queuenumber . Since , at most queues suffice for edges in the subgraph of induced by . These subgraphs are separated in . Thus queues suffice for all intralevel intrabag edges.
Intralevel interbag 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 intralevel interbag edges.
Interlevel intrabag 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 intralevel interbag edges.
Interlevel interbag 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 interlevel interbag 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.
Lemmas 4 and 8 imply that a graph class that admits bounded layered partitions has queuenumber. In particular:
Corollary 10.
If a graph has a partition of layered width such that has treewidth at most , then has queuenumber at most .
4 Proof of Theorem 1: Planar Graphs
Our proof that planar graphs have bounded queuenumber 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.
Theorem 11.
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 .
This theorem and Corollary 10 imply that planar graphs have bounded queuenumber (Theorem 1) with an upper bound of .
We now set out to prove Theorem 11. The proof is inspired by the following elegant result of Pilipczuk and Siebertz [81]: 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 nonempty 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 [81].
Theorem 12.
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 neartriangulation is a plane graph, where the outerface is a simple cycle, and every internal face is a triangle. For a cycle , we write if are pairwise disjoint nonempty 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 outerface of . Let be the plane triangulation obtained from by adding one new vertex into the outerface of and adjacent to every vertex on the boundary of the outerface of . Let be the spanning tree of obtained from by adding and the edge . Consider to be rooted at . The three vertices on the outerface 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 neartriangulation whose vertices are coloured , with the outerface where each vertex in is coloured . Then contains an internal face whose vertices are coloured .
Lemma 14.
Let be a plane triangulation, let be a spanning tree of rooted at some vertex on the outerface of , and let for some , be pairwise disjoint vertical paths in such that is a cycle in . Let be the neartriangulation 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 treedecomposition in which every bag has size at most 9 and some bag contains all the vertices of corresponding to .
Proof.
The proof is by induction on . If , then is a 3cycle and . The partition into vertical paths is . The treedecomposition of consists of a single bag that contains the vertices corresponding to .
(a)  (b) 
(c)  (d) 
For we wish to make use of Sperner’s Lemma on some (not necessarily proper) 3colouring 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 outerface 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 3colouring 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 cycle
is 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 outerface, 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 nonempty face . Note that these four paths are pairwise disjoint, and thus is a cycle. If and are nonempty, 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 neartriangulation 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 treedecomposition 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 nonempty.
We now construct the desired partition of and treedecomposition of .
We start by defining . Initialise . Then add each to , provided it is nonempty. 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 treedecomposition 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 treedecomposition 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 treedecomposition 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 treedecompositions of , and . The bag contains all of these vertices. If one such vertex appears in the treedecomposition 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
We now set out to reduce the constant in Theorem 1 from to . This is achieved by proving the following variant of Theorem 11.
Theorem 15.
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 .
This theorem and Corollary 10 imply that planar graphs have bounded queuenumber (Theorem 1) with an upper bound of .
Note that Theorem 15 is stronger than Theorem 11 in that the treewidth bound is smaller, whereas Theorem 11 is stronger than Theorem 15 in that the partition is connected and the layered width is smaller. Also note that Theorem 15 is tight in terms of the treewidth of : For every , there exists a planar graph such that, if has a partition of layered width , then has treewidth at least . We give this construction at the end of this section, and prove Theorem 15 first. Theorem 11 was proved via an inductive proof of a stronger statement given in Lemma 14. Similarly, the proof of Theorem 15 is via an inductive proof of a stronger statement given in