Data Structures and their Planar Graph Layouts

In a stack layout, also known as book embedding, the vertices of a graph are placed on a line and an edge is a data item that is pushed on the stack at the left vertex and removed at the right vertex. The LIFO principle of the stack is represented by a rainbow of nesting edges. We introduce linear cylindric drawings for the representation of the working principles of fundamental data structures including stack, queue, double-stack and deque. The resulting graphs are called stack (queue, double-stack, deque) graphs. We characterize the feasibility of a sequence of insertions and removals by planarity and use the graph classes to compare the relative power of these data structures. In particular, we show that the deque graphs are the linear cylindric planar graphs and are the subgraphs of the planar graphs with a Hamiltonian path. In comparison, the double-stack graphs are the graphs with a linear layout in the plane and are known as the subgraphs of the planar graphs with a Hamiltonian cycle. Hence, the power of the queue mode of a deque is expressed both by the differences between Hamiltonian path and Hamiltonian cycle and by linear layouts on the cylinder and in the plane. It is also reflected in the dual graph. Linear cylindric drawings provide an intuitive planar representation of the FIFO principle of a queue. We show that a queue graph augmented by a Hamiltonian path has a dual of the same type and that the dual has an Eulerian path. Finally, we study recognition problems. Submitted: August 2016 Reviewed: January 2018 Revised: February 2018 Accepted: March 2018 Final: March 2018 Published: March 2018 Article type: Regular paper Communicated by: G. Di Battista E-mail addresses: auerc@fim.uni-passau.de (Christopher Auer) bachmaier@fim.uni-passau.de (Christian Bachmaier) brandenb@informatik.uni-passau.de (Franz J. Brandenburg) brunner@fim.unipassau.de (Wolfgang Brunner) gleissner@fim.uni-passau.de (Andreas Gleißner) 208 C. Auer et al. Data Structures and their Planar Graph Layouts


Introduction
In his pioneering work on "The Art of Computer Programming" [31] D. E. Knuth studied fundamental data structures including stack, queue, double-stack and double-ended queue (deque).Here, a data structure D is a (doubly connected) list with insertions and removals of data items only at the ends, called the head and the tail.A sequence of insertions and removals of data items is feasible if all data items are inserted and removed at the ends of D. D is a stack if insertions and removals occur at the head, and a queue if data items are inserted at the head and removed at the tail.The resulting principles are "last in, first out" (LIFO) for a stack and "first in, first out" (FIFO) for a queue.If each item is removed at the side at which it is inserted, D is a double-stack and D is a deque if no restrictions apply.
The behavior of these data structures can be modeled by graphs, where each data item is represented by an edge and the endpoints mark the points of time of its insertion and removal.In a data structure, there is one action at a time which results in graphs with vertices of degree one.For general graphs, actions are grouped at a vertex if the time line of the actions is preserved at each vertex.Our paradigm says that the working principle of D is satisfied if and only if the graph is drawn planar under specific geometric constraints, which are described by a linear layout.
A linear layout of an undirected graph G = (V, E) is a total ordering ≺ of the vertices, which are placed left to right on a horizontal line according to ≺.It imposes a direction on each edge e = {u, v}, where we identify e with its directed version e = (u, v) if u ≺ v. Two edges e = (u, v) and e = (u , v ) with no common endpoints and u ≺ u have three possibilities for the relative positions of their endpoints: e and e nest if u ≺ u ≺ v ≺ v, twist if u ≺ u ≺ v ≺ v , and are disjoint if u ≺ v ≺ u ≺ v .A graph G = (V, E) has a D layout if there is a linear layout for the vertices and the edges are processed by a data structure D, such that each edge e = (u, v) is inserted to D at u and removed from D at v if u ≺ v in the linear layout.If the sequence of insertions and removals is feasible, G is called a D graph.
In a stack layout, the edges must obey the LIFO principle and thus either nest or are disjoint; twists are excluded.See Fig. 1(a) for a stack layout (without the dashed edge).The dashed edge twists (with (1,3)) and is invalid.In a queue layout under the FIFO principle the edges twist or are disjoint, whereas nesting edges are excluded.A queue layout (without the dashed edge) is shown in Fig. 1(b).The dashed edge and (1,4) nest and invalidate the layout.The LIFO principle of a stack is visualized by a rainbow of nesting edges.Such edges do not cross.To the contrary, the FIFO principle of a queue excludes the nesting of edges, and each pair of twisting edges induces a crossing.Thus, it is hard to check the correctness of a queue layout visually and to recognize the FIFO principle.A graph is a stack graph if it has a linear layout without twists or, equivalently, a planar drawing respecting the linear layout and with all edges above the line of the vertices, i.e., a 1-page book embedding.Analogously, a queue graph has a linear layout without a rainbow.One-page stack layouts are also known as book embeddings and were studied first by Atneosen [1], Ollman [32] and Kainen [30].Bernhart and Kainen [9] showed that the stack graphs are exactly the outerplanar graphs.They also characterized the double-stack graphs, where the set of edges is partitioned into two disjoint subsets such that no two edges in one subset twist in a given linear layout.The double-stack graphs were characterized as the spanning subgraphs of the planar graphs with a Hamiltonian cycle.The generalization to k-stack layouts or k-page book embeddings are obtained by a partition of the edges into k subsets each of which allows for a stack layout with the same linear ordering of the vertices [16,18,38], and to k-stack subdivisions or topological book embeddings, where edges can be replaced by paths.Then every planar graph has a 4-stack layout [38] and a 2-stack subdivision [18].Queue layouts were introduced by Heath, Leighton and Rosenberg [23,24] and were further studied in [2,3,14,16,18,17,37]. Queue graphs are planar, although a linear drawing of a queue layout contains many crossings.Heath and Rosenberg [24] characterized the queue graphs as the arched leveled-planar graphs.These graphs have a planar drawing in which the vertices are placed on horizontal levels.An edge either connects two vertices on adjacent levels or is an arch from the leftmost vertex on a level to vertices on the right side on the same level such that the right vertices are not obstructed by other edges to vertices on the lower level.A linear layout is obtained by ordering the vertices from bottom to top and from left to right on the levels.The arched leveled-planar drawing of the graph from Fig. 1(b) is shown in Fig. 1(c).Note that the dashed edge is invalid as it is an arch that is not incident to the leftmost vertex.A linear cylindric drawing in the fundamental polygon representation is shown in Fig. 1(d).Such layouts make the FIFO principle of queues clearly visible and are described next.
In this paper, we introduce linear cylindric drawings to display stack, queue, double-stack and double-ended queue (deque) layouts, and establish that a drawing is planar if and only if the sequence of insertions and removals of the edges in the data structure is feasible.In Section 3.1, we introduce linear cylindric drawings on the surface of the rolling 3D cylinder.The vertices are placed on a horizontal line, called the front line, that is parallel to the cylinder's axis and the edge curves do not cross the front line.Fig. 2(b) shows an example where the front line is dotted.A representation in the plane is obtained by "cutting" the cylinder's surface along the front line and unfolding it (see Fig. 2(c)).The vertices remain on the top side and each vertex has a clone on the bottom side.
In Section 3.3, we apply linear cylindric drawings to deque layouts, and prove that the deque graphs are exactly the graphs with a planar linear cylindric drawing.In consequence, all deque graphs are planar, which is unexpected as a deque is an extension of both a double-stack and a queue, the latter of which has many crossings in linear drawings.Linear cylindric planar drawings reflect the working principle of the deque by processing edges that wind around the cylinder as in a queue, whereas edges that enter both endpoints from either above or below the front line are processed as in a stack, as displayed in Fig. 2(b).In fact, the deque can be seen as a double-stack with a transfer of items from one stack to the other.If an item is owned by the stack into which it is inserted, then an item that is processed in queue mode is stolen by the other stack.Hence, the behavior of a deque is not that of a double-ended queue, and the full name is misleading.
Based on these insights, we prove in Section 3.4 that a graph is a deque graph if and only if it is a spanning subgraph of a planar graph with a Hamiltonian path.This result complements the known characterization of double-stack graphs as the spanning subgraphs of planar graphs with a Hamiltonian cycle [9].Thus, the additional "queue mode" ability of the deque in comparison to the double-stack exactly corresponds to the difference between Hamiltonian paths and cycles in planar graphs, and to planar linear layouts on the surface of a cylinder and in the plane.The difference between double-stack and deque layouts is also visible in the dual graphs, which are investigated in Section 3.5.Note that deques and double-stacks are equivalent in power as working tapes of nondeterministic linear time bounded Turing machines [33].
In Section 4, we apply our findings to queues.In comparison to linear drawings (Fig. 1(b)) and arched leveled-planar drawings (Fig. 1(c)), linear cylindric drawings (Fig. 1(d)) of queue layouts display the FIFO principle, and invalid queue operations are immediately recognizable as crossings.Further, we derive a novel characterization of queue graphs by means of their dual, and show that the dual of a queue graph augmented by a Hamiltonian path is a queue graph augmented by a Hamiltonian path.As a consequence, the dual of a queue graph has an Eulerian path.Recognition problems are studied in Section 5 and we conclude in Section 6 and illustrate new perspectives for linear cylindric drawings.
We consider undirected graphs G = (V, E) with vertices V and edges E. A path p in G consists of a sequence of vertices and edges from a vertex u to a vertex v and is denoted by p = u v.A path is simple if it contains no vertex twice.A cycle C is a path starting and ending at the same vertex, and is simple if all vertices are distinct except at the start and end.
A linear layout of G is a total ordering ≺ on the set of vertices V .The reflexive closure of ≺ is denoted by .A linear layout imposes a direction on each edge {u, v} ∈ E such that {u, v} is directed from u to v if u ≺ v.We identify each edge with its directed version whenever a linear layout is given.If u ≺ v, then u is a predecessor of v and v is a successor of u.If there is no vertex w with u ≺ w ≺ v, then u is the immediate predecessor of v and v is the immediate successor of u.The vertex with no predecessor is called the first vertex and the vertex with no successor is called the last vertex.
A drawing Γ of a graph G maps each vertex v ∈ V to a position Γ v in the plane and each edge e = {u, v} to an edge curve Γ e : [0, 1] → R 2 which is a simple Jordan arc between its endpoints.The set of points {Γ e (t) | 0 < t < 1} is the inner part of the edge curve Γ e .We call Γ planar if all vertex positions are distinct, no vertex lies on the inner part of an edge curve, and no two edge curves share points except for common endpoints, i. e., they do not cross.A graph is planar if it has a planar drawing.A rotation system R defines a cyclic clockwise ordering of the incident edges for each vertex v.We denote the rotation system R v at a vertex v by a total ordering e 0 , . . ., e k−1 of its incident edges where each edge e i has a successor edge e i+1 and a predecessor edge e i−1 , where indices are computed modulo k.Every planar drawing induces a planar rotation system.However, there are non-planar rotation systems for planar graphs, e. g., if a K 4 is drawn with a pair of crossing edges.A planar rotation system is in one-to-one correspondence with a planar embedding which specifies faces.Each face f is a connected region which is described by a such that e i ∈ E is the successor of e i−1 ∈ E according to the rotation system R vi .The edges and vertices of C are said to be incident to f and C in a clockwise traversal of f .The dual graph G * = (F, E * ) has a one-to-one correspondence between the vertices of G * and the faces of an embedding of G and between the edges of G and G * .For each edge e ∈ E there is a dual edge e * ∈ E * , where e * = {f, g} and f and g are the faces to which e is incident.Note that f = g is possible.For clarity, we always call the elements in V vertices and display them by circular shapes, and we call the elements in F faces and use rectangular shapes.A cut is a partition of V into proper subsets 19, pp. 149].Conversely, the primal edges of a cutset in G * constitute a simple cycle in G.
The surface of the 3D rolling cylinder is given by r is called cylindric.Γ and G are cylindric planar if Γ is planar.The standing cylinder is obtained by exchanging the roles of the x and z-coordinates.Note that the cylinder (and the sphere) and the plane are equivalent with respect to planarity, i. e., every planar graph is cylindric planar and vice versa.This does no longer hold true for planar upward drawings of directed planar graphs [4,10], and for linear layouts, as we shall show in Section 3.1.
3 Deque Graphs and Linear Cylindric Drawings

