Stack and Queue Layouts via Layered Separators

It is known that every proper minor-closed class of graphs has bounded stack-number (a.k.a. book thickness and page number). While this includes notable graph families such as planar graphs and graphs of bounded genus, many other graph families are not closed under taking minors. For fixed $g$ and $k$, we show that every $n$-vertex graph that can be embedded on a surface of genus $g$ with at most $k$ crossings per edge has stack-number $\mathcal{O}(\log n)$; this includes $k$-planar graphs. The previously best known bound for the stack-number of these families was $\mathcal{O}(\sqrt{n})$, except in the case of $1$-planar graphs. Analogous results are proved for map graphs that can be embedded on a surface of fixed genus. None of these families is closed under taking minors. The main ingredient in the proof of these results is a construction proving that $n$-vertex graphs that admit constant layered separators have $\mathcal{O}(\log n)$ stack-number.


Introduction
A stack layout of a graph G consists of a total order σ of V (G) and a partition of E(G) into sets (called stacks) such that no two edges in the same stack cross; that is, there are no edges vw and xy in a single stack with v < σ x < σ w < σ y. The minimum number of stacks in a stack layout of G is the stack-number of G. Stack layouts, first defined by Ollmann [22], are ubiquitous structures with a variety of applications (see [17] for a survey). A stack layout is also called a book embedding and stack-number is also called book thickness and page number. The stack-number is known to be bounded for planar graphs [24], bounded genus graphs [20] and, most generally, all proper minor-closed graph families [4,5].
The purpose of this note is to bring the study of the stack-number beyond the proper minor-closed graph families. Layered separators are a key tool for proving our results. They have already led to progress on long-standing open problems related to 3D graph drawings [11,15] and nonrepetitive graph colourings [13]. A layering {V 0 , . . . , V p } of a graph G is a partition of V (G) into layers V i such that, for each e ∈ E(G), there is an i such that the endpoints of e are both in V i or one in V i and one in V i+1 . A graph G has a layered -separator for a fixed layering {V 0 , . . . , V p } if, for every subgraph G of G, there exists a set S ⊆ V (G ) with at most vertices in each layer (i.e., V i ∩ S ≤ , for i = 0, . . . , p) such that each connected component of G − S has at most |V (G )|/2 vertices. Our main technical contribution is the following theorem. Theorem 1. Every n-vertex graph that has a layered -separator has stacknumber at most 5 · log 2 n.
We discuss the implications of Theorem 1 for two well-known non-minorclosed classes of graphs. A graph is (g, k)-planar if it can be drawn on a surface of Euler genus at most g with at most k crossings per edge. Then (0, 0)-planar graphs are planar graphs, whose stack-number is at most 4 [24]. Further, (0, k)planar graphs are k-planar graphs [23]; Bekos et al. [3] have recently proved that 1-planar graphs have bounded stack-number (see Alam et al. [1] for an improved constant). The family of (g, k)-planar graphs is not closed under taking minors 1 even for g = 0, k = 1; thus the result of Blankenship and Oporowski [4,5], stating that proper minor-closed graph families have bounded stack-number, does not apply to (g, k)-planar graphs. Dujmović et al. [12] showed that (g, k)-planar graphs have layered (4g + 6)(k + 1)-separators 2 . This and our Theorem 1 imply the following corollary. For all g ≥ 0 and k ≥ 2, the previously best known bound was O( √ n), following from the O( √ m) bound for m-edge graphs [21].
Corollary 1. For any fixed g and k, every n-vertex (g, k)-planar graph has stack-number O(log n).
A (g, d)-map graph G is defined as follows. Embed a graph H on a surface of Euler genus g and label some of its faces as "nations" so that any vertex of H is incident to at most d nations; then the vertices of G are the faces of H labeled as nations and the edges of G connect nations that share a vertex of H. The (0, d)-map graphs are the well-known d-map graphs [18,7,9,8,6]. The (g, 3)-map graphs are the graphs of Euler genus at most g [8], thus they are closed under taking minors. However, for every g ≥ 0 and d ≥ 4, the (g, d)-map graphs are not closed under taking minors [12], thus the result of Blankenship and Oporowski [4,5] does not apply to them. The (g, d)-map graphs have layered (2g +3)(2d+1)separators [12]. This and our Theorem 1 imply the following corollary. For all g ≥ 0 and d ≥ 4, the best previously known bound was O( √ n) [21].
Corollary 2. For any fixed g and d, every n-vertex (g, d)-map graph has stacknumber O(log n).
A "dual" concept to that of stack layouts are queue layouts. A queue layout of a graph G consists of a total order σ of V (G) and a partition of E(G) into sets (called queues), such that no two edges in the same queue nest; that is, there are no edges vw and xy in a single queue with v < σ x < σ y < σ w. If v < σ x < σ y < σ w we say that xy nests inside vw. The minimum number of queues in a queue layout of G is called the queue-number of G. Queue layouts, like stack layouts, have been extensively studied. In particular, it is a long standing open problem to determine if planar graphs have bounded queue-number. Logarithmic upper bounds have been obtained via layered separators [11,2]. In particular, a result similar to Theorem 1 is known for the queue-number: Every n-vertex graph that has layered -separators has queue-number O( log n) [11]; this bound was refined to 3 · log 3 (2n + 1) − 1 by Bannister et al. [2]. These results were established via a connection with the track-number of a graph [14]. Together with the fact that planar graphs have layered 2-separators [13,19], these results imply an O(log n) bound for the queue-number of planar graphs, improving on a earlier result by Di Battista et al. [10]. The polylog bound on the queue-number of planar graphs extends to all proper minor-closed families of graphs [15,16]. Our approach to prove Theorem 1 also gives a new proof of the following result (without using track layouts). We include it for completeness.
Theorem 2. Every n-vertex graph that has a layered -separator has queuenumber at most 3 · log 2 n.

