Linear Layouts of Graphs with Priority Queues
Abstract
A linear layout of a graph consists of a linear ordering of its vertices and a partition of its edges into pages such that the edges assigned to the same page obey some constraint. The two most prominent and widely studied types of linear layouts are stack and queue layouts, in which any two edges assigned to the same page are forbidden to cross and nest, respectively. The names of these two layouts derive from the fact that, when parsing the graph according to the linear vertex ordering, the edges in a single page can be stored using a single stack or queue, respectively. Recently, the concepts of stack and queue layouts have been extended by using a double-ended queue or a restricted-input queue for storing the edges of a page. We extend this line of study to edge-weighted graphs by introducing priority queue layouts, that is, the edges on each page are stored in a priority queue whose keys are the edge weights. First, we show that there are edge-weighted graphs that require a linear number of priority queues. Second, we characterize the graphs that admit a priority queue layout with a single queue, regardless of the edge-weight function, and we provide an efficient recognition algorithm. Third, we show that the number of priority queues required independently of the edge-weight function is bounded by the pathwidth of the graph, but can be arbitrarily large already for graphs of treewidth two. Finally, we prove that determining the minimum number of priority queues is -complete if the linear ordering of the vertices is fixed.
Keywords and phrases:
linear layouts, recognition and characterization, priority queue layoutsCopyright and License:
2012 ACM Subject Classification:
Mathematics of computing Graph algorithms ; Mathematics of computing Graph theoryAcknowledgements:
This work was initiated at the Annual Workshop on Graph and Network Visualization (GNV 2023), Chania, Greece, June 2023.Funding:
Research of E. Di Giacomo and W. Didimo partially supported by: (i) Italian MUR PRIN Proj. 2022TS4Y3N – “EXPAND: scalable algorithms for EXPloratory Analyses of heterogeneous and dynamic Networked Data”; (ii) Italian MUR PRIN Proj. 2022ME9Z78 – “NextGRAAL: Next-generation algorithms for constrained GRAph visuALization”; (iii) Italian MUR PON Proj. ARS01 00540 – “RASTA: Realtà Aumentata e Story-Telling Automatizzato per la valorizzazione di Beni Culturali ed Itinerari”.Editors:
Pat Morin and Eunjin OhSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Stack layouts were introduced by Bernhart and Kainen in 1979 [13] with the motivation to study a “quite natural” edge decomposition technique. A stack layout is a linear layout, that is, the vertices are positioned on a line with the edges being embedded on several half-planes, called pages, delimited by . In a stack layout, edges embedded on the same page are forbidden to cross, a rule that contributed to their original designation as book embeddings. An example of stack layout on one page is depicted in Figure 1(b). The minimum number of pages required to obtain a stack layout of a graph is called the stack number. After their introduction, stack layouts attracted notable interest in the field of theoretical computer science due to their capacity to model certain aspects in several domains, including VLSI design [17, 18], fault-tolerant multiprocessing [18, 41], RNA folding [28], and traffic-light control [33]. This led, in particular, to a series of papers investigating upper bounds on the stack number of planar graphs [16, 29, 32] and culminating at an upper bound of four [43]. Bekos et al. [11] and Yannakakis [44] independently proved that this upper bound is tight.
The name stack layout derives from the fact that the edges assigned to the same page can be stored using a stack as follows [17]. Assume that is a horizontal line and consider the left-to-right ordering of the vertices. Now, consider a left-to-right sweep of and the set of edges assigned to a page . Initially, the stack storing is empty. At vertex , all edges that have as their right endpoint are popped from the stack. Since all vertices are at the same side of the half-plane delimited by , the edges ending at are necessarily the last ones that have started prior to encountering , so they are precisely the edges on top of the stack. Afterwards, edges starting at are pushed onto the stack. (Note that the order of the pushes is determined by the right endpoints of the corresponding edges.)
Based on this latter interpretation of stack layouts, Heath, Leighton and Rosenberg [30, 31] proposed to study queue layouts of graphs where the edges occurring on the same page of the linear layout can be represented by a queue. More precisely, edges ending at are first dequeued from a queue, after which edges beginning at are enqueued during the left-to-right sweep of . Thus, edges on the same page are allowed to cross but forbidden to properly nest. An example of a queue layout on one page is shown in Figure 1(c). Surprisingly, these quite non-planar representations still found many practical applications, including scheduling [14], VLSI [35], and, a decade after their inception, 3D crossing-free graph drawing [21, 24]. Similarly to stack layouts, one is interested in minimizing the number of pages required to obtain a queue layout, which is known as the queue number. However, in contrast to the stack number, the queue number of planar graphs remained elusive for several decades during which only sublinear (but non-constant) upper bounds have been found [1, 5, 6, 22]. The first significant difference between planar and non-planar graphs was only demonstrated in 2019 when it was shown that bounded degree planar graphs have bounded queue number [9], whereas non-planar bounded degree graphs were already known to not have this property [42]. Recently, Dujmović et al. [23] proved that the queue number of planar graphs is bounded by a constant. Minor improvements have since been made [10, 26].
Another interesting recent direction in investigating linear layouts is to expand beyond stack and queue layouts by using other data structures for partitioning edges. For instance, mixed linear layouts allow the usage of both stack and queue pages [2, 19, 38], whereas deque layouts use double-ended queues which allow to insert and pull edges from the head and the tail [3, 4, 12], and rique layouts use restricted-input queues which are double-ended queues where insertions are allowed to occur only at the head [8].
Our contribution.
The wide range of applications of linear layouts and the fact that they have been restricted so far to unweighted graphs, naturally motivate extensions of the notion of linear layout to edge-weighted graphs. For example, in scheduling applications, the edges of a graph can represent processes, each with an associated priority; each vertex of the graph enforces that all processes corresponding to edges incident to begin simultaneously; among the running processes, those with higher priority must be completed first. Edge weights can also model constraints in other classical applications of linear layouts, such as logistics networks modelled as switchyard networks [34, 37], where adjacent edges represent containers that must be pushed or popped simultaneously across different storage locations. The weight of an edge corresponds to the weight of its container, and it may be necessary to ensure that containers stacked on top of others are lighter.
We introduce a model called priority queue layout, or simply PQ-layout. This model utilizes priority queues for the storage of edges assigned to the same page, where the edge weights correspond to the priorities (i.e., keys) for the data structure. As for stack and queue layouts, in a PQ-layout all vertices of the graph lie on a horizontal line , and the edges are assigned to different priority queues according to a left-to-right sweep of . When an edge is dequeued, it must have the minimum priority among the edges stored in the same priority queue as . See Figure 1(d) for an example, and refer to Section 2 for a formal definition of our model. Note that, unlike stack and queue layouts, our model allows edges in the same page to cross or properly nest, provided that they have suitable weights.
Following a current focus of research on linear layouts, we mainly study the priority queue number of edge-weighted graphs, that is, the number of pages required by their PQ-layouts:
(i) We provide non-trivial upper and lower bounds for the priority queue number of complete graphs (Section 3). (ii) We characterize the graphs that have priority queue number 1, regardless of the edge-weight function (Section 4). (iii) We investigate the priority queue number of graphs with bounded pathwidth and bounded treewidth (Section 5). (iv) We prove that deciding whether an edge-weighted graph has priority queue number (for a non-fixed integer ) is -complete if the linear ordering of the vertices is fixed (Section 6).
We remark that, as far as we know, there is only one previous study in the literature about using linear layouts of edge-weighted graphs [7]; however, this study uses edge weights to further restrict stack layouts. For space restrictions, proofs of statements marked with a (clickable) () are omitted or sketched. We provide the missing proofs in the full version [20].
2 PQ-Layouts
Let be an edge-weighted graph, that is, is an undirected graph and is an edge-weight function. A priority queue layout, or simply a PQ-layout, of consists of a linear (left-to-right) ordering of the vertices of and a partitioning of the edges of into sets , where each set is called a page and is associated with a priority queue. For each page with , the following must hold: when traversing the linear ordering (from left to right) and performing, at each encountered vertex , the operations O.1 and O.2 (in this order), condition C.1 must always hold.
-
O.1
Each edge having as its right endpoint is pulled from the priority queue. We do not count as active any more.
-
O.2
Each edge having as its left endpoint is inserted into the priority queue of with key . We say that becomes active. Two edges being active at the same time (even though they may have become active in different steps) are called co-active.
-
C.1
There is no pair of co-active edges and such that has as its right endpoint, has a distinct right endpoint, and . In other words, among the active edges of , the edges having as their right endpoint have the smallest edge weights.
PQ-layouts can be equivalently defined by the absence of the forbidden configuration F.1.
-
F.1
For some , there are two edges and such that , , and .
The order of and is irrelevant for F.1. For completeness, the resulting three arrangements of the involved vertices are illustrated in Figures 2(a), 2(b), and 2(c). Note that the forbidden pseudo-nesting in Figure 2(b) requires . In contrast, the symmetric case where is never forbidden. This is a direct consequence of the asymmetry between the insert and pull operations of priority queues. Thus, unlike for stack and queue layouts, the reverse vertex ordering does not necessarily provide a PQ-layout.
Nesting.
Pseudo-Nesting.
Crossing.
We refer to the linear ordering of vertices also by the ordering along the spine. For a PQ-layout of any graph, let denote the number of priority queues in . Now, the priority queue number of is the minimum integer for which there exists a PQ-layout of with .
For any given graph , there always exists an edge-weight function such that . It is enough to assign the same weights to all edges but it is also possible to use distinct edge weights. Namely, define any linear ordering of the vertices and visit the vertices in this ordering. When a vertex with is visited, assign consecutive (non-negative) integer weights to all edges for which is the right endpoint such that the weights monotonically increase. Hence, any graph with any given linear ordering of its vertices can have priority queue number 1 if we can choose the edge-weight function. However, the edge-weight function may be provided as part of the input. Thus, it is interesting to study bounds on the priority queue number of families of graphs that hold independently of the edge-weight function. To this end, for a graph without any prescribed edge-weight function, the priority queue number is the minimum integer such that for every possible edge-weight function we have .
Some of our proofs utilize configurations where every pair of edges must be assigned to distinct priority queues. Let be an edge-weighted graph, let be a vertex ordering of , and let be an integer such that . We define a -inversion to be a sequence of edges in with pairwise distinct right endpoints , respectively, such that (i) , where and are called the left and right end, respectively, (ii) the left endpoint of each of appears to the left of in , and (iii) . See Figure 2(d) for an illustration. Any two edges in a -inversion form a forbidden configuration and thus must be assigned to distinct priority queues. In other words, if, for edge weights of , every vertex ordering of contains a -inversion, then and hence .
3 Priority Queue Number of Complete Graphs
In this section, we concentrate on complete graphs and complete bipartite graphs. We start with a simple upper bound for the complete graph on vertices.
Observation 1.
.
Proof.
Choose an arbitrary ordering of the vertices and define the sets (priority queues) . For each , assign all edges whose right endpoint is to . Clearly, no forbidden configuration occurs, independent of the edge-weight function.
Next, we consider bipartite graphs, that is, the graphs whose vertex sets are the union of two disjoint independent sets and . In the literature on linear layouts, separated linear layouts, where vertices of precede the vertices of or vice versa, have been considered for bipartite graphs [25]. The separated priority queue number of a bipartite graph is the minimum such that, for any edge-weight function, there is a PQ-layout that is a separated linear layout and . We can easily determine the separated priority queue number of the complete bipartite graph . At the end of this section, we will use the separated priority queue number to give a lower bound on the priority queue number of complete and complete bipartite graphs.
Theorem 2.
.
Proof.
First observe that : place the vertices of the larger set, say , before the vertices of the smaller set, say . Then, independent of the edge weight function, for each vertex , all edges ending at can be assigned to a separate page.
To show , assume w.l.o.g. that the vertices in precede the vertices in . Consider an edge weight function where, at every vertex , each edge weight in occurs at least once among ’s incident edges. In any bipartite PQ-layout of , denote the vertices of by in the order they appear along the spine. In , is incident to an edge with weight , is incident to an edge with weight , etc., is incident to an edge of weight 1. This is a -inversion requiring at least pages.
Theorem 2 also provides an upper bound for the (non-separated) priority queue number of . Next, we give a corresponding linear lower bound showing that .
Proof Sketch.
For , we define an edge-weight function that has, at each vertex, for every , exactly one incident edge of weight .111In contrast to the proof of Theorem 2, we cannot arbitrarily assign weights to edges incident to each vertex because this may give twice the same edge weight at a vertex of partition . To this end, we partition the edge set into perfect matchings , and, for each edge , we set .
For any PQ-layout of , we can find a sublayout that is a bipartite PQ-layout of – either take the first vertices of and the last vertices of or vice versa.222For simplicity, we assume that is even.
Note that we cannot directly apply Theorem 2 to because we have already fixed an edge-weight function. Instead, we analyze the possible distribution of the edge weights incident to vertices in by a representation as a black-and-white grid;333A similar, although not identical, representation is used by Alam et al. [36] to prove the mixed page number of . see the the full version [20] for an illustration and a more extensive description. Our grid has columns that represent the vertices of the latter partition (in order from left to right as they appear in ) and it has rows that represent the edge weights (in order from bottom to top). A grid cell in column and row is colored black if the -th vertex is incident to an edge of weight , and it is colored white otherwise. Observe that, in this grid, a strictly monotonically decreasing path of black cells having length is equivalent to a -inversion in . We can show that there always exists such a path of length : the candidates for being the first black cell of the path are those who do not have another black cell in their top left region of the grid. We find these cells, color them white and iteratively repeat this process to find the candidates for being the second, third, etc. black cell of the path. We can prove that we need at least iterations until the grid is white.
Since contains as a subgraph, Theorem 3 immediately implies a linear lower bound on :
Corollary 4.
.
4 Characterizing Graphs with Priority Queue Number 1
We study which graphs have priority queue number 1. We will provide a characterization of the graphs with priority queue number 1 in terms of forbidden minors (Section 4.4). We first show that the family of graphs with priority queue number 1 is minor-closed (Section 4.1). Then, we describe families of graphs with priority queue number 1 (Section 4.2) and a set of forbidden minors (Section 4.3). The characterization of Section 4.4 follows by proving that every graph that does not contain any of the forbidden minors of Section 4.3 falls in one of the families of Section 4.2. This characterization leads to an efficient recognition algorithm.
4.1 PQ-Layouts of Minors
A minor of a graph is obtained from by a series of edge contractions and by removing vertices and edges. Formally, for an edge in , the contraction of edge yields the graph , obtained by replacing vertices and by a single vertex with incident edges . Many important graph classes (e.g., planar graphs) are minor-closed, that is, if we take a minor of a graph lying in such a class, the resulting graph belongs to this class as well. Every minor-closed graph class is defined by a finite set of forbidden minors and can be recognized efficiently [39, 40].
Proof Sketch.
We prove for any given edge-weight function . We construct a PQ-layout of using one priority queue where except for . Assuming in , we construct a PQ-layout of : We place vertex obtained from contracting at the position of in . Vertices preceding or succeeding in retain their positions in , and vertices between and in are sorted according to the weight of their edges shared with . See the full version [20] for details.
Corollary 6.
The family of graphs with priority queue number 1 is minor-closed.
4.2 Graphs with Priority Queue Number 1
We begin by showing how to construct PQ-layouts of trees:
Lemma 7.
Let be an -vertex edge-weighted tree with root . Then, a PQ-layout of with , where for each vertex its parent precedes in the linear ordering along the spine, can be constructed in time.
Proof.
We describe an algorithm that constructs a PQ-layout of ; see Figure 3 for an example. For each vertex , we define its weight as . As an initial layout, we first place as the leftmost vertex and the children of in increasing order of their weights to the right of . During our algorithm, we keep track of the last expanded vertex , which is the rightmost vertex whose children (if any) have already been placed. Note that initially . We now maintain the following invariants:
-
T.1
For each vertex with , all children have already been placed.
-
T.2
For each vertex with , no child has been placed yet. In addition, .
-
T.3
Let denote the set of already placed vertices succeeding in . Then, the vertices in occur in in increasing order of their weights.
-
T.4
The already constructed PQ-layout has priority queue number 1.
It is easy to see that the invariants hold for the initial layout. We now iteratively consider the vertex immediately succeeding in and perform the following operations. For each child of , we place to the right of such that is ordered by weight. This can be easily done since by T.3, (and thus also ) is already ordered by weight, i.e., there is a unique position for each and T.3 holds again after has become the new . Next, consider edge . By T.4, the only way that the resulting linear layout has not priority queue number 1 is if is included in a forbidden configuration. Consider an edge with that is co-active with . Clearly, and by T.2, we have that and . By T.3, it follows that and are sorted by their weights, which are equal to and , thus, and form no forbidden configuration, i.e., T.4 is maintained.
After placing all children of , we set . Clearly, T.1 is maintained as we placed all children of whereas by induction the children of the vertices preceding have already been placed. Moreover, T.2 is maintained as we only placed all children of to the right of whereas by induction the children of other vertices of are not placed yet.
For every vertex, we need to find its position depending on the weight. This can be done in time if we maintain a suitable search data structure. The rest of the insertion can be done in constant time. Overall, this results in a running time in .
Next, we construct a specific layout of caterpillars, which are a special subclass of trees. Namely, a caterpillar consists of an underlying path and additional leaves, each having exactly one neighbor on . Be aware that, for the same caterpillar , there are several choices for , and in particular might end in a degree- vertex of .
Lemma 8.
Let be an -vertex edge-weighted caterpillar with underlying path and let be one of the two degree- vertices in . Then, a PQ-layout of with where is the rightmost vertex can be constructed in time.
Proof.
We label as and arrange the vertices of in the order . Then for , we place all leaves at between and in an arbitrary order (note that for , we place its leaves before ). It is easy to see that the resulting layout contains no forbidden configuration and the statement follows.
We now shift our attention to graphs containing cycles. First, we consider cycles alone.
Lemma 9.
Let be an -vertex edge-weighted cycle, and let be any given vertex of . Then, a PQ-layout of with where is the leftmost vertex can be constructed in time.
Proof.
We maintain two candidate vertices and to be placed next. We call the neighbor of (, resp.) that has already been placed anchor vertex (, resp.). Initially, and are the two neighbors of the leftmost vertex and . We iteratively append the candidate vertex whose edge to its anchor vertex has the smallest weight to the right of the linear order (if both weights are equal, we take any of both candidates). If , we append while we do not yet place . After appending , we set and the other neighbor of becomes the new candidate vertex . We proceed symmetrically with if . When , we place the last remaining vertex as the rightmost vertex.
Clearly, every vertex is placed. We show that no forbidden configuration occurs. Suppose that there are two co-active edges (where ) and (where ) with and . In the course of our algorithm, after and have been placed and before and have been placed, the candidate vertices were and whose anchor vertices were and . There could not have been a different anchor or candidate vertex because is a cycle. Then, however, we would not have placed first because – a contradiction.
Note that the running time of the initialization, termination and each iterative step is constant. Therefore, the overall running time is in .
We then consider the family of legged cycles. Namely, a legged cycle consists of a single underlying cycle and additional leaves, each having exactly one neighbor on .
Proof Sketch.
We remove the heaviest edge of and all leaves where the weight of the incident edge is greater than . We lay out the remaining graph using Lemma 8 such that the endpoints of are the first and the last vertex. We reinsert and, in increasing order of the weights of their incident edges, we add the initially removed leaves to the right.
Next, we show that we may attach one caterpillar (Lemma 11) or two caterpillars to a single quadrangle (Lemma 12) or a single triangle (Corollary 13).
Lemma 11.
Let be an -vertex edge-weighted graph consisting of a cycle and a caterpillar with underlying path such that is a degree- vertex of . Then, a PQ-layout of with can be constructed in time.
Proof.
We first draw and separately using Lemmas 8 and 9, respectively. Then, we identify the two occurrences of in and with each other, which yields our PQ-layout of . This does not result in a forbidden configuration since is the rightmost vertex of and the leftmost vertex of and, hence, there is no edge spanning over .
Proof Sketch.
We arrange the cycle such that only the heaviest edge is co-active with the other three edges. We use Lemma 7 for laying out the one caterpillar with designated leftmost vertex and we use Lemma 8 for laying out the other caterpillar with designated rightmost vertex. In the full version [20], we argue that we can combine these three subgraphs, potentially adding some leaves later on, while still using only one priority queue.
Corollary 13.
If consists of a triangle and two caterpillars and with underlying paths starting at vertex and , respectively, then .
Finally, we consider graphs that contain more than one cycle. If we exclude disconnected graphs, there exist exactly two such graphs with priority queue number 1, the complete bipartite graph and the graph obtained from by removing an edge. We will later see that these are the only ones.
Corollary 15.
where is obtained from by removing one edge.
4.3 Forbidden Minors for Graphs with Priority Queue Number 1
Each of the graphs shown in Figure 4 has priority queue number at least two. The numbers at the edges specify edge-weight functions for which one priority queue does not suffice. In the full version [20], we prove the following observation:
Lemma 16 ().
In any PQ-layout of an edge-weighted cycle with , the last vertex on the spine is incident to an edge of maximum weight in .
We now use Lemma 16 to prove the main result of this subsection:
Lemma 17 ().
For each graph (see Figure 4), holds.
Proof of Cases –.
To show , it suffices to show for some edge weighting . We claim that the edge weightings in Figure 4 require more than one priority queue. We consider each of the eight graphs individually and suppose for a contradiction that there is a PQ-layout with . We consider – here and – in the full version [20].
- :
-
Consider the triangle . By Lemma 16, or is the last vertex of (on the spine) since is its heaviest edge. In the triangle , is the heaviest edge, which implies that or is the last vertex of . Hence, neither nor can be the (overall) rightmost vertex. Since the heaviest edge of the 4-cycle is again , is the rightmost vertex. In the triangle , is the heaviest edge, which implies that cannot be the rightmost vertex; a contradiction.
- :
-
By Lemma 16 and symmetry, we may assume that and are the last vertices of and , respectively. Moreover, assume by symmetry that , i.e., . However, then edge ends below the lighter edge ; a contradiction.
- :
-
By Lemma 16, or is the last vertex of the 5-cycle . In the 4-cycle , however, or is the last vertex; a contradiction.
4.4 Characterization and Recognition
We will now combine the results shown in the previous subsections to show the following:
Proof Sketch.
We analyze the structure of and we see that either is a graph that has due to a result from Section 4.2, or has some for as a minor.
If is a tree, then by Lemma 7. If contains exactly one cycle , then is a forest , and we consider each component of as rooted at . If every component is an isolated vertex or a rooted star, then by Lemma 10. If some component is more complex than a rooted star or a rooted caterpillar, then contains as a minor. Now suppose some component is a rooted caterpillar. If all other components are isolated vertices, then by Lemma 11. If there are two further non-trivial components, then contains as a minor. So assume that there is exactly one further non-trivial component . If the roots of and have distance at least in one direction along , then contains as a minor. If none of the above applies, either is a triangle and by Corollary 13, or is a quadrangle and the roots of and are opposite on , and by Lemma 12. The case where contains at least two cycles remains. If has two edge-disjoint cycles, then contains as a minor. If two cycles have at least two vertices but no edge in common, then contains as a minor. If any two cycles share at least one edge, then either or and we have by Lemmas 14 and 15, or contains , , or as a minor.
Theorem 18 implies that the structure of a graph with is quite limited. In fact, forbidden minors and imply that can contain at most three cycles. More precisely, if contains two cycles, it is necessarily a or a since forbidden minors and forbid any other edge. Moreover, if contains a single cycle, forbidden minor implies that no non-trivial tree (i.e., a tree that is more than a caterpillar) can be attached to the cycle. Finally, forbidden minors and dictate how legs can be combined with an attached caterpillar. implies that at most one vertex of the cycle can have legs whereas implies that, for a cycle of length , legs can only be attached to the vertex opposite of the vertex attached to the caterpillar whereas for cycles of lengths larger than , no legs are allowed. These observations in conjunction with Lemmas 7, 8, 10, 12, 13, 14, and 15 imply the following:
Corollary 19.
Given a graph , it can be decided in time if . Moreover, if , a PQ-layout of with can be computed in time for a given edge-weight function .
5 PQ-Layouts of Graphs with Bounded Pathwidth and Treewidth
We present results for graphs of bounded pathwidth and bounded treewidth. We assume familiarity with these concepts; otherwise see the full version [20] for formal definitions.
Theorem 20.
Let be a graph with pathwidth at most . Then, .
Proof.
We may assume w.l.o.g. that is edge-maximal of pathwidth , i.e., is an interval graph with clique number [15]. Let be an interval representation of with distinct interval endpoints. In particular for any .
We take the ordering of vertices given by their increasing right interval endpoints. That is, . Crucially, for any with , also .
To define the partition of into priority queues , we consider a proper vertex coloring of with colors. This exists, as is an interval graph. Now for let be the set of all edges in whose right endpoint in the vertex ordering has color . In fact, each contains none of the forbidden configurations in Figure 2, and hence is a priority queue independent of the edge-weights, since in each forbidden configuration in Figure 2 there would be an edge in between the right endpoints and of the two edges and forming the forbidden configuration. But this would imply different colors for and and therefore different priority queues for and .
We remark that Corollary 4 implies that there are graphs with pathwidth and priority queue number at least as has pathwidth .
Next, we shall construct for every integer a graph of treewidth together with edge weights so that every vertex ordering of contains a -inversion. If every vertex ordering of contains a -inversion, then and hence .
Proof Sketch.
Let be a fixed integer. Our desired graph will be a rooted -tree, i.e., an edge-maximal graph of treewidth with designated root edge, which are defined inductively through the following construction sequence:
-
A single edge is a -tree rooted at .
-
If is a -tree rooted at and is any edge of , then adding a new vertex with neighbors and is again a -tree rooted at . We say that is stacked onto .
We define a vertex ordering of a -tree rooted at to be left-growing if no vertex (different from , ) appears to the right of both its parents. First we show that it is enough to force a -inversion (and hence ) in every left-growing vertex ordering.
Proof Sketch.
Intuitively, whenever in the construction sequence of a vertex is stacked onto an edge , in we instead stack “copies” of called onto (treating each like henceforth). The weights and , , are chosen very close to and but increasing with for and decreasing with for . This way, if all copies of lie right of and , we get a -inversion among the ’s or ’s.
We then construct a sequence of edge-weighted rooted -trees, so that for every , every left-growing vertex ordering of contains a -inversion. The construction of is recursive, starting with being just a single edge of any weight. For , we start with vertices stacked onto the root edge , and stacking a vertex onto each , as well as a vertex onto for . All these edges have weight . Then, each and is used as the base edge of two separate copies of , where however the edge-weights of each copy are scaled and shifted to be in a specific half-open interval depending on the current base edge ( or ). See Figure 5 for an illustration.
By induction, there is a -inversion in each such copy of . Using the pigeon-hole principle, and the Erdős–Szekeres theorem, we then identify an edge (or ) which forms a -inversion either together with -inversion of one copy of , or with edges, each from the -inversion of a different copy of .
To finish the proof, it is then enough to take as constructed above, and then apply Claim 22 to obtain the desired edge-weighted -tree with .
As graphs of treewidth are always planar graphs, we conclude with the following result that contrasts similar results for the queue and stack number [23, 43]:
Corollary 23.
The priority queue number of planar graphs is unbounded. In particular, there is a planar graph with vertices and .
Proof.
We observe that in the proof of Theorem 21 contains copies of while contains vertices. Thus, there are at least vertices in , which has treewidth .
6 Complexity of Fixed-Ordering PQ-Layouts
In the light of Corollary 19, one might wonder whether deciding if a given graph has priority queue number is polynomial-time solvable for all values of . However, we show that it is -complete if the ordering of the vertices is already fixed.
Theorem 24.
Given an edge-weighted graph with , a linear ordering of , and a positive integer , it is -complete to decide whether admits a PQ-layout with linear ordering and a partitioning of into priority queues.
Proof.
Containment in is clear as we can check in polynomial time whether a given assignment of edges to priority queues corresponds to a valid PQ-layout.
We show -hardness by reduction from the problem of coloring circular-arc graphs, which is known to be -complete if is not fixed [27]. A circular-arc graph is the intersection graph of arcs of a circle (see Figure 6 on the left), that is, the arcs are the vertices and two vertices share an edge if and only if the corresponding arcs share a point along the circle.
For a given circular-arc graph , we next describe how to obtain an edge-weighted graph and a vertex ordering such that a -coloring of directly corresponds to a PQ-layout of under with priority queues. Without loss of generality, we assume that we have a circular-arc representation of where all endpoints of the arcs are distinct.
We “cut” the circle at some point, which gives an interval representation where some vertices of refer to two intervals; in Figure 6, the circular arcs , , and are cut into intervals and , and , and and , respectively. We let the endpoints of all intervals be the vertices of , whose ordering along the spine is taken from the ordering of the corresponding endpoints of the intervals (for the intervals belonging to , the order is arbitrary). Further, for each interval, we have an edge in connecting its two endpoints. To obtain , we assign to the edges of the numbers 1 to , where , in decreasing order of the right endpoints of the intervals. This way, every pair of edges whose corresponding intervals share a common point need to be assigned to distinct priority queues.
So far, there is no mechanism that assures that and , and , etc., are assigned to the same priority queue. To this end, we add, for each such pair , an edge from the left endpoint of to the right endpoint of . We call these new edges synchronization edges, and we assign them the weights in decreasing order of their right endpoints. Furthermore, we add heavy edges below the leftmost, second leftmost, … vertex on the spine, respectively, as well as, heavy edges below the rightmost, second rightmost, … vertex on the spine, respectively, see Figure 6. Clearly, , otherwise we have a no-instance. The heavy edges have distinct right endpoints and their weights are chosen such that (i) they are greater than , where is the largest weight used so far, and (ii) they are chosen in decreasing order from left to right such that each pair of heavy edges needs to be assigned to distinct priority queues if they overlap.
Proof Sketch.
Consider the vertices of from the outside to the inside. At the outer endpoint of (, resp.), the edge (, resp.) and the synchronization edge get the same color by the pigeonhole principle because all but one priority queue is occupied by the heavy edges and the previously considered edges, which all induce pairwise forbidden configurations.
If we have a PQ-layout of under vertex ordering with priority queues, we obtain, due to the choice of and , a coloring of by using the priority queues as colors. In particular, due to Claim 25, both parts of the “cut” circular arcs get the same color. Conversely, we can easily assign the edges of to priority queues if we are given a -coloring of . Clearly, our reduction can be implemented to run in polynomial time.
7 Open Problems
We conclude by summarizing a few intriguing problems that remain open. (i) Improve the upper and lower bounds for . (ii) Determine the complexity of deciding for , or deciding for a given edge weighting when is a constant or no vertex ordering is given. (iii) Find graph families with bounded priority queue number; what about outerplanar graphs? (iv) Can the edge density of a graph be upper bounded by a term in ? (v) One can also investigate the structure of edge-weighted graphs with a fixed vertex-ordering . Edge-partitions of into priority queues are equivalent to proper -colorings of an associated graph , while -inversions correspond to -cliques in . Is bounded by a function in terms of ? Is determining -complete?
References
- [1] Jawaherul Md. Alam, Michael A. Bekos, Martin Gronemann, Michael Kaufmann, and Sergey Pupyrev. Queue layouts of planar 3-trees. Algorithmica, 82(9):2564–2585, 2020. doi:10.1007/s00453-020-00697-4.
- [2] Patrizio Angelini, Michael A. Bekos, Philipp Kindermann, and Tamara Mchedlidze. On mixed linear layouts of series-parallel graphs. Theor. Comput. Sci., 936:129–138, 2022. doi:10.1016/j.tcs.2022.09.019.
- [3] Christopher Auer, Christian Bachmaier, Franz-Josef Brandenburg, Wolfgang Brunner, and Andreas Gleißner. Plane drawings of queue and deque graphs. In Ulrik Brandes and Sabine Cornelsen, editors, Proc. 18th International Symposium on Graph Drawing and Network Visualization (GD 2010), volume 6502 of Lecture Notes in Computer Science, pages 68–79. Springer, 2010. doi:10.1007/978-3-642-18469-7_7.
- [4] Christopher Auer and Andreas Gleißner. Characterizations of deque and queue graphs. In Petr Kolman and Jan Kratochvíl, editors, Proc. 37th International Workshop on Graph-Theoretic Concepts in Computer Science (WG 2011), volume 6986 of Lecture Notes in Computer Science, pages 35–46. Springer, 2011. doi:10.1007/978-3-642-25870-1_5.
- [5] Michael J. Bannister, William E. Devanny, Vida Dujmović, David Eppstein, and David R. Wood. Track layouts, layered path decompositions, and leveled planarity. Algorithmica, 81(4):1561–1583, 2019. doi:10.1007/s00453-018-0487-5.
- [6] Giuseppe Di Battista, Fabrizio Frati, and János Pach. On the queue number of planar graphs. SIAM J. Comput., 42(6):2243–2285, 2013. doi:10.1137/130908051.
- [7] Giuseppe Di Battista, Fabrizio Frati, Maurizio Patrignani, and Marco Tais. Schematic representation of large biconnected graphs. J. Graph Algorithms Appl., 25(1):311–352, 2021. doi:10.7155/jgaa.00560.
- [8] Michael A. Bekos, Stefan Felsner, Philipp Kindermann, Stephen G. Kobourov, Jan Kratochvíl, and Ignaz Rutter. The rique-number of graphs. In Patrizio Angelini and Reinhard von Hanxleden, editors, Proc. 30th International Symposium on Graph Drawing and Network Visualization (GD 2022), volume 13764 of Lecture Notes in Computer Science, pages 371–386. Springer, 2022. doi:10.1007/978-3-031-22203-0_27.
- [9] Michael A. Bekos, Henry Förster, Martin Gronemann, Tamara Mchedlidze, Fabrizio Montecchiani, Chrysanthi N. Raftopoulou, and Torsten Ueckerdt. Planar graphs of bounded degree have bounded queue number. SIAM J. Comput., 48(5):1487–1502, 2019. doi:10.1137/19M125340X.
- [10] Michael A. Bekos, Martin Gronemann, and Chrysanthi N. Raftopoulou. An improved upper bound on the queue number of planar graphs. Algorithmica, 85(2):544–562, 2023. doi:10.1007/s00453-022-01037-4.
- [11] Michael A. Bekos, Michael Kaufmann, Fabian Klute, Sergey Pupyrev, Chrysanthi N. Raftopoulou, and Torsten Ueckerdt. Four pages are indeed necessary for planar graphs. J. Comput. Geom., 11(1):332–353, 2020. doi:10.20382/jocg.v11i1a12.
- [12] Michael A. Bekos, Michael Kaufmann, Maria Eleni Pavlidi, and Xenia Rieger. On the deque and rique numbers of complete and complete bipartite graphs. In Denis Pankratov, editor, Proc. 35th Canadian Conference on Computational Geometry (CCCG 2023), pages 89–95, 2023. URL: https://wadscccg2023.encs.concordia.ca/assets/pdf/CCCG_2023_proc.pdf#section.0.11.
- [13] Frank Bernhart and Paul C. Kainen. The book thickness of a graph. J. Comb. Theory, Ser. B, 27(3):320–331, 1979. doi:10.1016/0095-8956(79)90021-2.
- [14] Sandeep N. Bhatt, Fan R. K. Chung, Frank Thomson Leighton, and Arnold L. Rosenberg. Scheduling tree-dags using FIFO queues: A control-memory trade-off. J. Parallel Distributed Comput., 33(1):55–68, 1996. doi:10.1006/jpdc.1996.0024.
- [15] Hans L. Bodlaender. A partial k-arboretum of graphs with bounded treewidth. Theor. Comput. Sci., 209(1-2):1–45, 1998. doi:10.1016/S0304-3975(97)00228-4.
- [16] Jonathan F. Buss and Peter W. Shor. On the pagenumber of planar graphs. In Richard A. DeMillo, editor, Proc. 16th Annual ACM Symposium on Theory of Computing (STOC 1984), pages 98–100. ACM, 1984. doi:10.1145/800057.808670.
- [17] Fan R. K. Chung, Frank Thomson Leighton, and Arnold L. Rosenberg. DIOGENES: A methodology for designing fault-tolerant VLSI processor arrays. In Proc. 13th Int. Conf. Fault-Tolerant Computing, pages 26–32, 1983.
- [18] Fan R. K. Chung, Frank Thomson Leighton, and Arnold L. Rosenberg. Embedding graphs in books: A layout problem with applications to VLSI design. SIAM Journal on Algebraic Discrete Methods, 8(1):33–58, 1987. doi:10.1137/0608002.
- [19] Philipp de Col, Fabian Klute, and Martin Nöllenburg. Mixed linear layouts: Complexity, heuristics, and experiments. In Daniel Archambault and Csaba D. Tóth, editors, Proc. 27th International Symposium on Graph Drawing and Network Visualization (GD 2019), volume 11904 of Lecture Notes in Computer Science, pages 460–467. Springer, 2019. doi:10.1007/978-3-030-35802-0_35.
- [20] Emilio Di Giacomo, Walter Didimo, Henry Förster, Torsten Ueckerdt, and Johannes Zink. Linear layouts of graphs with priority queues. arXiv preprint, 2025. doi:10.48550/arXiv.2506.23943.
- [21] Emilio Di Giacomo, Giuseppe Liotta, and Henk Meijer. Computing straight-line 3D grid drawings of graphs in linear volume. Comput. Geom., 32(1):26–58, 2005. doi:10.1016/j.comgeo.2004.11.003.
- [22] Vida Dujmović. Graph layouts via layered separators. J. Comb. Theory, Ser. B, 110:79–89, 2015. doi:10.1016/j.jctb.2014.07.005.
- [23] Vida Dujmović, Gwenaël Joret, Piotr Micek, Pat Morin, Torsten Ueckerdt, and David R. Wood. Planar graphs have bounded queue-number. J. ACM, 67(4):22:1–22:38, 2020. doi:10.1145/3385731.
- [24] Vida Dujmović, Pat Morin, and David R. Wood. Layout of graphs with bounded tree-width. SIAM J. Comput., 34(3):553–579, 2005. doi:10.1137/S0097539702416141.
- [25] Vida Dujmović, Attila Pór, and David R. Wood. Track layouts of graphs. Discret. Math. Theor. Comput. Sci., 6(2):497–522, 2004. doi:10.46298/DMTCS.315.
- [26] Henry Förster, Michael Kaufmann, Laura Merker, Sergey Pupyrev, and Chrysanthi N. Raftopoulou. Linear layouts of bipartite planar graphs. In Pat Morin and Subhash Suri, editors, Proc. 18th Algorithms and Data Structures Symposium (WADS 2023), volume 14079 of Lecture Notes in Computer Science, pages 444–459. Springer, 2023. doi:10.1007/978-3-031-38906-1_29.
- [27] M. R. Garey, David S. Johnson, Gerald L. Miller, and Christos H. Papadimitriou. The complexity of coloring circular arcs and chords. SIAM J. Algebraic Discret. Methods, 1(2):216–227, 1980. doi:10.1137/0601025.
- [28] Christian Haslinger and Peter F. Stadler. RNA structures with pseudo-knots: Graph-theoretical, combinatorial, and statistical properties. Bull. Math. Biol., 61(3):437–467, 1999. doi:10.1006/bulm.1998.0085.
- [29] Lenwood S. Heath. Embedding planar graphs in seven pages. In Proc. 25th Annual Symposium on Foundations of Computer Science (FOCS 1984), pages 74–83. IEEE Computer Society, 1984. doi:10.1109/SFCS.1984.715903.
- [30] Lenwood S. Heath, Frank Thomson Leighton, and Arnold L. Rosenberg. Comparing queues and stacks as mechanisms for laying out graphs. SIAM J. Discret. Math., 5(3):398–412, 1992. doi:10.1137/0405031.
- [31] Lenwood S. Heath and Arnold L. Rosenberg. Laying out graphs using queues. SIAM J. Comput., 21(5):927–958, 1992. doi:10.1137/0221055.
- [32] Sorin Istrail. An algorithm for embedding planar graphs in six pages. Iasi University Annals, Mathematics-Computer Science, 34(4):329–341, 1988.
- [33] Paul C. Kainen. The book thickness of a graph, II. Congressus Numerantium, 71:127–132, January 1990.
- [34] Donald E. Knuth. The Art of Computer Programming, Volume I: Fundamental Algorithms. Addison-Wesley, 1968.
- [35] Frank Thomson Leighton and Arnold L. Rosenberg. Three-dimensional circuit layouts. SIAM J. Comput., 15(3):793–813, 1986. doi:10.1137/0215057.
- [36] Jawaherul Md. Alam, Michael A. Bekos, Martin Gronemann, Michael Kaufmann, and Sergey Pupyrev. The mixed page number of graphs. Theoretical Computer Science, 931:131–141, 2022. doi:10.1016/j.tcs.2022.07.036.
- [37] Vaughan R. Pratt. Computing permutations with double-ended queues, parallel stacks and parallel queues. In Alfred V. Aho, Allan Borodin, Robert L. Constable, Robert W. Floyd, Michael A. Harrison, Richard M. Karp, and H. Raymond Strong, editors, Proceedings of the 5th Annual ACM Symposium on Theory of Computing, April 30 - May 2, 1973, Austin, Texas, USA, pages 268–277. ACM, 1973. doi:10.1145/800125.804058.
- [38] Sergey Pupyrev. Mixed linear layouts of planar graphs. In Fabrizio Frati and Kwan-Liu Ma, editors, Proc. 25th International Symposium on Graph Drawing and Network Visualization (GD 2017), volume 10692 of Lecture Notes in Computer Science, pages 197–209. Springer, 2017. doi:10.1007/978-3-319-73915-1_17.
- [39] Neil Robertson and Paul D. Seymour. Graph minors. XIII. the disjoint paths problem. J. Comb. Theory, Ser. B, 63(1):65–110, 1995. doi:10.1006/JCTB.1995.1006.
- [40] Neil Robertson and Paul D. Seymour. Graph minors. XX. Wagner’s conjecture. J. Comb. Theory, Ser. B, 92(2):325–357, 2004. doi:10.1016/J.JCTB.2004.08.001.
- [41] Arnold L. Rosenberg. The diogenes approach to testable fault-tolerant arrays of processors. IEEE Trans. Computers, C-32(10):902–910, 1983. doi:10.1109/TC.1983.1676134.
- [42] David R. Wood. Bounded-degree graphs have arbitrarily large queue-number. Discret. Math. Theor. Comput. Sci., 10(1), 2008. doi:10.46298/dmtcs.434.
- [43] Mihalis Yannakakis. Embedding planar graphs in four pages. J. Comput. Syst. Sci., 38(1):36–67, 1989. doi:10.1016/0022-0000(89)90032-9.
- [44] Mihalis Yannakakis. Planar graphs that need four pages. J. Comb. Theory, Ser. B, 145:241–263, 2020. doi:10.1016/j.jctb.2020.05.008.