Linear Cylindric Drawings
Consider the surface C 3 r of the rolling cylinder and let h = {(x, y, z) ∈ C 3 r | y = 0 ∧ z = −1} be a straight-line segment on the cylinder's surfaces which is parallel to the cylinder's axis.We call h the front line.
r is linear cylindric (LC) if all vertices lie on the front line and no inner part of an edge curve has a point on the front line.The drawing and the graph are called linear cylindric planar (LC planar) if the edges do not cross.
Clearly, every graph has a (not necessarily planar) linear cylindric drawing by arbitrarily placing the vertices on distinct points on the front line and connecting them by edge curves which do not cross the front line.For an illustration, consider the planar graph from Fig. 2(a) and a possible LC drawing in Fig. 2(b) as a 3D projection.The front line is drawn dotted and the vertices are labeled according to their positions on the front line from left to right.The LC drawing is planar without the dashed edge.Some edges, e. g., {1, 4}, wind around the cylinder.A concentric representation is obtained by mapping the cylinder's surface onto a ring as shown in Fig. 2(d), where the edges that wind around the cylinder are spiral segments.Note that all types of representation are equivalent with respect to planarity since the surfaces have genus 0. Fig. 2(c) shows the fundamental polygon representation of the LC drawing in which the surface of the cylinder corresponds to the rectangle where the top and bottom sides are identified (indicated by the arrows).The front line coincides with the top and bottom of the fundamental polygon.Intuitively, the fundamental polygon representation is obtained from the rolling cylinder by "cutting" the cylinder's surface along the front line and unfolding it.Proposition 3.1 An LC planar graph is planar.
The fundamental polygon representation of LC drawings can also be seen as the drawing of an extended 2-level planar graph.In a k-level planar drawing of a graph G = (V, E), the vertices are placed on k horizontal lines and the edges are drawn as vertically strictly monotone curves without crossings.Then the set of vertices partitions into pairwise disjoint sets V 1 , . . ., V k so that the vertices of V i are placed on the i-th line.A graph is a k-level planar if it admits such a drawing, where the partition of the set of vertices is given [15,22,29].
An extended k-level drawing also admits intra-level [8,26] or track edges [7] between vertices on the same level.The other edges are called inter-level edges.Intra-level edges on level i are drawn as arches above or below the i-th line that do not cross the center line between adjacent levels.The k-level planarity problem, which is solvable in linear time [29], asks whether a graph together with a partition of its set of vertices admits a k-level drawing without edge crossings.In addition, the extended k-level planarity problem has a partition of the set of intra-level edges into the sets of edges above and below each level.It is also solvable in linear time if some requirements are fulfilled [26].
An extended two-level drawing is obtained from a linear cylindric drawing of graph G = (V, E) by taking a clone v of each vertex v.The vertices of V are placed on the first level and the clones are placed on the second layer such that the vertices and the clones obey the same permutation.If v is the i-th vertex from the left then so is v .There are edges {u, v } between vertices and clones, which are taken as inter-edges, and edges {u, v} and {u , v }, which are taken as intra-edges.The recognition problem asks whether there is a planar drawing, i. e., whether there is a single permutation for the vertices on both levels so that there are no crossings.However, this problem is N P-complete, as we shall show in Section 6.In consequence, viewing planar LC drawings as planar two-level drawings may be misleading.
In a planar LC drawing, the vertices are placed at distinct points on the front line which induces a linear layout ≺.Further, the edge curve of an edge e incident to a vertex v enters v from above or below the front line.For instance, in    (2,4) enters both of its endpoints from above, whereas edge (1, 4) enters 1 from below and 4 from above.This specializes the rotation system.The front line partitions the rotation system of v. Denote by E ⊥ (v) = (e ⊥ 1 , . . ., e ⊥ k ) the edges incident to v that enter v from above, where E ⊥ (v) is totally ordered according to the rotation system of v in clockwise direction.Likewise, the edges E (v) = (e 1 , . . ., e ) are the edges that enter v from below and E (v) is totally ordered in counterclockwise direction of v's rotation system.Thus the cw rotation system of v is partitioned into two sequences with a left-to-right order.We call the tuple Λ = (≺, E ⊥ , E ) an LC rotation system and, if it is obtained from a planar LC drawing, we call it planar.A rotation system of a vertex v in a planar LC drawing is illustrated in Fig. 3.Note that an LC rotation system is not necessarily planar, since the prescribed order may enforce crossings.