Proofs of Theorem 1 and Theorem 2
Let G be a graph and L = {V 0 , . . . , V p } be a layering of G such that G admits a layered -separator for layering L. Each edge of G is either an intra-layer edge, that is, an edge between two vertices in a set V i , or an inter-layer edge, that is, an edge between a vertex in a set V i and a vertex in a set V i+1 .
A total order on a set of vertices R ⊆ V (G) is a vertex ordering of R. The stack layout construction computes a vertex ordering σ s of V (G) satisfying the layer-by-layer invariant, which is defined as follows: For 0 ≤ i < p, the vertices in V i precede the vertices in V i+1 in σ s . Analogously, the queue layout construction computes a vertex ordering σ q of V (G) satisfying the layer-by-layer invariant.
Let S be a layered -separator for G with respect to L. Let G 1 , . . . , G k be the graphs induced by the vertices in the connected components of G − S (the vertices of S do not belong to any graph G j ). These graphs are labeled G 1 , . . . , G k arbitrarily. Recall that, by the definition of a layered -separator for G, we have Both the stack and the queue layout constructions recursively construct vertex orderings of V (G j ) satisfying the layer-by-layer invariant, for j = 1, . . . , k. Let σ s j be the vertex ordering of V (G j ) computed by the stack layout construction; we also denote by σ s j,i the restriction of σ s j to the vertices in layer V i . Note that σ s j = σ s j,1 , σ s j,2 , . . . , σ s j,p by the layer-by-layer invariant. Vertex orderings σ q j and σ q j,i are defined analogously for the queue layout construction. We now show how to combine the recursively constructed vertex orderings to obtain a vertex ordering of V (G). The way this combination is performed differs for the stack layout construction and the queue layout construction.
Stack layout construction. Vertex ordering σ s is defined as (refer to Fig. 1) The vertex ordering σ s satisfies the layer-by-layer invariant, given that vertex ordering σ s j does, for j = 1, . . . , k. Then Theorem 1 is implied by the following.
Lemma 1. G has a stack layout with 5 · log 2 n stacks with vertex ordering σ s .

