On Linear Layouts of Graphs

In a total order of the vertices of a graph, two edges with no endpoint in common can be crossing , nested , or disjoint . A k-stack (respectively, k-queue , k-arch ) layout of a graph consists of a total order of the vertices, and a partition of the edges into k sets of pairwise non-crossing (respectively, non-nested, non-disjoint) edges. Motivated by numerous applications, stack layouts (also called book embeddings ) and queue layouts are widely studied in the literature, while this is the ﬁrst paper to investigate arch layouts. Our main result is a characterisation of k -arch graphs as the almost ( k + 1 ) -colourable graphs; that is, the graphs G with a set S of at most k vertices, such that G \ S is ( k + 1 ) -colourable. In addition, we survey the following fundamental questions regarding each type of layout, and in the case of queue layouts, provide simple proofs of a number of existing results. How does one partition the edges given a ﬁxed ordering of the vertices? What is the maximum number of edges in each type of layout? What is the maximum chromatic number of a graph admitting each type of layout? What is the computational complexity of recognising the graphs that admit each type of layout? A comprehensive bibliography of all known references on these topics is included.


Introduction
We consider undirected, finite, simple graphs G with vertex set V (G) and edge set E (G) A vertex ordering of an n-vertex graph G is a bijection σ : V (G) → {1, 2, . . ., n}.We write v < σ w to mean that σ(v) < σ(w).Thus < σ is a total order on V (G).We say G (or V (G)) is ordered by < σ .At times, it will be convenient to express σ by the list (v 1 , v 2 , . . ., v n ), where σ(v i ) = i.These notions extend † Research supported by NSERC and FCAR.
1365-8050 c 2004 Discrete Mathematics and Theoretical Computer Science (DMTCS), Nancy, France to subsets of vertices in the natural way.Suppose that V 1 ,V 2 , . . .,V k are disjoint sets of vertices, such that each V i is ordered by < i .Then (V 1 ,V 2 , . . .,V k ) denotes the vertex ordering σ such that v < σ w whenever v ∈ V i and w ∈ V j with i < j, or v ∈ V i , w ∈ V i , and v < i w.We write In a vertex ordering σ of a graph G, let L(e) and R(e) denote the endpoints of each edge e ∈ E(G) such that L(e) < σ R(e).Consider two edges e, f ∈ E(G) with no common endpoint.There are the following three possibilities for the relative positions of the endpoints of e and f in σ.Without loss of generality L(e) < σ L( f ).
• e and f nest and f is nested inside e: L(e) < σ L( f • e and f are disjoint: L(e) < σ R(e) < σ L( f Edges with a common endpoint do not cross, do not nest, and are not disjoint.A stack (respectively, queue, arch) in σ is a set of edges F ⊆ E(G) such that no two edges in F are crossing (respectively, nested, disjoint) in σ.Observe that when traversing σ, edges in a stack appear in LIFO order, and edges in a queue appear in FIFO order -hence the names.
A linear layout of a graph G is a pair (σ, {E 1 , E 2 , . . ., E k }) where σ is a vertex ordering of G, and {E 1 , E 2 , . . ., E k } is a partition of E(G).A k-stack (respectively, queue, arch) layout of G is a linear layout (σ, {E 1 , E 2 , . . ., E k }) such that each E ℓ is a stack (respectively, queue, arch) in σ.At times we write stack(e) = ℓ (or queue(e) = ℓ, arch(e) = ℓ) if e ∈ E ℓ .Layouts of K 6 of each type are illustrated in Figure 1.A graph admitting a k-stack (respectively, queue, arch) layout is called a k-stack (respectively, queue, arch) graph.The stack-number (respectively, queue-number, arch-number) of a graph G, denoted by sn(G) (respectively, qn(G), an(G)), is the minimum k such that G is a k-stack (respectively, k-queue, k-arch) graph.
Stack and queue layouts were respectively introduced by Ollmann [85] and Heath et al. [55,59].As far as we are aware, arch layouts have not previously been studied, although Dan Archdeacon ‡ suggests doing so.
Table 1 summarises some of the known bounds on the stack-number and queue-number of various classes of graphs.A blank entry indicates that a more general result provides the best known bound.Consider a vertex ordering σ = (v 1 , v 2 , . . ., v n ) of a graph G.For each edge v i v j ∈ E(G), let the width of v i v j in σ be |i − j|, and let the midpoint of v i v j be 1 2 (i + j).The band-width of σ is the maximum width of an edge of G in σ.The band-width of G, denoted by bw(G), is the minimum band-width over all vertex orderings of G. Consider the two fundamental observations:

Observation 1 ([59]
). Edges whose widths differ by at most one are not nested.
Observation 2. Distinct edges with the same midpoint are nested.
Observation 1 was made by Heath and Rosenberg [59].Remarkably, Observation 2 seems to have gone unnoticed in the literature on queue layouts.
Our main result is a characterisation of k-arch graphs, given in Section 3. We also survey various fundamental questions regarding each type of layout, and in the case of queue layouts, provide new and simple proofs (based on Observation 2) of a number of existing results.In Section 2 we consider how to partition the edges given a fixed vertex ordering.In Section 4 we analyse the computational complexity of recognising the graphs that admit each type of layout.In Section 5 we consider the extremal questions: what is the maximum number of edges in each type of layout, and what is the maximum chromatic number of a graph admitting each type of layout?Section 6 considers how to produce a queue layout of a graph G given queue layouts of the biconnected components of G.In Section 7 we give a simple proof of the known result that queue-number is in O( √ m).

Fixed Vertex Orderings
Consider the problem of assigning the edges of a graph G to the minimum number of stacks given a fixed vertex ordering σ of G.This problem is equivalent to colouring a circle graph with the minimum number of colours.(A circle graph is the intersection graph of a set of chords of a circle.)As illustrated in Figure 2(a), a twist in σ is a matching A vertex ordering with a k-edge twist needs at least k stacks, since each edge of a twist must be in a distinct stack.However, the converse is not true.There exist vertex orderings with no (k + 1)-edge twist that require Ω(k log k) stacks [71].Moreover, it is N P -complete to test if a fixed vertex ordering of a graph admits a k-stack layout [43]  § .On the other hand, Kostochka [72] proved that a vertex ordering with no 3-edge twist admits a 5-stack layout, and Ageev [1] proved that 5-stacks are sometimes necessary in this case.In general, Kostochka and Kratochvíl [71] proved that a vertex ordering with no (k + 1)-edge twist admits a 2 k+6 -stack layout ¶ , thus improving on previous bounds by Gyárfás [46,47].Hence the stack-number of a graph G is bounded by the minimum, taken over all vertex orderings σ of G, of the maximum number of edges in a twist in σ.Now consider the analogous problem for queue layouts: assign the edges of a graph G to the minimum number of queues given a fixed vertex ordering σ of G.As illustrated in Figure 2 The rainbow {v i w i : 2 ≤ i ≤ k} is said to be inside v 1 w 1 .We now give a simple proof of a result by Heath and Rosenberg [59].§ Unger [104,105] claimed that it is N P -complete to determine whether a given vertex ordering of a graph G admits a 4-stack layout, and that there is a O(n log n) time algorithm in the case of 3-stack layouts.Crucial details are missing from these papers.¶ Unger [104] claimed without proof that a vertex ordering with no (k + 1)-edge twist admits a 2k-stack layout.This claim is refuted by Ageev [1] in the case of k = 2.

Lemma 1 ([59]). A vertex ordering of a graph G admits a k-queue layout of G if and only if it has no
(k + 1)-edge rainbow.
Proof.A k-queue layout has no (k + 1)-edge rainbow since each edge of a rainbow must be in a distinct queue.Conversely, suppose we have a vertex ordering with no (k + 1)-edge rainbow.For every edge vw ∈ E(G), let queue(vw) be the maximum number of edges in a rainbow inside vw plus one.If vw is nested inside xy then queue(vw) < queue(xy).Hence we have a valid queue assignment.The number of queues is at most k.
Heath and Rosenberg [59] presented a O(m log log n) time algorithm that, given a fixed vertex ordering of a graph G with no (k + 1)-edge rainbow, assigns the edges of G to k queues.Lemma 1 implies that the queue-number of G is the minimum, taken over all vertex orderings σ of G, of the maximum number of edges in a rainbow in σ.Hence determining the queue-number of a graph is no more than the question of finding the right vertex ordering.Now consider the problem of assigning the edges of a graph G to the minimum number of arches given a fixed vertex ordering σ of G.As illustrated in Figure 2 Lemma 2 implies that the arch-number of a graph G is the minimum, taken over all vertex orderings σ of G, of the maximum number of edges in a necklace in σ.For example, an(K n ) = ⌊ n 2 ⌋.Now consider the following algorithm.
for each edge Given a vertex ordering σ of an n-vertex m-edge graph G, the algorithm ASSIGNARCHES(G, σ) assigns the edges of G to the minimum number of arches with respect to σ in O(n + m) time.
Proof.It is easily verified that the algorithm maintains the invariant that k i is the maximum number of edges in a necklace in the vertex ordering (v 1 , v 2 , . . ., v i ).Hence, for every edge vw ∈ E(G), arch(vw) is the maximum number of edges in a necklace that precedes vw plus one.Thus, as in Lemma 2, we have an assignment of the edges to the minimum number of arches.
The proofs of Lemmata 1 and 2 hide an application of the easy half of Dilworth's Theorem [26] for partitioning a poset into k antichains, where k is the maximum size of a chain.In Lemma 1, e ≺ f if e is nested inside f , and in Lemma 2, e ≺ f if R(e) < σ L( f ).The problem of assigning edges to queues in a fixed vertex ordering is equivalent to colouring a permutation graph [32].Assigning edges to arches corresponds to partitioning an interval graph into cliques.

Arch Layout Characterisation
. .,V k+1 be the colour classes in such a colouring.Let σ be a vertex ordering such that Clearly every necklace in σ has at most k edges.By Lemma 2, σ admits a k-arch layout of G.
(=⇒) The proof is by induction on k.For k = 0, the result is trivial.Suppose that an(G) It is simple to verify that the maximum number of edges in a necklace in V ≤p is equal to, or one less than, the maximum number of edges in a necklace in V ≤p+1 , for all 1 ≤ p ≤ n − 1.Consequently, there is maximum number i such that V ≤i admits a (k − 1)-arch layout.By the maximality of i, V ≤i+1 contains a k-edge necklace.Therefore V >i+1 is an independent set of G, otherwise an edge of G[V >i+1 ] together with the k-edge necklace of V ≤i+1 would comprise a (k + 1)-edge necklace.Therefore, G[V >i ] is a forest, at most one component of which is a star centred at v i+1 , and the remaining components are isolated vertices.
By the induction hypothesis there is a set Arch-number and chromatic number are tied in the following strong sense.
Theorem 2 implies that any graph family that has bounded chromatic-number also has bounded archnumber.Examples include graphs with bounded maximum degree, graphs with bounded tree-width, and graphs with an excluded clique minor, and so on.Proof.The Four Colour Theorem and Theorem 1 imply that all planar graphs have arch-number at most three.Any planar graph G containing three vertex-disjoint K 4 subgraphs is not almost 3-colourable.By Theorem 1, an(G) = 3.

Computational Complexity
The 1-stack graphs are precisely the outerplanar graphs [4], and thus can be recognised in O(n) time [78].2-stack graphs are characterised as the subgraphs of planar Hamiltonian graphs [4], which implies that it is N P -complete to test if sn(G) ≤ 2 [107].Heath and Rosenberg [59] characterised 1-queue graphs as the 'arched levelled' planar graphs, and proved that it is N P -complete to recognise such graphs.

Lemma 5. There is a O(n(n + m)) time algorithm to determine if a given n-vertex m-edge graph G has arch-number an(G) ≤ 1.
Proof.By Theorem 1, an(G) ≤ 1 if and only if there is a vertex v such that G \ v is bipartite.The result follows since bipartiteness can be tested in O(n + m) time by breadth-first search.
Note that almost bipartite graphs have been studied by Prömel et al. [90].
Open Problem 1.Is there a sub-quadratic time algorithm for determining whether an(G) ≤ 1?

Theorem 3. Given a graph G and an integer k ≥ 2, it is N P -complete to determine if G has arch-number
Proof.The problem is clearly in N P .The remainder of the proof is a reduction from the graph kcolourability problem: given a graph G and an integer k, is χ(G) ≤ k? Let G ′ be the graph comprised of k components each isomorphic to G. We claim that χ(G) ≤ k if and only if G ′ is almost k-colourable.The result will follow from Theorem 1 and since graph k-colourability is N P -complete [68].
The next result follows from the reduction in Theorem 3 and since it is N P -complete to determine if a 4-regular planar graph is 3-colourable [19,44].

Corollary 1. It is N P -complete to determine if a given 4-regular planar graph G has arch-number
an(G) ≤ 2.

Extremal Questions
In this section we consider the extremal questions: • what is the maximum number of edges in a particular type of layout?
• what is the maximum chromatic number of a graph admitting a particular type of layout?
The answer to the first question for stack layouts has been observed by many authors.

Lemma 6 ([4, 18, 69]). Every s-stack n-vertex graph has at most (s + 1)n − 3s edges, and this bound is tight for all even n ≥ 4 and all
Proof.It will be beneficial to view the vertex ordering (v 0 , v 1 , . . ., v n−1 ) as circular.Each edge v i v (i+1) mod n is said to be a boundary edge.Each stack has at most 2n − 3 edges, since a 1-stack graph is outerplanar.Every boundary edge can be assigned to any stack.Thus there are at most n − 3 non-boundary edges in each stack, and at most n boundary edges, giving a total of at most s(n − 3) + n = (s + 1)n − 3s edges.Now for the lower bound.As illustrated in Figure 3(a), for each 0 ≤ i ≤ s − 1, let Then E 0 , E 1 , . . ., E s−1 are edge-disjoint paths, each of which is a stack of n − 3 non-boundary edges.
Adding the boundary edges to any stack, we obtain an s-stack graph with the desired number of edges.Note that with s = n 2 , we obtain an n 2 -stack layout of K n .As observed by Bernhart and Kainen [4], Lemma 6 implies that (every induced subgraph of) an s-stack graph has a vertex of degree less than 2s + 2, and is therefore vertex (2s + 2)-colourable by the minimumdegree-greedy algorithm.This result can be improved for small s. 1-stack graphs are outerplanar, which are 3-colourable, and 2-stack graphs are planar, which are 4-colourable.
Open Problem 2. What is the maximum chromatic number χ of the s-stack graphs?In general, χ ∈ {2s, 2s + 1, 2s + 2} since χ(K n ) = 2 sn(K n ) for even n.Now consider the maximum number of edges in a k-queue graph.The answer for k = 1 was given by Heath and Rosenberg [59] and Pemmaraju [88].We now give a simple proof for this case.The proof by Heath and Rosenberg [59] is based on the characterisation of 1-queue graphs as the arched levelled planar graphs.The proof by Pemmaraju [88] is based on a relationship between queue layouts and 'staircase covers of matrices'.The observant reader will notice parallels between the following proof and that of the lower bound on the volume of three-dimensional drawings due to Bose et al. [13].

Lemma 7.
A queue in a graph with n vertices has at most 2n − 3 edges.
Proof.By Observation 2, distinct edges with the same midpoint are nested.Since every midpoint is in , there are at most 2n − 3 midpoints.The result follows since no two edges in a queue are nested.
An immediate generalisation of Lemma 7 is that every k-queue graph has at most k(2n − 3) edges [59].The following improved upper bound was first discovered by Pemmaraju [88] with a longer proof.That this bound is tight for all values of n and k is new.Lemma 8. Every n-vertex graph with queue-number k has at most 2kn − k(2k + 1) edges.For every k and n ≥ 2k, there exists an n-vertex graph with queue-number k and 2kn − k(2k + 1) edges Proof.First we prove the upper bound.Note that n ≥ 2k, since by Lemma 1, the corresponding vertex ordering has a k-edge rainbow.By Observation 2, distinct edges with the same midpoint are nested.Since at most k edges are pairwise nested in a k-queue layout, at most k edges have the same midpoint.Moreover, for all integers 1 ≤ i ≤ k, at most i − 1 edges have a midpoint of i, and at most i − 1 edges have a midpoint of i − 1 2 .At the other end of the vertex ordering, for all integers 1 ≤ i ≤ k − 1, at most i edges have a midpoint of n − i, and at most i edges have a midpoint of n − i + 1 2 .Since n ≥ 2k we are not double counting here.It follows that the number of edges is at most We now prove the lower bound.As illustrated in Figure 3(b), let P s n denote the s th power of the n-vertex path P n .That is, P s n has V (P s n ) = {v 1 , v 2 , . . ., v n } and E(P s n ) = {v i v j : |i− j| ≤ s}.Heath and Rosenberg [59] proved that qn(P 2k n ) = k for n ≥ 2k, where for each 1 ≤ ℓ ≤ k, the set of edges {v i v j : 2ℓ − 1 ≤ |i − j| ≤ 2ℓ} is a queue in the vertex ordering (v 1 , v 2 , . . ., v n ).(This is Observation 1.) Swaminathan et al. [100] proved that P 2k n has 2kn − k(2k + 1) edges.(P s n appears in [59,100] with regard to the relationship between band-width and queue-and stack-number, respectively.)Lemma 8 implies that (every induced subgraph of) a k-queue graph has a vertex of degree less than 4k, and is therefore 4k-colourable by the minimum-degree-greedy algorithm.
Open Problem 3. What is the maximum chromatic number χ of a k-queue graph?We know that χ ∈ {2k + 1, 2k + 2, . . ., 4k} since χ(K n ) = 2 qn(K n ) + 1 for odd n (by Lemma 1).Note that the extremal example P 2k n in Lemma 8 also has chromatic number 2k + 1.We now prove that the lower bound in Open Problem 3 is attainable in the case of k = 1.Lemma 9. Every 1-queue graph G is 3-colourable.
Proof.Let σ be the vertex ordering in a 1-queue layout of a graph G. Partition the vertices into independent sets V 1 ,V 2 , . . .,V k such that σ = (V 1 ,V 2 , . . .,V k ), and for all 1 ≤ i ≤ k − 1, there exists an edge in G[V i ∪ V i+1 ].Such a partition can be computed by starting with each vertex in its own set, and repeatedly merging consecutive sets that have no edge between them.For all s ≥ 3, there is no edge in any G[V i ∪ V i+s ], as otherwise it would be nested with an edge in G[V i+1 ∪ V i+2 ].Thus for each 0 ≤ j ≤ 2, W j = S {V i : i ≡ j (mod 3)} is an independent set, and {W 0 ,W 1 ,W 2 } is a 3-colouring of G.
The next lemma shows that, in terms of the maximum number of edges, arch layouts behave very differently from stack and queue layouts.Even 1-arch layouts may have a quadratic number of edges.
Lemma 10.The maximum number of edges in a k-arch layout with n vertices is at most which is attainable whenever k + 1 divides n − k.
Proof.Let G be a k-arch graph with n vertices and the maximum number of edges.By Theorem 1, G is almost (k + 1)-colourable.That is, there is a set S ⊆ V (G) of at most k vertices such that G \ S is (k + 1)colourable.Each vertex v ∈ S is adjacent to every other vertex in G, as otherwise G is not edge-maximal.The (k + 1)-colourable graph with the maximum number of edges is the complete (k + 1)-partite graph with partitions whose sizes are as equal as possible.Thus G \ S is this graph.When the partitions have the same size we obtain the most edges.Here, G \ S is obtained from K n−k by removing k + 1 vertex-disjoint copies of the complete graph on (n − k)/(k + 1) vertices.Thus the number of edges is which is easily seen to reduce to (1).

Biconnected Components
Clearly the stack-number (respectively, queue-number) of a graph is at most the maximum stack-number (queue-number) of its connected components.Bernhart and Kainen [4] proved that the stack-number of a graph is at most the maximum stack-number of its maximal biconnected components (blocks).We now prove an analogous result for queue layouts.

Lemma 11. Every graph G has queue-number
Proof.Clearly we can assume that G is connected.Let T be the block-cut-tree of G.That is, there is a node in T for each block and for each cut-vertex of G. Two nodes of T are adjacent if and only if one corresponds to a block B, and the other corresponds to a cut-vertex v, and v ∈ V (B).T is a tree, as otherwise a cycle in T would correspond to a single block in G. Root T at a node r corresponding to an arbitrary block R of G. Consider a cut-vertex v of G.The block containing v that corresponds to the parent node of v in T is called the parent block of v.The other blocks containing v are called child blocks of v.
There are no nested edges in any breadth-first vertex ordering of T [17].Let σ be a breadth-first vertex ordering of T starting at R, such that cut-nodes of T with a common parent block B are ordered in σ according to their order in the given queue layout of B. Now create a vertex ordering π of G from σ, as illustrated in Figure 4. Specifically, delete from σ all the nodes corresponding to cut vertices of G; replace r by the given queue layout of R; and for each block B = R whose parent node in T corresponds to a cut vertex v of G, replace the node in σ that corresponds to B by the given queue layout of B \ v.
An edge of G that is incident to a cut-vertex v and is contained in a child block of v is called a jump edge.According to the above algorithm, a cut-vertex of G is positioned within its parent block in π.Thus, if two non-jump edges are nested, then they are in the same block B, and are nested in the given queue layout of B. Since the blocks are separated, non-jump edges can inherit their queue assignment from the queue layout of their block.
Since the edges of T are not nested, and by the choice of ordering for cut-nodes of T with a common parent block, jump edges are not nested, and thus can form one new queue.Thus the total number of queues is as claimed.

A Bound on the Queue-Number
Malitz [76] proved that the stack-number of an m-edge graph is O( √ m).The exact bound is in fact 72 √ m.Heath and Rosenberg [59] (see also Shahrokhi and Shi [95]) observed that an analogous method proves that queue-number is O( √ m).We now establish this result using a simplified version of the argument of Malitz [76] and with an improved constant.(1) • n 2k (2) , where: (1) is an upper bound on the number of k-edge matchings M, (2) is the number of vertex positions in σ for M, and (3) is the probability that M with fixed vertex positions is a rainbow. Thus The number of vertices and edges of G are respectively denoted by n = |V (G)| and m = |E(G)|.The subgraph of G induced by a set of vertices S⊆ V (G) is denoted by G[S].G \ S denotes G[V (G) \ S], and G \ v denotes G \ {v} for each vertex v ∈ V (G).

Lemma 4 .
Planar graphs have arch-number at most three and this bound is tight.

Fig. 4 :
Fig. 4: Constructing a queue layout of G from queue layouts of the biconnected components of G.

Theorem 4 .
Every graph G with m edges has queue-number qn(G) < e √ m, where e is the base of the natural logarithm.Proof.Let n = |V (G)|.Let σ be a random vertex ordering of G.For all positive integers k, let A k be the event that there exists a k-edge rainbow in σ.Then the probability Pr{A k } ≤ m k