Deque Layouts
A deque is a linear list with two sides, a head h and a tail t, at which data items are inserted and removed.In our case, data items are edges of a graph.At any time instant, the current state of the deque is given by its content C = (e 1 , . . ., e k ) (k ≥ 0), where e 1 is at the deque's head and e k at its tail.The deque is empty if k = 0. We say e i ∈ C if e i appears in C. A content C = (e 1 , e 2 , . . ., e k ) induces a total ordering of the edges in C with e 1 e 2 . . .e k .If C = (e 1 , . . ., e k ) (k ≥ 1), edge e 1 can be removed at the head and e k can be removed at the tail which results in (e 2 , . . ., e k ) and (e 1 , . . ., e k−1 ), respectively.These and only these removals are feasible.Inserting an edge e at the head or tail transforms a deque's content C = (e 1 , . . ., e k ) to C = (e, e 1 , . . ., e k ) or C = (e 1 , . . ., e k , e), respectively.
In a graph layout by the deque, the vertices are visited according to a linear layout ≺, and the edges are processed at their endpoints.We start with an empty deque at the first vertex.At each vertex v, all incoming edges from predecessors must be removed from the deque and all outgoing edges to successors must be inserted into the deque.Each edge is processed at the head or the tail.For each vertex v, let E h (v) = (e h 1 , . . ., e h k ) and E t (v) = (e t 1 , . . ., e t ) be a partition of v's incident edges into two sets, both of which are totally ordered.The edges in E h (v) (E t (v)) are processed at the head (tail) of the deque in order.That is, at vertex v, starting with e h 1 , all edges in E h (v) are inserted and removed at the head in order, depending on whether they are incoming or outgoing.
Likewise, all edges in E t (v) are processed at the tail in order.We call the tuple Σ = (≺, E h , E t ) a deque schedule.A deque schedule is called a deque layout if all operations are feasible.A graph is a deque graph if it has a deque layout.
Note that an edge can always be inserted at either side of a deque.However, at the removal it must be at the head or tail, as otherwise another edge is blocking its way and the deque cannot operate properly.At each vertex v, we assume that all edges in E h (v) are processed before the edges in E t (v), since operations at opposite sides do not interfere.An edge e is called stack edge if it is inserted and removed at the same side and queue edge otherwise.Suppose that two edges e and e are processed at the head such that e is removed and e is inserted.Then inserting e first would imply that e e, which makes it impossible to remove e at the head.Hence, there is a local ordering of incoming and outgoing edges.
for some 0 ≤ i ≤ k such that all edges in E h Pred (v) are removed at the head, and all edges in E h Succ (v) are inserted at the head.
The same holds true for E t (v).Processing the edges of a deque graph G according to a deque schedule Σ is described by a trajectory τ (Σ).The trajectory maps each vertex to two points in the plane and each edge to a polyline.
Let v 1 ≺ v 2 ≺ . . .≺ v n be the linear layout of G and for each vertex Let s 0 = 0 and let s i denote the size of the deque after v i .Then where s i ≥ 0 and s n = 0 and |L| denotes the length of list L. The deque is empty at the start and at the end.
The trajectory τ (Σ) maps each vertex v i to points (i, 0) and (i, max{s i−1 , s i }), called the head and tail positions.It can be seen as a two-level drawing.Each processed edge at v i is drawn as a straight line to a point on a small circle of radius 0.25 around the positions of v i .The edges of E h Succ (v i ) are in the first quadrant and those of E h Pred (v i ) in the second quadrant of the head position (i, 0), and those of E t Pred (v i ) and E t Succ (v i ) are in the third and forth quadrants of the tail position, respectively, as illustrated in Fig. 3.If C(v i ) = (e 1 , . . ., e k ) is the content of the deque after v i , then there is a bend point P (v i , e j ) = (i+0.5,j−0.5) for each edge e j .If edge e is inserted at the head of the deque at v i , then draw a straight line from the endpoint of e on the circle around the head point of v i to P (v i , e), and if e is removed at v i , then draw a straight line from P (v i−1 , e) to the endpoint of e on the circle, and similarly if e is processed at the tail.If edge e remains in the deque, then draw a straight line from P (v i−1 , e) to P (v i , e).Note that the position of e in the deque may change due to insertions and removals of edges at v i , and e may be the h-th edge from the head of the deque before v i and the j-th edge after v i .Clearly, j can be computed from h and the deque schedule Σ.The trajectory of an edge e is a polyline that begins at the head or tail position of vertex v i where e is inserted and ends at vertex v j where e is removed.Intermediately, it first passes a point on the circle around v i in the first or forth quadrant, then it goes through points P (v p , e) for p = i, . . ., j − 1 and finally it enters the circle around v j in the second or third quadrant.The trajectory of the Σ from Fig. 2(b) is shown in Fig. 4, including the illegal edge (3,8).The fundamental polygon representation in Fig. 2(c) is a smoothed version with all tail positions moved to the upper boundary.