Proof:
We use distinct sets of stacks for the intra-and the inter-layer edges.
Stacks for the intra-layer edges. We assign each intra-layer edge uv with u ∈ S or v ∈ S to one of stacks P 1 , . . . , P as follows. Since uv is an intra-layer edge, {u, v} ⊆ V i , for some 0 ≤ i ≤ p. Assume w.l.o.g. that u < σ s v. Then u ∈ S and let it be x-th vertex in ρ i (recall that ρ i contains at most vertices). Assign uv to P x . The only intra-layer edges that are not yet assigned to stacks belong to graphs G 1 , . . . , G k . The assignment of these edges to stacks is the one computed recursively; however, we use the same set of stacks to assign the edges of all graphs G 1 , . . . , G k .
We now prove that no two intra-layer edges in the same stack cross. Let e and e be two intra-layer edges of G and let both the endpoints of e be in V i and both the endpoints of e be in V i . Assume w.l.o.g. that i ≤ i . If i < i , then, since σ s satisfies the layer-by-layer invariant, the endpoints of e precede those of e in σ s , hence e and e do not cross. Suppose now that i = i . If e and e are in some stack P x for x ∈ {1, . . . , }, then they are both incident to the x-th vertex in ρ i , thus they do not cross. If e and e are in some stack different from P 1 , . . . , P , then e ∈ E(G j ) and e ∈ E(G j ), for some j, j ∈ {1, . . . , k}. If j = j , then e and e do not cross by induction. Otherwise, both the endpoints of e precede both the endpoints of e or vice versa, since the vertices in σ s min{j,j },i precede those in σ s max{j,j },i in σ s or vice versa, depending on whether i is even or odd; hence e and e do not cross.
We now bound the number of stacks we use for the intra-layer edges of G; we claim that this number is at most · log 2 n. The proof is by induction on n; the base case n = 1 is trivial. For any subgraph H of G, let p 1 (H) be the number of stacks we use for the intra-layer edges of H, and let p 1 (n ) = max H {p 1 (H)} over all subgraphs H of G with n vertices. As proved above, p 1 (G) ≤ + max{p 1 (G 1 ), . . . , p 1 (G k )}. Since each graph G j has at most n/2 vertices, we get that p 1 (G) ≤ + p 1 (n/2). By induction p 1 (G) ≤ + · log 2 (n/2) = · log 2 n.
Stacks for the inter-layer edges. We use distinct sets of stacks for the even inter-layer edges -connecting vertices on layers V i and V i+1 with i even -and for the odd inter-layer edges -connecting vertices on layers V i and V i+1 with i odd. We only describe how to assign the even inter-layer edges to 2 · log 2 n stacks so that no two edges in the same stack cross; the assignment for the odd inter-layer edges is analogous.
We assign each even inter-layer edge uv with u ∈ S or v ∈ S to one of 2 stacks P 1 , . . . , P 2 as follows. Since uv is an inter-layer edge, u and v respectively belong to layers V i and V i+1 , for some 0 ≤ i ≤ p − 1. If u ∈ S, then u is the x-th vertex in ρ i , for some 1 ≤ x ≤ ; assign edge uv to P x . If u / ∈ S, then v ∈ S is the y-th vertex in ρ i+1 , for some 1 ≤ y ≤ ; assign edge uv to P +y . The only even inter-layer edges that are not yet assigned to stacks belong to graphs G 1 , . . . , G k . The assignment of these edges to stacks is the one computed recursively; however, we use the same set of stacks to assign the edges of all graphs G 1 , . . . , G k .
We prove that no two even inter-layer edges in the same stack cross. Let e and e be two even inter-layer edges of G. Let V i and V i+1 be the layers containing the endpoints of e. Let V i and V i +1 be the layers containing the endpoints of e . Assume w.l.o.g. that i ≤ i . If i < i , then i + 1 < i , given that both i and i are even. Then, since σ s satisfies the layer-by-layer invariant, both the endpoints of e precede both the endpoints of e , thus e and e do not cross. Suppose now that i = i . If e and e are in some stack P h for h ∈ {1, . . . , 2 }, then e and e are both incident either to the h-th vertex of ρ i or to the (h − )-th vertex of ρ i+1 , hence they do not cross. If e and e are in some stack different from P 1 , . . . , P 2 , then e ∈ E(G j ) and e ∈ E(G j ), for j, j ∈ {1, . . . , k}. If j = j , then e and e do not cross by induction. Otherwise, j = j and then e nests inside e or vice versa, since the vertices in σ s min{j,j },i precede those in σ s max{j,j },i and the vertices in σ s max{j,j },i+1 precede those in σ s min{j,j },i+1 in σ s ; hence e and e do not cross. We now bound the number of stacks we use for the even inter-layer edges of G; we claim that this number is at most 2 ·log 2 n. The proof is by induction on n; the base case n = 1 is trivial. For any subgraph H of G, let p 2 (H) be the number of stacks we use for the even inter-layer edges of H, and let p 2 (n ) = max H {p 2 (H)} over all subgraphs H of G with n vertices. As proved above, p 2 (G) ≤ 2 + max{p 2 (G 1 ), . . . , p 2 (G k )}. Since each graph G j has at most n/2 vertices, we get that p 2 (G) ≤ 2 + p 2 (n/2). By induction p 2 (G) ≤ 2 + 2 · log 2 (n/2) = 2 · log 2 n.
The described stack layout uses · log 2 n stacks for the intra-layer edges, 2 · log 2 n stacks for the even inter-layer edges, and 2 · log 2 n stacks for the odd inter-layer edges, thus 5 · log 2 n stacks in total. This concludes the proof.
ρ2 The vertex ordering σ q satisfies the layer-by-layer invariant, given that vertex ordering σ q j does, for j = 1, . . . , k. Then Theorem 2 is implied by the following.
Lemma 2. G has a queue layout with 3 · log 2 n queues with vertex ordering σ q .
Proof: We use distinct sets of queues for the intra-and the inter-layer edges.
Queues for the intra-layer edges. We assign each intra-layer edge uv with u ∈ S or v ∈ S to one of queues Q 1 , . . . , Q as follows. Since uv is an intralayer edge, {u, v} ⊆ V i , for some 0 ≤ i ≤ p. Assume w.l.o.g. that u < σ q v. Then u ∈ S and let it be the x-th vertex of ρ i . Assign uv to Q x . The only intra-layer edges that are not yet assigned to queues belong to graphs G 1 , . . . , G k . The assignment of these edges to queues is the one computed recursively; however, we use the same set of queues to assign the edges of all graphs G 1 , . . . , G k .
The proof that no two intra-layer edges in the same queue nest is the same as the proof no two intra-layer edges in the same stack cross in Lemma 1 (with the word "nest" replacing "cross" and with σ q replacing σ s ). The proof that the number of queues we use for the intra-layer edges is at most · log 2 n is also the same as the proof that the number of stacks we use for the intra-layer edges is at most · log 2 n in Lemma 1.
Queues for the inter-layer edges. We assign each inter-layer edge uv with u ∈ S or v ∈ S to one of 2 queues Q 1 , . . . , Q 2 as follows. Since uv is an inter-layer edge, u and v respectively belong to layers V i and V i+1 , for some 0 ≤ i ≤ p − 1. If u ∈ S, then u is the x-th vertex in ρ i , for some 1 ≤ x ≤ ; assign edge uv to Q x . If u / ∈ S, then v ∈ S is the y-th vertex in ρ i+1 , for some 1 ≤ y ≤ ; assign edge uv to Q +y . The only inter-layer edges that are not yet assigned to queues belong to graphs G 1 , . . . , G k . The assignment of these edges to queues is the one computed recursively; however, we use the same set of queues to assign the edges of all graphs G 1 , . . . , G k .
We prove that no two inter-layer edges e and e in the same queue nest. Let V i and V i+1 be the layers containing the endpoints of e. Let V i and V i +1 be the layers containing the endpoints of e . Assume w.l.o.g. that i ≤ i . If i < i , then both endpoints of e precede the endpoint of e in V i +1 (hence e is not nested inside e) and both endpoints of e follow the endpoint of e in V i (hence e is not nested inside e ), since σ q satisfies the layer-by-layer invariant; thus e and e do not nest. Suppose now that i = i . If e and e are in some queue Q h for h ∈ {1, . . . , 2 }, then e and e are both incident either to the h-th vertex of ρ i or to the (h− )-th vertex of ρ i+1 , hence they do not nest. If e and e are in some queue different from Q 1 , . . . , Q 2 , then e ∈ E(G j ) and e ∈ E(G j ), for j, j ∈ {1, . . . , k}. If j = j , then e and e do not nest by induction. Otherwise, j = j and then the endpoints of e alternate with those of e in σ q , since the vertices in σ q min{j,j },i precede those in σ q max{j,j },i and the vertices in σ q min{j,j },i+1 precede those in σ q max{j,j },i+1 in σ q ; hence e and e do not nest. We now bound the number of queues we use for the inter-layer edges of G; we claim that this number is at most 2 · log 2 n. The proof is by induction on n; the base case n = 1 is trivial. For any subgraph H of G, let q(H) be the number of queues we use for the inter-layer edges of H, and let q(n ) = max H {q(H)} over all subgraphs H of G with n vertices. As proved above, q(G) ≤ 2 + max{q(G 1 ), . . . , q(G k )}. Since each graph G j has at most n/2 vertices, we get that q(G) ≤ 2 + q(n/2). By induction q(G) ≤ 2 + 2 · log 2 (n/2) = 2 · log 2 n.
Thus, the described queue layout uses · log 2 n queues for the intra-layer edges and 2 · log 2 n queues for the inter-layer edges, thus 3 · log 2 n queues in total. This concludes the proof.