Deque Graphs and Planar Linear Cylindric Graphs
Our first main result describes the power of a deque in terms of linear cylindric planar graphs, and conversely, shows that linear cylindric planar graphs can be processed on a deque.
Theorem 1 A graph is a deque graph if and only if it is LC planar.
We use an LC rotation system Λ = (≺, E ⊥ , E ) for an LC drawing of a graph G and describe a graph layout in the deque by a deque schedule Σ = (≺, E h , E t ).Both are the same objects with the same linear ordering of the vertices and a partition of the incident edges at each vertex.Even more, the equivalence "planar ⇔ feasible" holds, and this implies Theorem 1.
There is a partition for planar LC rotation systems similar to the one for deque layouts given in Proposition 3.2, as Fig. 5 illustrates.
Lemma 1 Let Λ = (≺, E ⊥ , E ) be a planar LC rotation system.For each vertex v, the total ordering of the edges in for some 0 ≤ i ≤ k such that all edges in E ⊥ Pred (v) are incident to predecessors of v, and all edges in The same holds true for E (v).Proof: For contradiction, suppose that there is a vertex v and edges e ⊥ i and e ⊥ j in E ⊥ (v) = (e ⊥ 1 , . . ., e ⊥ k ) such that i < j and e ⊥ i is incident to a successor w of v and e ⊥ j is incident to a predecessor u of v.The situation is depicted in Fig. 6(a).As the inner part of the edge curve of e ⊥ j has no point in common with the front line, the edge curve of e ⊥ j and the front line enclose a region R (shaded in Fig. 6(a)).Edge e ⊥ i enters v from above and has no point in common with the front line except for its endpoints, and thus crosses the boundary of R. The other endpoint w of e ⊥ i lies outside R as if w would lie within, an inner point of e ⊥ j 's edge curve would lie on the front line.Consequently, the inner part of e ⊥ i 's edge curve has points inside and outside R which inevitably leads to a crossing by Jordan's curve theorem; a contradiction to the planarity of the LC rotation system.The proof for E (v) is analogous.
Similarly, if e ⊥ j enters u from below, it encloses a region R together with the front line as illustrated in Fig. 6(b) and the proof is analogous.Fig. 5 shows how the rotation system in a planar LC rotation system is split according to Lemma 1.
Lemma 2 Let Σ = (≺, E h , E t ) be a deque schedule and let Λ = (≺, E ⊥ , E ) be an LC rotation system with Σ = Λ.Σ is a deque layout if and only if Λ is planar.
Proof: ⇒: Consider the trajectory τ (Σ) of a deque layout Σ.The polylines of two edges e and e do not cross, since once they are inserted, their ordering in the deque is unchanged by insertions and removals of edges at the vertices.Hence, τ (Σ) is planar.Now, transform τ (Σ) into an LC planar drawing by moving the tail position of vertex v i to (i, s), where s is the maximum size of the deque and then map all points to the surface of a cylinder by a transformation (x, y) → ( x n , 2 π s cos y, 2 π s sin y).Obviously, both transformations preserve planarity.⇐: In the following, we assume that Λ is a planar LC rotation system but, towards a contradiction, Σ is no deque layout.As insertions to the deque never cause trouble, there must be an edge which cannot be removed from the deque because another edge is blocking its way.Let e = (u, v) and e = (u , v ) with u ≺ v and u ≺ v be two such edges.We assume that e is inserted to the deque before e such that u u ≺ v by Lemma 1.We distinguish five cases according to the side of the insertion and removal of the edges.
Case 1: Both e and e are stack edges.We assume that both edges are inserted and removed at the head.As e is inserted before e , we get e e. Removing e is not possible if and only if e is removed before e and, thus, v v , where for v = v edge e comes before e in E h (v).If v ≺ v , then u u ≺ v ≺ v and we obtain a twist (Fig. 7(a)) and there is an inevitable crossing between e and e .If v = v and e comes before e in E h (v), we also obtain an inevitable crossing as shown in Fig. 7(b).Hence, Λ were not planar.
Case 2: Both e and e are queue edges inserted at the same side.If both edges are inserted at the head, then e e and we have no deque layout if and only if e has to be removed before e.Hence, u u ≺ v v and e nests e .We obtain the situation in Fig. 7(c); again a contradiction to the planarity of Λ.The reasoning is analogous if e and e are inserted at the tail.
Case 3: Both e and e are queue edges inserted at different sides.In the LC drawing, e and e always cross as shown in Fig. 7(d).
Case 4: e is a stack and e a queue edge.We assume that e is inserted at the head and distinguish two cases: either e is inserted at the head or at the tail.In the first case, e e and e neither can be removed from the head nor e from the tail.We obtain the situation in Fig. 7(e) and Λ cannot be planar.If e is inserted at the tail, then e e .Now, removing e from the head is always possible.However, removing e before e is not possible.This is the case if and only if v ≺ v, or v = v and e comes before e in E h (v).For the LC drawing, we obtain the situation in Fig. 7(f) and an inevitable crossing.
Case 5: e is a queue and e a stack edge.By swapping the role of e with e , and h with t, and reversing the linear layout, the proof of this case is analogous to the previous one.
Altogether, we have obtained a contradiction and can conclude that Σ is a deque layout.
For an illustration, consider Fig. 2(c), where we ignore the dashed edge for the moment.From the planar LC drawing, we obtain the planar LC rotation system Λ = (≺, E ⊥ , E ), which is used as a deque schedule, and Fig. 4 shows the obtained trajectory.The ordering in which the vertices are processed for the deque layout is equal to the ordering of the vertices on the front line of the LC drawing.The head and tail correspond to the regions above and below the front line, respectively.If e = (v, w) is an edge with e ∈ E ⊥ (v), e. g., edge (2,4) in Fig. 2(c) in the LC layout, then e ∈ E h (v) in the deque layout.Likewise, any edge in E (v) is processed at the tail of the deque.An edge is a queue edge if and only if it winds around the cylinder and has its endpoints on opposite sides of the fundamental polygon.In Fig. 2(c), stack edges remain inside the regions of the head or the tail, which is shaded.The content of the deque is given by a vertical scan line from bottom to top.The dashed edge (3,8) causes an error at vertex 7, since the content is ((6, 7), (6,8), (5,8), (4, 7), (3,8), (3,7), (5,7)) and (3,8) blocks the removal of (4,7).Furthermore, at each vertex the incoming edges from predecessors must be removed before the outgoing edges to successors.
From Theorem 1 and Proposition 3.1 we obtain: Corollary 3.1 Deque graphs are planar.

Deque Graphs and Hamiltonian Paths
The double-stack graphs are the planar sub-Hamiltonian graphs [9], where Hamiltonian means the class of graphs with a Hamiltonian cycle.Here we extend this characterization to deque graphs and Hamiltonian paths.
Theorem 2 A graph is a deque graph if and only if it is a spanning subgraph of a planar graph with a Hamiltonian path.
Proof: Consider an LC drawing of G according to the deque schedule and an LC rotation system Σ = (≺, E h , E t ), which is planar by Lemma 2. Augment G by the edges E = {(u, v) ∈ E | v is the immediate successor of u according to ≺}.
Then G = (V, E ∪ E ) has a Hamiltonian path given by ≺.The edges of E can be drawn close to the front line of the cylinder and do not cross other edges, so that G is planar.e q e p (a) For the converse, let G = (V, E) be a planar graph with a Hamiltonian path P = (v 1 , . . ., v n ) and endowed with a planar clockwise rotation system R. Let n ≥ 2 as otherwise G consists of a single vertex and is a deque graph.We construct a planar LC rotation system Λ P = (≺, E ⊥ , E ) from G's rotation system and the Hamiltonian path P , where P plays the role of a guideline and splits the rotation system at each vertex into an upper and a lower part.The linear layout ≺ is the ordering of the vertices on P .Let R vi = (e 1 , . . ., e p−1 , e p , e p+1 , . . ., e q ) be the rotation system of v i .For each inner vertex v i with 1 < i < n on P , let e p be the edge to the immediate successor v i+1 of v i and e q the edge to the immediate predecessor v i−1 of v i on the Hamiltonian path.Fig. 8(a) illustrates the rotation system of v i , where the edges e p and e q are drawn bold.Let E ⊥ (v i ) = (e q , e q−1 , . . ., e p+1 , e p ) and E (v i ) = (e 1 , e 2 , . . ., e p−2 , e p−1 ).Note the reverse ordering in E ⊥ (v i ).The so obtained LC rotation system is illustrated in Fig. 8(b).For the extreme vertices v 1 and v n on P , we define the LC rotation system of v 1 (v n ) such that all edges enter v 1 (v n ) from above.If e p is the first edge on P to v 2 and e q is the last edge from v n−1 to v n , then E ⊥ (v 1 ) = (e p−1 , e p−2 , . . ., e 2 , e 1 , e p ) such that E (v 1 ) is empty, and E ⊥ (v n ) = (e q , e q−1 , . . ., e 2 , e 1 ) and E (v n ) is empty.
It remains to show that there is a planar LC drawing of G that respects the constructed LC rotation system Λ P = (≺, E ⊥ , E ).By the construction of Λ P , the Hamiltonian path is aligned with the front line and planarity ensures that no edge curve has as a point in common with the front line.We now show that Λ P is planar.For contradiction, assume that every such LC drawing has at least one crossing.Let e and e be two crossing edges, where e = {v i , v j }.There is a cycle C formed by the edge e and the path from v i to v j which is part of the Hamiltonian path.Circle C encloses a region R such that at least one inner point of the edge curve of e lies within R and one inner point lies outside R. Recall that G is endowed with a planar rotation system R and, hence, it has a planar drawing Γ which induces R. By construction, R is the rotation system induced by the LC drawing Γ P .Thus, cycle C encloses a region R in Γ such that at least one inner point of the edge curve of e must lie within R and one inner point must lie outside, which causes a crossing in Γ by Jordan's curve theorem.This contradicts the planarity of Γ and, hence, Λ P is planar.
The constructions from the second part of the proof of Theorem 2 lead to the following generalization.Let G be a graph endowed with a not necessarily planar rotation system R and assume that G contains a Hamiltonian path P .Let Λ P = ⊥ , E ) be the LC rotation system obtained from R and P , such that P splits the rotation systems at the vertices and defines a deque schedule Σ P = Λ P .Λ P and Σ P are called P-induced.From Theorems 1 and 2 we obtain: Corollary 3.2 Let G be a graph endowed with a rotation system and assume that G contains a Hamiltonian path P .Further, let Λ P and Σ P be the P-induced LC rotation system and P-induced deque schedule, respectively.The following statements are equivalent: (i) The rotation system of G is planar.
(ii) Λ P is a planar LC rotation system.
(iii) Σ P is a deque layout.
The relative power of double-stacks and deques can now be compared from the viewpoint of linear graph layouts.A double-stack is a specialization of a deque.The surplus of a deque is the "queue mode" with insertions and removals at opposite sides.What does this really mean?How large is the gap between a double-stack and a deque?The queue mode of a deque is reflected by the queue edges.These wind around the cylinder, and so they preserve the FIFO structure.This property is captured by upward planar drawings of directed graphs.Upward means that the edge curves must be monotone in y-direction.
Here, the plane is strictly weaker than the sphere which is equivalent to the standing cylinder [4,10,13,21].The difference between upward planar graphs in the plane and on the sphere lies in an (s, t)-edge from the lowest to the highest vertex, which prevents edges from winding around the cylinder.
On the other hand, the ability to process queue edges in addition to stack edges exactly corresponds to the difference between Hamiltonian paths and Hamiltonian cycles in planar graphs.Moreover, we shall show in Section 3.5 that the missing edge closing the Hamiltonian cycle crosses all queue edges.

Duals of Deque Graphs
The difference between double-stack and deque graphs is also reflected in the dual graphs.Consider the maximal planar graph depicted in Fig. 9(a is shaded.Now, the inner part of each edge not on the Hamiltonian cycle either lies completely in R or in R. By identifying R with the head and R with the tail of a deque, we obtain the double-stack layout displayed in Fig. 9(b), where the linear layout is obtained by splitting the Hamiltonian cycle between vertices 8 and 1.
We can apply the same line of arguments to deque layouts, however, with an intriguing twist.Fig. 9(c) shows the Goldner-Harary graph G GH [20] which is the smallest maximal planar graph with no Hamiltonian cycle.The edges drawn bold belong to the Hamiltonian path (1, . . ., 11).Therefore, G GH is a deque but no double-stack graph.We use the same idea as before to construct the deque layout.Consider the open curve defined by the Hamiltonian path in Fig. 9(c).We close the curve by proceeding in the dual graph.First, connect vertex 11 with face f to which 11 is incident.The choice of face f is arbitrary as long as vertex 11 is incident to f .Then, we find a path in the dual graph from face f to face g, where vertex 1 is incident to g, such that we never use any dual edge of the Hamiltonian path.Finally, connect g to 1 and close the curve.Thereby, we obtain a simple closed curve C that partitions the plane into regions R and R (shaded).Again, identify R with the head and R with the tail.The linear layout is the ordering of the vertices on the Hamiltonian path.The corresponding LC drawing is shown in Fig. 9(d).As with the double-stack graph from before, we have edge curves within either R or R which are stack edges, e. g., edge (1,4).Consider the edges that cross C. For instance, edge (3, 10) starts within R and ends within R which means that it is inserted at the tail and removed at the head of the deque.In general, all queue edges cross C and they are exactly the primal of the edges on the path from f to g in the dual.We comprise these observations in the following theorem which we use later to characterize queue graphs: Theorem 3 Let G = (V, E) be a graph with a planar rotation system and a Hamiltonian path P = (v 1 , . . ., v n ) consisting of edges E P .Let G * = (F, E * ) be the dual of G and E * P the dual edges of E P .Further, let f 1 , f p ∈ F be two faces such that v 1 is incident to f p and v n is incident to f 1 .Then: Q be the set of edges traversed by Q * and let E Q be the primal edges of E * Q .G has a deque layout Σ = (≺, E h , E t ) such that ≺ is the ordering of the vertices on P , and an edge e ∈ E is a queue edge if and only if e ∈ E Q .
Proof: (i): Suppose for contradiction that there is no path f 1 f p in G * P .Since G has a Hamiltonian path, G is connected and so is its dual G * .Hence, there is a path from f 1 to f p in G * but removing the dual edges of the Hamiltonian path disconnects f 1 from f p .Denote by F C the set of faces f for which there is a path The dual edge e * must be in E * P , as otherwise there would be a path from f 1 to g.Hence, E * C ⊆ E * P and E C ⊆ E P , where E C are the primal edges of E * C .As E * C is a cutset, E C forms a cycle in G.However, then the Hamiltonian path contains a cycle which is a contradiction.Therefore, there is a simple path from f 1 to f p .
(ii): It was shown by Tutte [34] that a planar graph G = (V, E) and its dual G = (F, E * ) can be drawn simultaneously such that each of G and G * is drawn planar, all faces are placed within the regions to which they correspond, and each primal edge e crosses its dual e * exactly once.Let Γ be such a simultaneous drawing of G and G * .The situation is illustrated in Fig. 10(a).Denote by Γ P the set of points in Γ of the simple curve defined by the Hamiltonian path P in G (drawn bold in Fig. 10(a)).By (i), there is a simple path Q * = f 1 f p in G * (shaded line between f 1 and f p ). Γ Q * denotes the set of points in Γ that belong to Q * .Since Q * contains no edge of E * P , Γ P and Γ Q * are two disjoint simple curves.We connect these two curves as follows: Let Γ v1 be the position of v 1 and Γ fp be the position of f p .Since v 1 is incident to f p , there is a simple curve from v 1 to f p that shares no point with Γ except for its endpoints (dashed line between v 1 and f p ).Likewise, there is a simple curve from v n to f 1 (dashed line between v n and f 1 ).Altogether, we obtain the simple and closed curve C that partitions R 2 into regions R and R (shaded).
Let Λ = (≺, E ⊥ , E ) be the LC rotation system induced by the Hamiltonian path.Recall that the Hamiltonian path P splits the rotation system of each vertex v into the edges that enter v from above and from below, and the rotation systems of v 1 and v n can be split arbitrarily.In the construction of C, we have connected v 1 with f p by a curve which can be seen as an edge curve.Together with the edge to vertex v 2 , the rotation system of v 1 is split as shown in Fig. 10(b), where the curve between v 1 and f p is dashed.The edges that enter v 1 within R (R), enter v 1 from above (below) in the LC rotation system Λ.Likewise, the rotation system of v n is split.The so obtained LC rotation system is planar, as shown in the proof of Theorem 2, and the corresponding deque schedule Σ = (≺, E h , E t ) is a deque layout by Corollary 3.2.Now, let e * be an edge on Q * and let e = {u, v} be its primal.By construction, the edge curve of e crosses C exactly once, e. g., e 1 in Fig. 10(a).This implies that e either enters u within R and v within R or vice versa.Hence, e enters u from above and v from below or vice versa.In both cases, e is a queue edge in Σ.Further, let e be an edge such that the inner part of its edge curve lies completely within R, e. g., edge e 2 .Then, e enters both its endpoints from above and is, thus, a stack edge inserted at the head in Σ.Likewise, an edge that lies within R is a stack edge inserted at the tail in Σ.This proves (ii).
In conclusion, the additional power of a deque over a double-stack is to connect the endpoints of the Hamiltonian path via the dual, which in turn produces queue edges.Conversely, if a graph can be augmented to a planar graph with a Hamiltonian path such that its endpoints are incident to the same face, we can connect these endpoints in the dual without traversing any dual edges.Hence, we need no queue edges and the graph is a double-stack graph.

Queue Graphs
Our results on deque graphs have relevant implications on queue graphs.A queue is a restricted deque, where all edges are queue edges inserted at the head and removed at the tail.With this specialization we have queue schedules Σ = (≺, E h , E t ), queue layouts and queue graphs and we can conclude: Corollary 4.1 A queue schedule Σ is a queue layout if and only if the LC rotation system Λ with Λ = Σ is planar.Now there are three ways to display queue layouts.First, in the common way, where each twist generates a crossing [16,18,24], which is bad from the viewpoint of graph drawing (Fig. 1(b)).Second, the arch leveled drawings from [24] are planar, however, they do not reflect the FIFO principle (Fig. 1(c)).Also, it is quite cumbersome to construct such a drawing, and to check an infeasibility.Why is the dashed edge in Fig. 1(c) illegal?If we keep this edge, which others must be removed?Finally, our linear cylindric drawings (see Fig. 11(b)) are planar, the FIFO principle is made transparent by a scan line and illegal edges are directly recognizable.
The restriction to queue edges has a strong impact on the dual of queue graphs.The addition of the edges between the vertices that are consecutive in the linear layout or on a Hamilton path results in a multi-graph, whose distinguished property is that the dual is of the same type.The added edges are not necessarily queue edges; they could be used as stack edges in a deque, and are taken for the Hamilton path, which implies that the original queue edges are all crossed in the dual graph when connecting the endpoints of the Hamiltonian path.
Given a linear layout ≺ and a graph G = (V, E Q ), the ≺-augmentation and v is the immediate successor of u in ≺}.We specialize Theorem 3 for queue graphs.
Let v 1 and v n be the first and last vertex of the Hamiltonian path with edges E P .Then G ≺ has an embedding with dual ≺ \ E * P that contains all edges E * Q .
Proof: Let Σ ≺ be the ≺-augmentation of Σ, where Σ ≺ is a deque schedule of G ≺ that equals Σ for all edges in E Q and all edges in E P are stack edges processed at the head.Note that Σ ≺ is not necessarily a queue layout.Let Λ ≺ = (≺, E ⊥ , E ) be the LC rotation system with Λ ≺ = Σ ≺ .Then Λ ≺ is planar by Lemma 2, and we obtain an embedding of G ≺ with dual graph G * ≺ = (F ≺ , E * Q ∪ E * P ).Further, G ≺ contains the Hamiltonian path E P with first vertex v 1 and last vertex v n .Now, we apply Theorem 3 and choose f 1 and f p so that all edges in E Q that are incident to v 1 enter v 1 from above and all edges in E Q incident to v n enter v n from below.Hence, there is a simple path Given a ≺-augmentation G ≺ = (V, E Q ∪E P ) of a queue graph, we say that an embedding of G ≺ is an augmented queue embedding (with Hamiltonian path E P and queue edges E Q ) if it fulfills the properties of Lemma 3.This augmented queue embedding can readily be constructed following the proof of Lemma 3.
Proof: The only if direction follows from Lemma 3.For the if-direction, note that the augmented queue embedding of G ≺ and the Hamiltonian path induce a deque layout Σ ≺ = (≺, E h , E t ) where all edges in E P are stack edges and all edges in E Q are queue edges.Removing all edges E P from G ≺ yields G, which is then a queue graph.
Figs. 12(a) and 12(b) show the augmented queue embedding of G ≺ = (V, E Q ∪ E P ) (solid) and its dual G * ≺ = (F, E * Q ∪ E * P ) (dashed) of the queue graph in Fig. 11(b) (without the dashed edge).Note that all edges of E P enter their endpoints from above, whereas all edges in E Q change sides.G ≺ is a multigraph as it contains the edge (6, 7) twice.Interestingly, the dual has the same type as the primal: The duals of E Q , denoted by E * Q , are a Hamiltonian path Q * = f 1 , . . ., f 10 in G * ≺ .Let ≺ * be the linear layout of G * ≺ in order of Q * , e. g., f i ≺ * f j ⇔ i < j for all 1 ≤ i, j ≤ 10 in Figs.12(a) and 12(b).The duals of E P , denoted by E * P , behave like queue edges: For instance, the dual of (4, 5) ∈ E P is edge (f 3 , f 8 ) which enters f 3 from below and f 8 from above.Thus, the embedding of G * ≺ is an augmented queue embedding with Hamiltonian path E * Q and queue edges E * P .Put differently, Hamiltonian path edges and queue edges switch roles when going from the primal to the dual.In fact, this characterizes augmented queue embeddings: The following are equivalent: (i) The embedding of G is an augmented queue embedding, where E P is the Hamiltonian path and E Q are the queue edges.
(ii) The embedding of G * is an augmented queue embedding, where E * Q is the Hamiltonian path and E * P are the queue edges.Proof: (i) ⇒ (ii): Let v 1 , . . ., v n be the Hamiltonian path with edges E P and let ≺ be the respective linear layout.As the embedding of G is an augmented queue embedding, there exist two faces f 1 and f p such that v n is incident to f 1 , v 1 is incident to f p , and there is a simple path f form a simple cycle in G that consists of Hamiltonian path edges, which is a contradiction.As Q * visits each face at least once, it contains all edges in E * Q .Further, Q * is simple and, thus, is a Hamiltonian path of G * from f 1 to f p .
Let Λ * = (≺ * , E * ⊥ , E * ) be the LC rotation system of G * as induced by the Hamiltonian path Q * .We can assume that all edges incident to f 1 enter f 1 from above and all edges incident to f p enter f p from below.Let Σ * = (≺, E * h , E * t ) be the deque schedule with Σ * = Λ * .Due to planarity and Theorem 3, Λ * is planar and Σ * is a deque layout.It remains to show that all edges in E * P are queue edges in Σ * that are inserted at the head and removed at the tail.
As in the proof of Theorem 3, we assume that we are given a simultaneous drawing of G and G * , which are both drawn planar according to the given LC rotation systems, all faces are placed within the regions to which they correspond, and each primal edge e crosses its dual e * exactly once.For every edge e ∈ E P ∪ E Q , let l(e) and r(e) denote the endpoints of e with v 1 l(e) ≺ r(e) v n .Then r(e) is the immediate successor of l(e) on the Hamiltonian path E P if e ∈ E P , and if e ∈ E Q , then e is inserted at l(e) and removed at r(e) in the queue layout of G. Analogously, for every edge e * ∈ E * P ∪ E * Q , l(e * ) and r(e * ) are the faces to which e is incident and f 1 * l(e * ) ≺ * r(e * ) * f p .By assumption, all edges incident to f 1 enter f 1 from above and, hence, are inserted at the head in Σ * .Likewise, all edges incident to f p are removed at the tail.
Let e * ∈ E * P be an edge such that f 1 ≺ * l(e * ) ≺ * r(e * ) ≺ * f p .In the remainder of the proof, we show that e * enters l(e * ) from above and r(e * ) from below the Hamiltonian path E * Q .The situation is depicted in Fig. 13, where again the dual edges are drawn dashed for clarity.The dual edge e * must lie in the shaded region, which forms a "tube" and guarantees that e * enters its endpoints from the correct sides.We start by defining the elements that form the border of the "tube".
As l(e * ) ≺ * r(e * ) there is an edge e * 1 ∈ E * Q on the Hamiltonian path of G * such that l(e * ) * l(e * 1 ) ≺ * r(e * 1 ) * r(e * ).Its primal e 1 is a queue edge and enters l(e 1 ) from above and r(e 1 ) from below by our assumption.For the endpoints of e 1 , we show that: v 1 l(e 1 ) l(e) ≺ r(e) r(e 1 ) v n . ( First, e 1 crosses its dual e * 1 between l(e * ) and r(e * ) on the Hamiltonian path of G * since l(e * ) * l(e * 1 ) ≺ * r(e * 1 ) * r(e * ).Second, e 1 enters l(e 1 ) from above and r(e 1 ) from below by assumption.Hence, if l(e) ≺ l(e 1 ) or r(e 1 ) ≺ r(e), then e 1 would cross e * which is not possible as e 1 is not the primal of e * .Note that this crossing exists independently of the sides from which e * enters its endpoints.Hence, Eq. ( 1) follows.
The edge curves of e 1 and the edges on the Hamiltonian path between l(e 1 ) and r(e 1 ) enclose a region R in the drawing, where, w. l. o. g., f p is situated within R. By definition, the endpoints of e * 2 lie between r(e * ) and f p on the Hamiltonian path of G * .Thus, the position of the crossing of e 2 with e * 2 is between r(e * ) and f p and, in particular, between the crossing of e * 1 with e 1 and the position of f p .Recall that vertex v 1 is incident to f p .For these reasons and due to the planarity of the drawing of G, the inner part of the edge curve of e 2 lies completely within R. Further, e 2 enters l(e 2 ) from above and r(e 2 ) from below and, hence, v 1 l(e 2 ) l(e 1 ) and l(e 2 ) ≺ r(e 2 ) r(e 1 ).It remains to show that r(e 2 ) l(e).For this, consider the crossing of e * with e.If l(e) ≺ r(e 2 ), then e 2 would cross e * which is not possible as e * is not the dual of e 2 .Hence, Eq. ( 2) follows.
By symmetric arguments, there is an edge e 3 ) * l(e * ), where the primal e 3 of e * 3 has the properties: r(e) l(e 3 ) ≺ r(e 3 ) and r(e 1 ) r(e 3 ) v n .
Consider the bounded region R ⊥ enclosed by the curve that consists of the following elements of the drawing (shaded and above the front line in Fig. 13): • The edge curves on the Hamiltonian path E P of G from l(e 1 ) to l(e 3 ), where l(e 1 ) l(e) ≺ r(e) l(e 3 ) by Eqs. ( 1) and ( 3).
• The part of the edge curve of e 3 from l(e 3 ) to the crossing point x 3 of e 3 with dual edge e * 3 .
• The edge curves of the Hamiltonian path E * Q from x 3 to the crossing point x 1 between e 1 and e * 1 .
• The part of the edge curve of e 1 from x 1 to l(e 1 ), which closes the curve.
Additionally, we define the bounded region R which is enclosed by the following elements of the drawing (shaded and below the front line in Fig. 13): • The edge curves on the Hamiltonian path E P of G from r(e 2 ) to r(e 1 ), where r(e 2 ) l(e) ≺ r(e) r(e 1 ) by Eqs. ( 1) and (2).
• The part of the edge curve of e 1 from r(e 1 ) to the crossing point x 1 of e 1 with dual edge e * 1 .
• The edge curves of the Hamiltonian path E * Q of G * from x 1 to the crossing point x 2 of e 2 with e * 2 .
• The part of the edge curve of e 2 from x 2 to r(e 2 ), which closes the curve.
Note that due to the properties of e 1 , e 2 , and e 3 , both curves we have just constructed are non-selfintersecting and, thus, R ⊥ and R are well defined.They force the edge curve of e * to enter its endpoints from the correct sides.First note that the crossing point of e with e * lies on the boundaries of both R ⊥ and R as l(e 1 ) l(e) ≺ r(e) l(e 3 ) and r(e 2 ) ≺ l(e) ≺ r(e) r(e 1 ), respectively.Moreover, l(e * ) is on the boundary of R ⊥ and r(e * ) is on the boundary of R .Hence, all inner points of the edge curve of e * are within R ⊥ ∪ R as otherwise e * cannot cross its primal e.Consequently, e * enters l(e * ) from within R ⊥ and, by the construction of R ⊥ , e * must enter l(e * ) from above.Similarly, e * enters r(e * ) from within R and, thus, from below.We can conclude that e * is a queue edge in the deque schedule Σ * inserted at the head and removed at the tail.
For an edge e * with endpoint f 1 , an analogous reasoning shows that e * is removed at the tail, and if e * has endpoint f p , it is inserted at the head.
(ii) ⇒ (i): The proof is similar with swapped roles of primal and dual.
From Corollary 4.3 and Theorem 4, we obtain the following characterization of queue graphs: that G ≺ has an augmented queue embedding with Hamiltonian path E P and queue edges E Q .
(iii) G is a spanning subgraph of a ≺-augmentation G ≺ = (V, E Q ∪ E P ), where G ≺ has an embedding such that the embedding of its dual G * ≺ = (F, E * Q ∪E * P ) is an augmented queue embedding with Hamiltonian path E * Q and queue edges E * P .
Theorem 4 shows that the FIFO principle of a queue is represented in the dual of queue graphs.The dual Hamiltonian path E * Q defines a linear ordering of the faces of the queue graph, which simultaneously reflects the linear ordering of insertions and of removals of data items.Accordingly, the ≺-augmentation of a stack graph G = (V, E S ∪ E P ) with stack edges E S processed at the tail and Hamiltonian path E P (drawn bold) yields a tree for the dual which is a (weak) dual of an outerplanar graph and reflects the LIFO principle (see Fig 14(a)).For the double-stack, the dual consists of two trees which are glued at their leaves and have a common root.The deque combines the stack with the queue and we obtain trees, for the stack edges, whose roots are connected by a path by the queue edges (see Fig. 14(b) for an example).
For another observation, let a graph G = (V, E Q ∪ E P ) be endowed with an augmented queue embedding.Then, G * = (F, E * Q ∪ E * P ) is endowed with an augmented queue embedding with Hamiltonian path Q * , which is also Eulerian on E * Q as each edge of E * Q is traversed exactly once.Now, we remove an edge e ∈ E P from G. In the dual G * , this is equivalent to contracting the dual edge e * of e, i. e., the endpoints of e * are identified.In the obtained dual graph, Q * is not Hamiltonian anymore as one face is visited twice.However, Q * is still Eulerian and it remains so after removing all edges of E P from G. The obtained graph G \ E P is a queue graph and is endowed with a planar LC rotation system that corresponds to a queue layout.
Corollary 4.5 If G is a queue graph with queue layout Σ such that G is embedded according to the corresponding LC rotation system Λ = Σ, then G * contains a Eulerian path.

Recognition Problems
The recognition problems have been raised and settled for stack, queue and deque graphs.Deciding whether a graph is a one-stack graph can be done in linear time as it is equivalent to testing outerplanarity [9,35].The other decision problems are N P-complete, and were proved in [11,36] for a double-stack, in [6] for a deque, and in [24] for a queue.For a double-stack and a deque, the N P-hardness is due to the existence of a Hamiltonian cycle or path in a planar drawing.
A planar deque schedule Σ takes its viewpoint at the vertices and sees only the tail or the head of an edge but not the other endpoint.If the other endpoint is taken into account, then it defines an edge classification and partitions the set of edges into ∪ E th , where, e. g., E hh is the set of edges that leave and enter the deque at the head.Thereby, it classifies the edges into first and second stack edges E hh and E tt , and upward and downward queue edges E th and E ht , respectively.The situation is similar for a planar LC rotation system.
Recall from Section 3.1 that the fundamental polygon representation of an LC drawing can be seen as an extended two-level drawing with intra-level and inter-level edges [8,26], so that the vertices on the upper level (at the tail) are clones of the vertices on the lower level (at the head), or vice versa.The queue edges are inter-level edges and the stack edges intra-level edges.The LC drawing is planar if and only if the two-level drawing is planar.
For the recognition problem of extended k-level graphs, we are given a partition of the vertices so that the vertices of V i are placed on the i-th level, and an edge partition of the intra-level edges E i between vertices of V i into the sets of edges E a i ∪ E b i above and below the i-th level.We search for k permutations π 1 , . . ., π k , one for the vertices of each level, so that the extended k-level drawing obtained by ordering the vertices of V i according to π i is planar.This is the k-level planarity problem if there are no intra-level edges, and is solvable in linear time [29].The extended k-level problem with intra-edges is solvable in linear time if, for every i, the subgraph induced by the set of edges below level i consists of a single connected component [26].
In contrast, the recognition problem for deque graphs (or LC graphs) asks for an edge partition and a single permutation for the vertices (on both sides of the fundamental polygon or two levels) such that the drawing is planar.This problem is N P-complete [6], even if there are only inter-level edges [11,36] or only intra-level edges [24].
In consequence, LC drawings should not be regarded as two-level drawings when the recognition problem is taken into account.
The recognition problem for deque graphs can be specialized such that either an edge partition or a linear ordering of the vertices, i. e., a Hamiltonian cycle (path), is given.
Lemma 4 There is a linear time algorithm that computes the edge classification of a deque (double-stack) graph if the Hamiltonian path (cycle) is given.
Proof: Since a deque graph G is planar, we run a dfs-based planarity test [12,19,28] so that the Hamiltonian path is the leftmost path in the initial dfs-tree.If there is a Hamilton cycle first remove one edge.Then the algorithm flips the remaining edges to the left or to the right of this path, in which case they are stack edges that enter the deque from one side, or the edges go from one side to the other, in which case they are queue edges, see also [5].The planarity test algorithms run in linear time.
Note that the problem of minimizing the number of stacks for a k-stack layout of a graph is N P-complete if the linear ordering of the vertices is fixed [24].Thus the edge classification problem becomes hard if the objective is a minimum number of stacks, even if the linear ordering of the vertices is given.
The recognition problems reveals another distinction between deque and double-stack graphs.An instance of the edge-partitioned deque graph recognition problem consists of a graph G = (V, E) and an edge partition E = E hh .
∪ E th and it asks for a planar deque layout such that E hh is the set of edges that leave and enter the deque at the head, and similarly for E ht , E th and E tt .
Theorem 5 The edge-partitioned deque graph recognition problem is (i) N P-complete for deque graphs and for queue graphs, (ii) solvable in linear time for double-stack graphs.
Proof: (i) follows from the N P-completeness of recognizing queue graphs [24], where E = E ht , and the fact that queue graphs are deque graphs without stack edges.If there are only queue edges, then edges of E th can be converted into edges of E ht , since the deque must be empty after the removal of an upward queue edge and before the insertion of a downward queue edge, as shown in the proof of Lemma 1.
(ii) has been proved by Hong and Nagamochi [27] for the identical setting of 2-page book embedding with a given assignment of edges to pages.
We have introduced linear cylindric drawings as a new drawing technique to display the working principles of a stack, double-stack, queue and deque, respectively.There is a one-to-one correspondence between feasibility and planarity.Conversely, an invalid operation is directly visible as a crossing.We characterized the deque graphs as the graphs with a linear cylindric planar drawing and as the subgraphs of planar graphs with a Hamiltonian path.In comparison, the double-stack graphs are the graphs with a linear drawing in the plane and are the subgraphs of planar graphs with a Hamiltonian cycle.Hence, the gap between a deque and a double-stack is "small" and consists of a single edge from the first to the last vertex that either augments a Hamiltonian path to a Hamiltonian cycle or excludes winding edges around the cylinder.However, the gap is "large" for the recognition problem if an edge partition is given.The differences between deque and double-stack graphs are summarized in Table Linear cylindric drawings are well-suited for queue layouts.Then all edges wind around the cylinder or connect vertices on opposite sides of the fundamental polygon by straight lines, and they do not cross.This makes them superior to common drawings with twists and to arched leveled-planar drawings [16,18], as Fig. 1 illustrates.Queue graphs have the special property that the dual of their augmentation by a Hamiltonian path is of the same type and the dual of a queue graph has an Eulerian path.
Stack and queue layouts and stack and queue graphs were studied at several places.Yet, the relationship between stack and queue layouts is not fully understood.Heath and Rosenberg [24] showed that there is an outerplanar graph with seven vertices that is not a queue graph.It is an extended complete binary tree with edges between vertices on the same level.There was no example for the converse.Graph G from Fig. 15 is a subdivision of K 4 and thus not outerplanar, but is it a queue graph.Note that K 4 is neither a (1-)stack graph nor a (1-)queue graph.Hence, the classes of 1-stack graphs and 1-queue graphs are incomparable, and the class of 1-queue graphs is not minor-closed, whereas the class of 1-stack graphs is closed under taking minors.Heath and Rosenberg showed that every 1-stack graph has a 2-queue layout and every 1-queue graph has a 2-stack layout.The latter also follows from Corollary 4.3.
Recall that it is open whether stack-number is bounded by queue-number and conversely [18,23], where the stack-number (queue-number) of a graph is the minimum k such that G has a k-stack layout (k-queue layout).The queuenumber of planar graphs is bounded by O(log 4 n) [14], whereas the stack-number is at most four [38].
Linear cylindric drawings can be used to represent input-and output restricted deques from [31].A head (tail) of an output restricted deque does not allow removals at the head (tail).These restrictions simplify the drawings, since the set E th (E ht ) of the edge partition is empty.
There are maximal planar graphs without a Hamiltonian cycle, such as the Goldner-Harary graph (Fig. 9(c)), and without a Hamiltonian path [25].Hence, the deque (double-stack) is not powerful enough to capture all planar graphs.In [5] a splittable deque was introduced as an extension of a deque and it was shown that a graph is planar if and only if it has a layout in the splittable deque.The surplus is to split a deque into sub-deques, and the splits are controlled by a depth-first search tree.
The usefulness of our approach can also be exploited for the representation of mixed data structures, such as a stack and a queue.A stack-queue layout of a graph is given by a linear ordering of the vertices and a partition of the edges into stack edges and queue edges, which each have a planar layout.However, such graphs are no longer planar, since, e.g., K 3,3 admits such a representation, and our paradigm does not longer hold.Classes of graphs from mixed data structures are not well-understood.It is known that every graph has a 3-stack subdivision, a 2-queue subdivision, or a 1-stack 1-queue subdivision [18].But 1-deque graphs are planar, and so are their subdivisions.This fact shows again that the stack and the queue modes of a deque restrict one another, and that a deque is not a double-ended queue, as the full name, given by D. E. Knuth [31], may suggest.

Figure 1 :
Figure 1: Examples of (a) a stack layout, (b) a queue layout, (c) its arched leveled-planar drawing, and (d) its LC drawing in the fundamental polygon representation.The dashed edges are invalid.

Figure 2 :
Figure 2: Illustration of graph drawings.(a) a planar graph and a common drawing, (b) an LC drawing as 3D-projection, (c) the fundamental polygon representation and (d) a concentric representation of the LC drawing.

Figure 3 :
Figure 3: The rotation system at a vertex v defines total orders of the sets E ⊥ (v) and E (v).

Fig. 2 (
Fig.2(c), edge(2,4) enters both of its endpoints from above, whereas edge(1,4) enters 1 from below and 4 from above.This specializes the rotation system.The front line partitions the rotation system of v. Denote by E ⊥ (v) = (e ⊥ 1 , . . ., e ⊥ k ) the edges incident to v that enter v from above, where E ⊥ (v) is totally ordered according to the rotation system of v in clockwise direction.Likewise, the edges E (v) = (e 1 , . . ., e ) are the edges that enter v from below and E (v) is totally ordered in counterclockwise direction of v's rotation system.Thus the cw rotation system of v is partitioned into two sequences with a left-to-right order.We call the tuple Λ = (≺, E ⊥ , E ) an LC rotation system and, if it is obtained from a planar LC drawing, we call it planar.A rotation system of a vertex v in a planar LC drawing is illustrated in Fig.3.Note that an LC rotation system is not necessarily planar, since the prescribed order may enforce crossings.

Figure 6 :
Figure 6: Illustration to the proof of Lemma 1: A crossing is inevitable if an edge e ⊥ j to a predecessor comes after an edge e ⊥ i to a successor, where edge e ⊥ j

Figure 7 :
Figure 7: Cases obtained in the proof of Lemma 2. (a) Both edges are stack edges processed at the head.(b) Both edges are stack edges incident to u and processed at the head.(c) Both edges are queue edges inserted at the same side.(d) Both edges are queue edges inserted at different sides.(e) e is a stack and e a queue edge inserted at the head.(f) e is a stack and e a queue edge inserted at the tail.(g) e is a queue and e a stack edge.

Figure 8 :
Figure 8: (a) Rotation system of an inner vertex v i of a graph with a Hamiltonian path and (b) the obtained LC rotation system.

Figure 9 :
Figure 9: (a) A maximal planar graph with a Hamiltonian cycle and (b) the obtained double-stack layout.(c) The Goldner-Harary graph with a Hamiltonian path and (d) its deque layout.

Figure 10 :
Figure 10: Situation obtained in the proof of Theorem 3. (a) Connecting the endpoints of the Hamiltonian path P and Q * encloses the region R. (b) The rotation system of v 1 is split by the Hamiltonian path and by the curve connecting v 1 and f 1 .

Figure 11 :
Figure 11: (a) A planar graph and (b) its queue layout.

Figure 12 :
Figure 12: The augmented queue embedding and its dual (dashed) of the queue graph in Fig. 11(b), (a) in fundamental polygon representation and (b) in concentric representation.

Figure 13 :
Figure 13: Situation obtained in the proof Theorem 4.

Figure 14 :
Figure 14: The dual (a) of an augmented stack graph and (b) an augmented deque graph.

Table 1 :
Differences between double-stack and deque graphs