Manuscript Offprint
arXiv:2610.18071On the Parameterized Complexity of Capacitated Stack and Queue Layouts with Colored Edges
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Stack and queue layouts are two extensively studied and complementary linear representations of graphs. A stack (queue) layout of a graph consists of a total ordering of its vertices and of a partitioning of its edges into pages, such that no two independent edges on the same page cross (nest). We propose a generalized model with colored edges (one color per edge) and capacitated pages. Namely, the input graph is equipped with colored edges and a prescribed budget for each page-color pair – this budget determines the maximum number of edges of color that page can accept. This model is motivated by fair allocation scenarios where budgets can be used to control the share of monochromatic edges on each page. Unfortunately, it is known that deciding whether a stack (queue) layout exists is NP-hard already with two (one) pages. Thus, we focus on the fixed-order setting – where the linear order is part of the input – for which an ordinary 2-page stack or -page queue layout can be computed in polynomial time. Despite the restrictive setting, we show that both capacitated problems are NP-complete already for two pages. Furthermore, we study the complexity of the problems when parameterized by the number of pages, colors, and/or the structure of the edge conflict graph with respect to the fixed linear order . Our analysis paints a detailed complexity landscape and uncovers a surprisingly intricate interplay between the considered parameters.
2012 ACM Subject Classification Theory of computation → Parameterized complexity and exact algorithms; Mathematics of computing → Graph algorithms
Keywords and phrases linear layouts, stack layouts, queue layouts, parameterized complexity, fair allocation
Funding Thomas Depian: Supported by the Vienna Science and Technology Fund (WWTF) [10.47379/ICT22029].
Martin Nöllenburg: Supported by the Vienna Science and Technology Fund (WWTF) [10.47379/ICT22029].
Acknowledgements The authors acknowledge the use of AI tools (in particular Claude Opus 5.5) for proofreading the pre-final version of this submission and identifying some additional related literature. No such tools were used for obtaining the results and the writeup of the pre-final version. The authors assume full responsibility for the submission.
1 Introduction
A linear layout of a graph consists of a total order of its vertices and a partition of its edges into pages, such that edges on the same page avoid specified patterns with respect to . Over the last four decades, linear layouts have been a central research topic in graph drawing and topological graph theory. Two prominent examples are stack layouts and queue layouts, in which no two independent edges on the same page are allowed to cross or nest,
Capacitated Linear Layouts
respectively. These names reflect the data structures used to store the edges of each page during a left-to-right sweep of : upon reaching a vertex v, edges whose right endpoint is v are removed from the corresponding stack or queue, after which edges whose left endpoint is v are inserted. With suitable ordering of the operations at each vertex, these accesses follow a last-in-first-out or first-in-first-out discipline, respectively.
Motivated by applications in VLSI design [13, 46], permutation sorting [44, 48], compact graph encodings [32, 43], RNA folding [27], and traffic-light control [35], stack and queue layouts have been extensively studied from both algorithmic and structural perspectives. Research has addressed their computational complexity [11, 12, 17, 25, 29], their connections to planarity [1, 7, 19], and their relationships with other graph properties and parameters [50, 51].
Several variants extend this framework by imposing additional constraints or modifying the permitted edge patterns. Merker and Ueckerdt [41,42] introduced the local stack (queue) number of a graph G, defined as the minimum such that G admits a stack (queue) layout in which the edges incident to each vertex belong to at most pages. Alam et al. [2] studied dispersable layouts, which require the edges on each page to form a matching. Other works have explored layouts that mix different data structures or use alternative ones to organize the edges on each page (see, e.g., [3,8,18,28,36]). More recently, Förster et al. [22] introduced the weighted book thickness of a graph, defined as the minimum average page index of its edges over all stack layouts. Bekos et al. [6] studied a relaxation that permits a bounded number of otherwise forbidden patterns within each page.
Capacitated Linear Layouts. In this paper, we introduce capacitated linear layouts, a generalization of stack and queue layouts in which each edge of the input graph G is assigned one of colors, and each page has a separate budget for each color. The goal is to find a stack or queue layout using at most pages, subject to the constraint that, on each page, the number of edges of each color does not exceed the corresponding budget. The classical notions of stack and queue layouts are recovered by setting and assigning every page a budget of ; see Figure 1 for an illustrating example.
Motivating Examples. In partitioned book embeddings, the assignment of edges to pages is part of the input [4,40]. These can be seen as a special case of capacitated linear layouts, where edges assigned to page p receive color p, and the budget of page p is for color p and 0 for every other color. When colors encode different types of elements—for example, in signed graphs with positive and negative relations among social media users [38]—capacitated linear layouts can model fair allocation problems, with suitable budgets specifying the share of each type assigned to each page. Moreover, edge colors can distinguish job classes or customers, and per-color page budgets constrain the number of jobs of each class assigned to each buffer, similar to the scheduling problem considered by Das and Wiese [15]. In graph visualization, users may focus their attention on the first few pages, motivating layouts that distribute edges of each color evenly across pages to ensure that edges from every color appear

(a)

(b)

(c)
Figure 1 (a) An edge-colored graph G and a (b) 2-page stack and (c) 2-page queue layout of G. Observe that there is no 2-page stack layout of G with spine order where the two blue edges are on different pages.
among the first pages (see [21] for related fairness-aware formulations in graph drawing). Finally, fairness constraints have also been studied in other graph problems, including graph clustering [23] and graph bisection [31].
Contributions. We study the computational complexity of capacitated linear layouts from a parameterized perspective. Deciding whether a graph admits a 1-page queue layout or a 2-page stack layout is already NP-complete [9,29,52]. These hardness results carry over to our model, implying paraNP-hardness with respect to the number of pages, the number of colors, and their combination. We, therefore, focus on the fixed-order setting in which the vertex order ↘ is given as part of the input and must be preserved. This restriction is consistent with many of the above-discussed motivating applications and indeed is well studied in the literature on stack and queue layouts [10,11,20,29,39,49]. In particular, when ↘ is fixed, deciding if a graph admits an ℓ-page queue layout can be done in polynomial time for any ℓ > 0 [29]. For stack layouts the problem is tractable for ℓ ≤ 2, while it is NP-hard for ℓ ≥ 4 pages [49] and open for three pages [5,47]. We formalize the following problems.
FIXED ORDER CAPACITATED STACK (QUEUE) LAYOUT [short FOCAPSL (FOCAPQL)]
Given A graph , an edge coloring function on colors, a linear order on , an integer , and budgets for every page .
Question Does there exist an -page stack (queue) layout of such that for every page and color ?
Since we mainly consider pages for FOCAPSL, we call the corresponding restricted variant FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT (FOCAP2PSL for short). We note that our problem parallels previous studies of bounded vertex colorings, where each color can be used at most times, for some value of ; see, e.g., the work by Jansen [33]. In our setting, the graph to color would be the edge conflict graph with respect to the linear order and the number of allowed colors is the number of pages . However, recall that we have, on the one hand, an edge-colored graph and we can observe, on the other hand, that known hardness results for bounded vertex colorings for constant require an unbounded number of colors, i.e., pages. In contrast, when adding edge colors we show that, despite being fixed, both problems are NP-complete already for two pages ( ), which clearly separates the complexity of the problems with and without page capacities unless . Furthermore, we study the complexity of the problems when parameterized by the number of pages, colors, and/or the structure of the edge conflict graph. We summarize our results in Figure 2.
Capacitated Linear Layouts

(a)

(b)
Figure 2 Parameterized complexity of (a) FoCAP2PSL (Section 3) and (b) FoCAPQL (Section 4) when parameterized by the number of pages , the number of colors , the number of connected components in the conflict graph, and/or their maximum size . The result for FoCAPQL marked with * applies only if . Moreover, note that holds for every instance of FoCAP2PSL and, therefore, we omit the parameter in (a).

(a)

(b)

(c)
Figure 3 (a) An example graph G and (b) its conflict graph S for the spine order . Since S is bipartite, there exists a 2-page stack layout .
Figure 3 for an example. We write if and are clear from the context and define the conflict graph for queue layouts analogously with conflicts defined by nesting edges. Observe that there is a one-to-one correspondence between page assignments of -page stack (queue) layouts and proper -vertex colorings of the conflict graph.
For a graph , let be a function that assigns each edge one of colors. We call an edge-colored graph. For an instance of FoCAPSL (FoCAPQL), we define , , to be the number of colors, , and , where denotes the corresponding conflict graph for stack (queue) layouts. Moreover, we call the budget of color on page . We say that the instance is balanced if holds for every two pages and color . It is tight if , i.e., the sum over all budgets equals the number of edges. A stack (queue) layout which respects the budget constraints imposed by is called admissible and constitutes a solution to .
Note that in principle the page assignment would be sufficient as a witness for the existence of a solution since the spine order is part of the input.
3 Fixed Order 2-Page Stack Layouts
We start our investigation of capacitated linear layouts by considering 2-page stack layouts. As already noted in earlier work [11], for a fixed spine order , a graph has a 2-page stack layout if and only if the conflict graph is bipartite. When pages have capacities, the situation becomes more intricate. In particular, in the upcoming sections we will uncover an interplay between the structure of and the number of colors .
3.1 Parameterizing by the Number of Connected Components of S
Let be an instance of FOCAP2PSL. As our first parameter, we consider the number of connected components in . As a “warm-up” exercise, we present a fixed-parameter algorithm in . Later, in Section 3.2, we justify this parameter choice by establishing NP-hardness for unbounded .
▶ Theorem 1. FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT can be solved constructively in time (which is FPT in ).
Proof. Let be an instance of FOCAP2PSL. Observe that must be planar to admit a 2-page stack layout, which we can check in time [30]. Thus, for the remainder of the proof we use the fact that holds for any positive instance; instances where is not planar are rejected.
We first compute, in time, the conflict graph and check if it is bipartite; if not, we reject as this is a necessary condition to admit a solution. Let be the connected components of . Consider a connected component , . Its bipartition into and is unique and encodes two possible page assignments for the edges of contained in : Either if and if or vice-versa. Note that this choice is independent of the choice made for other connected components , , . Thus, we can branch on all possible page assignments for the edges of . Each branch corresponds to a 2-page stack layout , and we can check in time if it is admissible. The instance admits a solution if and only if one branch corresponds to an admissible layout. The running time follows by combining all steps.
3.2 Hardness for Many Constant-Sized Components in S
In this section, we justify the use of as parameter by establishing NP-completeness of FOCAP2PSL for unbounded . Furthermore, our reduction shows that the problem remains NP-complete even when every connected component of has constant size. To this end, we reduce from MONOTONE NOT ALL EQUAL 3SAT-E4, a 3-SAT variant that remains NP-complete [14]. The input to this problem is a formula over variables with clause set such that each clause consists of exactly three distinct positive literals and every variable appears in exactly four clauses. The question is whether there exists a truth assignment such that every clause contains two variables with different truth assignments, i.e., one that is assigned to true and one that is assigned to false.
Overview of the Reduction. The high-level idea of our reduction is as follows. We construct an instance I where we introduce for every variable eight edges of a unique color . Four of these edges are placed in the gadget for the variable x. These edges are forced to be placed on the same page and will encode the truth assignment .
Capacitated Linear Layouts

(a)

(b)
Figure 4 Gadgets representing (a) the variable in its true state and (b) the clause where and are set to true and to false in the reduction for Theorem 4.
Each of the remaining four edges is part of a clause gadget for a clause with ; recall that appears in exactly four clauses. The variable gadget enforces four of eight edges to be on the same page. We can set the budget for such that the four remaining edges must be on the same page independent of their location along the spine. This allows us to transport the variable assignment from the variable gadgets into the clause gadgets. Finally, the gadget for every clause also contains four disjoint edges of a unique color . Three of these edges are in conflict with the edges for the variables, each of them with an edge of a different variable . The last edge has no conflict. By setting the budget of accordingly, we can ensure that at most two variable-edges in the clause are on the same page, i.e., for every clause there is one variable set to true and one to false. In the following, we describe the gadgets in detail.
Variable Gadget. Let be a variable of . The variable gadget for consists of a selecting edge and a dummy edge . Moreover, it consists of four variable edges , . The order of the endpoints of these edges is ; see also Figure 4a. All edges of the form , , receive the same color . The two other edges receive the same color which is different from , i.e., . We distribute the budget for the colors on the pages as follows. For color , we set , and for color , we set . The edges and will be the only two edges of color . Together with their placement with respect to the variable edges, we can make the following observation; recall also Figure 4a.
▶ Observation 2. In every admissible 2-page stack layout of the variable gadget for a variable we have for every .
Clause Gadget. Let be a clause of . Since is monotone, we have that for some . The clause gadget for consists of three literal edges , , and . Moreover, it contains four validator edges , , , and . We use the order among the endpoints of the literal and validator edge corresponding to the literal . In the end, we concatenate the respective total orders and append ; see Figure 4b. We re-use the color of a variable for its corresponding literal edge. More formally, we have for . Moreover, we color the validator edges in a unique color , i.e., , for , and set the budget . The budget constraint together with the relative placement of these edges allows us to establish the following lemma, which will play a central role when establishing correctness of the reduction.
▶ Lemma 3. Let be an admissible 2-page stack layout of the constructed instance that contains the clause gadget for a clause with . We have for every . Moreover, there exist two literals such that .
Proof. Let be a clause of with . For the first statement, assume for the sake of a contradiction that there exists a such that . By Observation 2, we have that for every . Thus, there are at least five edges of color on the same page . However, we have . Consequently, cannot be an admissible solution.
To show that also the second statement is true, assume for the sake of a contradiction that there exists an admissible 2-page stack layout with . From it follows that for every and hence . Recall that all validator edges have color . Thus, there exists a page that contains at least three edges of color . However, we have , which contradicts the assumption that was an admissible solution. Consequently, cannot hold, and we can find that fulfills the second claim from the statement.
Putting Everything Together. For an instance of MONOTONE NOT ALL EQUAL 3SAT-E4, we arbitrarily order the variables and clauses . We construct the variable gadget and clause gadget for every variable and clause . Finally, we order them on the spine by first placing the variable gadgets in increasing order, followed by the clause gadgets, again in increasing order. We observe that the variable gadgets induce the largest connected components of ; recall Figure 4. Using Lemma 3, we obtain:
▶ Theorem 4. FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT is NP-complete even when restricted to balanced and tight instances where every connected component of has at most five vertices.
Proof. Containment in NP is immediate. To show NP-hardness, let be an instance of MONOTONE NOT ALL EQUAL 3SAT-E4 on variables and clauses , and let be the instance of FOCAP2PSL obtained from the above-described reduction. Since every gadget has constant size and is constructed precisely once for every variable and clause of , we can conclude that the size of is in . Moreover, the number of colors is also linear in . The instance can be constructed in the same time. Regarding the size of the connected components in , we can observe that every variable gadget induces two connected components: One corresponds to the single edge which is in conflict with no other edge. The other edges of the variable gadget induce a single connected component of size five in ; recall Figure 4a. Clause gadgets induce connected components of size at most two in . Since all gadgets are disjoint with respect to , the largest connected component of has size at most five. We now establish correctness of the reduction.
(⇒) Assume that is a positive instance and let be a witnessing truth assignment. We now construct based on a page assignment such that witnesses that is a positive instance of FOCAP2PSL. To this end, consider a variable and its corresponding variable gadget. If is set to false, we assign the edge to the first page and otherwise to the second page. The remaining edges are assigned to the respective other page (as also prescribed by the necessary page assignment from Observation 2). This assignment is crossing-free since the variable edges are only in conflict with the selecting
Capacitated Linear Layouts
edge ; the dummy edge does not cross any other edge. Moreover, we assigned to each page precisely one edge of color , which matches the budget for these pages.
We apply the “mirrored” page assignment in the clause gadgets. More formally, for a clause , we assign the literal edge to the page for every . The validator edge is assigned to the respective other page, i.e., it holds . This ensures that the clause gadget will be crossing-free. For the last validator edge, i.e., , we consider the unique variable whose truth assignment is different from the other two. We set , i.e., assign to the same page as . This way each page contains two edges of color , which matches the budget for color . Finally, regarding the color for some , we make the following observation. Since , we conclude for every . Since every variable appears in exactly four clauses, we derive that every page contains four edges of color , and we also have . Combining all, we conclude that is a solution to .
(⇔) Assume that is a positive instance of FoCAP2PSL and let be a witnessing solution. We now construct a variable assignment that satisfies . To this end, consider a variable . We set it to true if and only if . To see that is a solution to , consider an arbitrary clause . Since is a solution, we know from Lemma 3 that there exist two literals such that . Since the very same lemma guarantees for every , we conclude that there are two variables with . These two variables NAE-satisfy the clause and since was selected arbitrarily, we derive that is a solution to .
3.3 Parameterizing by the Number of Colors
In this section, we consider the number of colors as parameter. In particular, we show with Theorem 8 that FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT is in XP and W[1]-hard with respect to this parameter. We establish XP-membership in Lemma 5 and provide the complementing hardness result in Lemma 7.
XP-Membership. Let be an instance of FoCAP2PSL. We provide a dynamic programming (DP) algorithm to establish XP-membership. At a high-level, we iteratively consider the connected components of . Using a -sized DP-table , we track for every color vector whether it is possible to have edges of color on the first page using the first connected components of . The respective number of colored edges on the second page can be obtained by simple arithmetic. We check in the end whether a vector matching our budgets can be realized.
▶ Lemma 5. FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT can be solved constructively in time (which is XP in the number of colors ).
Proof. Let be an instance of FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT. Since must be planar to admit a 2-page stack layout, we assume that holds. As a preprocessing step, we compute the conflict graph in time. We reject if it is not bipartite, which is a necessary condition. Otherwise, we consider an arbitrary order of its connected components; recall .

Figure 5 (a) An admissible 2-page stack layout for the edges . The edges of are indicated with dashed lines. (b) The two possible solutions that we can obtain when adding . We indicate above the layout the corresponding color vectors and table entries.
We are now ready to describe our dynamic programming (DP) algorithm. Let be an index and be a color vector with for every color . Note that there are different color vectors. We will make use of a binary DP-table where we set if and only if there exists a solution for the edges with edges of color on the first page, for every . In this case, the solution induces . As our base case, we define if and only if . Clearly, without placing any edge, any solution can only induce the zero vector. For some , observe that the connected component is bipartite. As a consequence, there are precisely two possible crossing-free page assignments for the edges from . Let and be their corresponding color vectors for the first page. Let be a color vector. We set if and only if there exists a such that has only non-negative entries and holds. This is correct since a solution that witnesses can be extended to a solution for by using the corresponding page assignment; see also Figure 5. Moreover, a solution that witnesses also witnesses by removing the edges from . Evaluating a single entry takes time. Since has entries, we can compute in time.
Once the table has been computed, we need to check whether some color vector fulfills the budget constraints. To this end, consider a color vector . Observe that a solution that induces has edges of color on page two, for every . Using this observation, we conclude that admits a solution if and only if there exists a color vector such that , , and holds for every color . We can test this in time as a postprocessing step. Therefore, our DP-algorithm has a running time of and the statement follows.
W[1]-Hardness. Next, we show that FOCAP2PSL is W[1]-hard when parameterized by the number of colors . To this end, we devise a parameterized reduction from the problem MULTIDIMENSIONAL SUBSET SUM, defined as follows. Given a multiset of d-dimensional vectors over and a d-dimensional target vector , does there exist a subset such that ? The problem is known to be W[1]-hard when parameterized by the dimension , even when the numbers are unary encoded [24].
In our reduction, we have overall colors. Each number is represented as a star and a vector is encoded as a set of nested stars, one in each color . Since we only have two
Capacitated Linear Layouts

Figure 6 The vector gadget which features the number gadgets for 3, 1, and 5, respectively.
pages, we can use an additional edge in color to force all of these edges to be placed on the same page. Placing them on the first page represents membership in the solution set and by appropriately setting the budget for both pages, we can ensure equivalence between the solutions to both problems.
Number Gadget. The number gadget for an integer , , consists of the vertices and , , arranged in the order . We connect with every , , i.e., introduce a star with center ; see also Figure 6. The number is represented by the empty number gadget. To represent a vector , we combine number gadgets into a vector gadget as follows, where is a new edge that we will use to ensure correctness of the reduction; see again Figure 6 for an example.
We color the edges of the number gadgets based on the dimension they represent, i.e., we have for every , . Moreover, we color the edge in the color “for” dimension : . Note that the edge is in conflict with every other edge from the vector gadget, which leads to the following observation.
▶ Observation 6. In every 2-page stack layout of the vector gadget for a vector we have for every and . In particular, we have for every , , and .
We now use Observation 6 to establish correctness of our reduction; see also Figure 7 for a small example of the construction.
▶ Lemma 7. FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT is W[1]-hard when parameterized by the number of colors .
Proof. Let be an instance of MULTIDIMENSIONAL SUBSET SUM on dimensions with such that every number can be bounded by a polynomial in ; we recall that MULTIDIMENSIONAL SUBSET SUM remains W[1]-hard parameterized by in this

Figure 7 An instance of FoCAP2PSL constructed for the instance of MULTIDIMENSIONAL SUBSET SUM. The layout depicts the solution .
case [24]. Consider an arbitrary order of the vectors in . We now create an instance of FOCAP2PSL by first creating the vector gadget for every vector and placing it on the spine ordered by index. For every color , we set and . Finally, we set . Let be the obtained instance. We observe that its size is linear in , which is polynomial in . Moreover, we have . It remains to show correctness of the reduction to obtain W[1]-hardness by .
(⇒) Assume that is a positive instance of MULTIDIMENSIONAL SUBSET SUM and let be a set of vectors such that . We now construct a solution for as follows. For every , , we set if and only if . We assign all other edges of the corresponding vector gadget to the respective other page. Observe that no two edges of the vector gadget cross in this page assignment; note that resembles a necessary page assignment established in Observation 6. Moreover, the edges of the number gadgets are placed on the first page if and only if is part of the solution, i.e., . Since all gadgets are disjoint with respect to , the obtained linear layout is a stack layout. To see that it is also admissible, we observe, on the one hand, that for every color we have exactly edges of color on the first page. This is because is a solution to and thus we have . Consequently, the second page contains edges of color . Regarding color , since and we have , the budget for color is fulfilled. Thus, witnesses that is a positive instance of FOCAP2PSL.
(⇔) For the reverse direction, assume that is a positive instance of FOCAP2PSL and let be a solution. To construct a solution to , we consider every vector . We add to if and only if . To see that is a solution, recall that, for every , we have \sigma(u_{x_y} v_{x_y}^j) = \sigma(u_{x_z} v_{x_z}^j') for every , and by Observation 6, i.e., all edges of the number gadgets for are assigned to the same page. In particular, they are placed on the first page if and only if we have added to the solution set . Consider a color . Since is a solution to , the first page contains at most edges of color and the second page contains at most edges of color . Moreover, contains precisely edges of color . Thus, by applying these arguments for every color , we can conclude , i.e., is a positive instance of MULTIDIMENSIONAL SUBSET SUM.
The following theorem summarizes Lemmas 5 and 7.
▶ Theorem 8. FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT is in XP and W[1]-hard when parameterized by the number of colors .
3.4 An FPT-Algorithm for Few Colors and Bounded-Size Components
In this section, we establish our last result for FOCAP2PSL, namely a fixed-parameter tractable algorithm when parameterized by the number of colors and the size of the largest connected component in the conflict graph . Note that both parameters are necessary for an FPT-algorithm since we have shown that the problem is W[1]-hard parameterized by (Theorem 8) and paraNP-hard by (Theorem 4). In the following, we establish a more general result in which is not assumed to be 2 but a parameter.
Capacitated Linear Layouts
While this is not necessary to establish the result of this section, it will later allow us to show that FOCAPQL is FPT with respect to , , and the number of pages .
Let be an instance of FOCAPSL. On a high level, since both and are bounded, we can assign to each connected component of one of -many types, for some computable function . Moreover, since also the number of pages is bounded, each type has at most different valid, i.e., crossing-free, page assignments, for some computable function . We can observe that from the perspective of a solution, all that matters is how many components from each type use a particular page assignment. The precise distribution of components to page assignments is irrelevant. Thus, we can encode the problem of finding an admissible layout as an integer linear program (ILP) with a bounded number of variables – essentially one for each type and their possible page assignment. Fixed-parameter tractability then follows by checking feasibility for the ILP in FPT-time:
▶ Proposition 9 (See, e.g., [37,45]). Let be an integer linear program in variables. Then, it can be solved in time for some computable function .
In the following, we formalize each of the above-hinted steps.
Component Types and Their Embeddings. In the following, for an edge and connected component , we write to denote that is represented by a vertex of . We start by defining the component types.
▶ Definition 10. Two connected components have the same component type, denoted , if and only if there exists an isomorphism from to such that for every .
Note that is an equivalence relation whose number of classes is bounded:
▶ Lemma 11. There are equivalence classes in . We can compute the partition of into in time.
Proof. Each connected component has at most vertices. Moreover, every vertex has one of colors. For every , there are different vertex-colored graphs (on the vertex set ). Thus, for up to vertices, there are
different vertex-colored graphs. Every equivalence class in contains a connected component which is isomorphic to one of these graphs. Consequently, we can upper bound the number of equivalence classes in by .
For the running time, we first observe that contains vertices, one for each edge in , and that the number of connected components is, therefore, also at most . For each connected component , we can iterate over all equivalence classes (found so far). For each potential equivalence class, we can branch over all possible bijections and check in time whether one of them is a color-preserving isomorphism or whether induces a “new” equivalence class in . Combining all, the running time bound follows readily.
Since every connected component has at most vertices, there are at most possible page assignments for the edges , i.e., vertex-colorings of . However, we must exclude those that introduce crossings on a page, i.e., only allow proper colorings of :
▶ Definition 12. Let be an equivalence class of . The valid page assignments is the set of all page assignments such that there are no two edges with such that .
We can efficiently compute the valid page assignments of an equivalence class :
▶ Observation 13. Let be an equivalence class of . It holds . We can compute the set in time.
For an equivalence class of , a valid page assignment , and a color , we let denote the number of edges of color assigned to page in the page assignment . We are now ready to state our ILP.
Using an ILP to Find a Solution. We now define the ILP for . For every equivalence class of , we define to be the number of connected components of of component type . For every equivalence class of and every page assignment , we introduce an integer variable that captures the number of connected components whose vertices, i.e., edges of , are assigned to pages according to in a solution. Observe that every variable assignment with and for every and can be translated into a crossing-free linear layout of . To capture this, we introduce the following constraints:
(BND)
(SUM)
We need additional constraints to ensure that a layout also respects our budget constraints. To this end, recall that we let denote the number of edges of color assigned to page in the page assignment . Note that this value is a constant that can be precomputed. To get the overall number of edges of color on some page , we can sum this value up over all valid page assignments for all equivalence classes , which should not exceed the budget constraint for color on page :
(BGT)
This concludes the definition of the ILP. Next, we show that it is feasible if and only if our instance of FoCAP2PSL admits a solution. We use this result to complete our FPT-algorithm for FoCAP2PSL parameterized by .
▶ Theorem 14. FIXED ORDER CAPACITATED STACK LAYOUT is FPT in the number of pages , number of colors , and the maximum size of a connected component of .
Proof. Let be an instance of FIXED ORDER CAPACITATED STACK LAYOUT. We compute the conflict graph and the partition of its connected components into the equivalence classes in time; recall also Lemma 11. Next, we construct the above-introduced integer linear program . Observe that has one variable for every valid page assignment of every equivalence class of . Thus, by Lemma 11 and Observation 13, we can bound the number of variables in by . We can construct in time. By Proposition 9, we can check in time whether admits a solution for some
Capacitated Linear Layouts
computable function . Since the size of can be bounded by for some computable function , we can bound the overall running time by for some computable function . To establish the statement, it remains to connect solutions for with those for .
▷ Claim 15. is a positive instance if and only if for every equivalence class and is feasible.
Proof. For the sake of the proof, assume that holds for every equivalence class . Otherwise, the equivalence is trivial. We now argue the remaining part of the if and only if.
(⇒) Assume that is a positive instance and consider a solution . Since is a solution, it is in particular a valid stack layout. Thus, every connected component uses one of its valid page assignments . We now consider every equivalence class of and every valid page assignment . In line with the intended semantics of our variables, we set equal to the number of connected components from that use the page assignment . Since these are at least zero and at most , this variable assignment fulfills Constraint (BND). Additionally, since every connected component uses precisely one of its valid page assignments, the sum of these variables must equal , i.e., we also fulfill Constraint (SUM). Moreover, since is an admissible layout, the number of edges of color on every page is at most . Thus, the variable assignment also satisfies Constraint (BGT) and hence witnesses that is feasible.
(⇔) Assume that is feasible (and that holds for every equivalence class ) and consider a variable assignment that satisfies Constraints (BND), (SUM), and (BGT). We now construct a solution as follows. Consider an equivalence class of and all the connected components of the same component type (ordered according to their occurrence along ). Moreover, consider an arbitrary order of the valid page assignments of ; note that holds by assumption. For the first connected components , we set (for the color-preserving isomorphism ) for every edge , . For the next connected components, we set for every edge , . We continue this process until we have considered all valid page assignments of . Note that this assignment is well-defined as we satisfy Constraints (BND) and (SUM). We repeat this step for every equivalence class of to eventually obtain . To see that is a solution, observe, on the one hand, that it is a valid -page stack layout since we only use valid page assignments and every equivalence class admits at least one such page assignment, i.e., . Moreover, two edges from different connected components cannot cross by the definition of connected components in . On the other hand, is admissible as the variable assignment satisfies Constraint (BGT). Thus, is a solution.
The theorem follows by combining Claim 15 with the running time bound.
Theorem 14 immediately implies:
▶ Corollary 16. FIXED ORDER CAPACITATED 2-PAGE STACK LAYOUT is FPT in the number of colors and the maximum size of a connected component of S.

(a)

(b)
Figure 8 Gadgets representing (a) the variable in its true state and (b) the clause where and are set to true and to false in the reduction for Theorem 19.
4 Fixed Order Queue Layouts
In this section, we investigate queue layouts with fixed spine order ↘. It is well-known that an -page queue layout with spine order ↘ exists if and only if ↘ does not induce an -rainbow, i.e., a set of pairwise nesting edges [29]. Heath and Rosenberg [29] provided an efficient algorithm to construct such a queue layout (if it exists). However, in their algorithm they employ a greedy-like strategy and assign the edges to the first page in which they do not nest any other edge. The presence of our budgets invalidates such a strategy, and we show that deciding existence of a solution is already NP-complete for monochromatic graphs, i.e., where all edges have the same color, when is part of the input. Before we establish said result, we analyze the complexity of our problem when .
4.1 Instances with Two or Three Pages
We first consider FOCAPQL when restricted to instances with two pages, i.e., . In particular, we show that the problem of finding an admissible 2-page queue layout is NP-complete, even if every connected component in Q has constant size. Afterwards, we present with Theorem 20 an FPT-algorithm parameterized by the number of connected components of the conflict graph Q for the case . Finally, we show in Theorem 21 that the aforementioned FPT-algorithm cannot be lifted to instances with .
Hardness for Two Pages. We start by establishing hardness for two pages even if every connected component in Q has at most five vertices. Observe that Theorem 4 is the counterpart to this result for FOCAP2PSL. Moreover, the overall proof idea and the gadgets that we employ are very similar; the main part that differs between the two reductions is the linear order ↘. For the sake of completeness, we provide in the following all formal arguments to establish the claimed hardness but focus on the part that differs between the two reductions.
For the following discussion, let be an instance of the NP-complete problem MONOTONE NOT ALL EQUAL 3SAT-E4 [14]; see again Section 3.2 for its definition.
Variable Gadget. Let be a variable of . As in the construction for Theorem 4, the variable gadget for consists of a selecting edge , a dummy edge , and four variable edges , . The variable edges receive the color , the remaining two edges receive the color . While the budget for these colors is the same as in Section 3.2, i.e., and , the order of the edges' endpoints differs. More concretely, we use the order ; see also Figure 8a. Due to the budget and the placement of the endpoints (note that the selecting edge nests all variable edges), we can again make the following observation.
Capacitated Linear Layouts
▶ Observation 17. In every admissible 2-page queue layout of the variable gadget for a variable we have for every .
Clause Gadget. Let be a clause of for some ; recall that is monotone, i.e., every clause contains only positive literals. Similar to the variable gadget, we also use for the clause gadget the same set of colored edges as in Section 3.2 but place their endpoints differently on the spine . More formally, the clause gadget has three literal edges , , and , each of which inherits the color of the respective variable gadget, i.e., for . Moreover, the gadget has four validator edges , , , and which have the color . We set the budget and ensure that each literal edge is nested precisely by the corresponding validator edge, i.e., ; see also Figure 8b. We now show the following analogue to Lemma 3:
▶ Lemma 18. Let be an admissible 2-page queue layout of the constructed instance that contains the clause gadget for a clause with . We have for every . Moreover, there exist two literals such that .
Proof. Let be a clause of with . The arguments for the first statement are analogous to those for Lemma 3.
For the second statement, we observe that implies for every . Thus, any solution with must also have . Since these edges have color we derive that cannot be a solution since . Hence, if is a solution, then cannot hold, and we can find that fulfills the second claim.
Putting Everything Together. For an instance of MONOTONE NOT ALL EQUAL 3SAT-E4 with variables and clauses , we replace every variable and clause with its corresponding gadget and order them on the spine by their index (where variables precede the clauses). The following theorem establishes correctness of the reduction.
▶ Theorem 19. FIXED ORDER CAPACITATED QUEUE LAYOUT is NP-complete even when restricted to balanced and tight instances with and where every connected component of has at most five vertices.
Proof. Containment in NP is immediate and we proceed with showing NP-hardness. Let be an instance of MONOTONE NOT ALL EQUAL 3SAT-E4 on variables and clauses . We construct the above-described instance of FOCAPQL. A careful analysis of the gadgets shows that it can be constructed in time, has two pages, colors, and for each color it holds . For the same reason as for Theorem 4, we can observe that the largest connected component of is induced by the variable gadgets and consists of five vertices; recall also Figure 8. We conclude the proof by establishing correctness of the reduction.
(⇒) Assume that admits a solution . We now show that also admits a solution . To this end, consider a variable and its corresponding variable gadget. As in the proof of Theorem 4, we assign to the first page if and only if is set to false. All other edges are assigned to the page ; recall also Observation 17.
Since edges in the variable gadget are only in conflict with the selecting edge (if at all), this assignment does not introduce any nesting. Since the selecting and dummy edge are on different pages (and the only edges of color ), we match the budget for on both pages. For a clause , we assign the literal edge to the page for every . To prevent nesting, we set . Since witnesses the satisfiability of , there exists a unique variable whose truth assignment differs from the other two. We assign to the same page as , i.e., . As is an isolated vertex in , this does not introduce any nesting. Moreover, each page contains precisely two edges of color and we also have . To finally conclude that is a solution to , we make the observation that in the variable gadget for any variable , all four edges , , are assigned to the same page, which is different from . For each of the four clauses that contain the variable , we have . Thus, every page contains exactly four edges of color , which matches their budget.
(⇔) Assume that is a solution for the instance of FOCAPQL. We now construct a variable assignment and consider a variable . We set to true if and only if . Consider an arbitrary clause . By Lemma 18, we can find two literals such that . Thus, there are two variables such that , i.e., they witness that the clause is satisfied under . Since was selected arbitrarily, we conclude that is a solution to .
FPT-Algorithm for Two Pages. Let be an instance of FOCAPQL and note that , which implies for positive instances [20]. As for Theorem 1, from we can conclude that every connected component of the conflict graph must be bipartite; edges are assigned to the same page if their corresponding vertices are in the same bipartition. If the number of connected components is bounded, we can branch over all valid page assignments. The proof of the following theorem is identical to Theorem 1 (by using instead of ) and thus omitted.
▶ Theorem 20. FIXED ORDER CAPACITATED QUEUE LAYOUT with pages can be solved constructively in time (which is FPT in ).
Hardness for Three Pages. We now show that we cannot generalize Theorem 20 to more than two pages. More concretely, we show that FOCAPQL is NP-complete for instances with and where is connected. This rules out an XP-algorithm with respect to the number of pages and the number of connected components .
▶ Theorem 21. FIXED ORDER CAPACITATED QUEUE LAYOUT is NP-complete even when restricted to instances with and where is connected.
Proof. We focus on NP-hardness since membership in NP is immediate. Let be an instance of FOCAPQL with and where . Recall from Theorem 19 that this problem setting is already NP-complete. Let be the number of colors in . We introduce an edge and set . Moreover, we prepend to and append to . More formally, the new spine order is obtained by taking the transitive closure of for every and for every with . To fix the budgets , we set for and for every . Furthermore, we set and . Let be the resulting instance of FOCAPQL. We can observe
Capacitated Linear Layouts
that it can be constructed in polynomial time. The edge uv nests all other edges and the corresponding vertex is, therefore, adjacent to every other vertex in , i.e., is connected. The instances and are equivalent up to the edge uv, for which the budgets ensure that it must be assigned to the third page and no other edge can be assigned to that page. Consequently, is a positive instance if and only if is, which completes the proof.
4.2 Hardness for Monochromatic Instances
With Theorem 19, we have shown that FOCAPQL is NP-complete even for fairly restricted instances. However, the hardness reduction employed in Theorem 19 constructs instances with a linear number of colors. Therefore, it is natural to ask for the complexity when parameterized by the number of colors . In this section, we show that FOCAPQL remains NP-complete even when , i.e., every edge of has the same color, which we call monochromatic instances, and, as we see later, -hard with respect to .
Overview of the Reduction. We reduce from the problem BIN PACKING defined as follows. Given a set of items, each item associated with a weight , and bins of capacity , can be partitioned into subsets such that for every ? BIN PACKING is known to be strongly NP-complete and thus we can assume that the weight of each item and the capacity are polynomially bounded in [26]. Moreover, BIN PACKING remains NP-complete even if , i.e., if every bin must be filled up to its capacity since we can simply introduce sufficiently many dummy items of weight one. On a high-level, in our reduction we represent every bin by a page. Assigning edges to that page should correspond to placing the items in a bin. To ensure correctness, we encode every item with a gadget consisting of two components. The first component consists of pairwise nesting edges, a -rainbow, which must, therefore, be distributed among pages. The second component consists of a star that represents the weight of . By placing it below the -rainbow, all edges of the star must be placed on the unique page that does not contain an edge of the rainbow. Since the instance is monochromatic, we cannot use colors to distinguish edges from the star, which should count towards our bin-capacity, from those of the rainbow, whose sole purpose is to ensure correctness of the reduction. To circumvent this limitation, we scale the weight of every item by a large number to make it distinguishable from the rainbow edges.
Item Gadget. Let be an item. The item gadget for contains rainbow edges , , and we order their endpoints along as follows. We set for every . Moreover, we set and for every .
We define to be the scaled weight of the item . Observe that the scaled weight of is still polynomially bounded in . The value star of the item gadget is a star with center and leaves , . We place the value star below the rainbow edges, i.e., set and take the transitive
We note that a similar reduction was given by Gomes et al. [16] to show that EQUITABLE COLORING is W[1]-hard parameterized by the number of colors. We expect that their reduction can be adapted to our setting, but present for completeness a self-contained reduction that furthermore allows additional edge-colors or different budgets, which we exploit in Theorem 25 and Corollary 26.

Figure 9 The item gadget for an item and with . Although the constructed instance is monochromatic, we color edges from the rainbow and the item purple and blue, respectively.

Figure 10 The constructed instance of FOCAPQL for an instance ( , ) of BIN PACKING with , , , and . For illustration purposes, we color rainbow and item edges purple and blue, respectively. Each bold edge represents edges. Gray bands indicate the different items and pages are stacked vertically.
closure of this and the above-defined relations; see the blue edges in Figure 9. Since the rainbow edges are pairwise nesting and each rainbow edge nests the value star, we observe:
▶ Observation 22. In every k-page queue layout of the item gadget for an item we have for every , . Moreover, we have for every and and thus for every .
Assigning the value star to page should correspond to placing the item in the pth bin. Observation 22 ensures that this equivalence between the two problems is well-defined.
Putting Everything Together. With the item gadget at hand, we are now ready to describe the complete reduction. Let be an instance of BIN PACKING with items , . For every item , we construct the item gadget and order all item gadgets on the spine based on the index of the item they represent. Moreover, we introduce dummy edges which will help us to satisfy the budget on every page. We place them at the end of the spine such that they are not in conflict with each other or any edge from an item gadget. Finally, we give every edge the color and set for each page the budget as . Figure 10 shows a small example of our reduction. We now establish its correctness.
▶ Theorem 23. FIXED ORDER CAPACITATED QUEUE LAYOUT is NP-complete even for instances that are balanced, tight, and monochromatic.
Proof. Let be an instance of BIN PACKING such that and and are polynomially bounded in for every . In the following, we assume without loss of generality that (otherwise, we can return a trivial
Capacitated Linear Layouts
positive or negative instance of FOCAPQL). Moreover, let be the instance of FOCAPQL that we construct. Note that can be constructed in polynomial time since is polynomially bounded in for every . Moreover, we can observe that is monochromatic, and we have and for every two pages . It remains to show correctness of the reduction.
(⇒) Assume that is a positive instance of BIN PACKING and let be a partitioning of that witnesses this. We construct a linear layout of as follows. Consider a bin , . Let be an item in the th bin and consider the corresponding item gadget. First, we assign all edges of the star to page , i.e., we set , . Next, distribute the rainbow edges in the gadget among the remaining pages, i.e., for every page there is precisely one such that . Observe that this resembles the necessary page assignment from Observation 22. In particular, no two rainbow edges from the gadget are assigned to the same page or to the page of the star (which itself does not introduce a nesting). Since and is a solution, we have . Overall, we have assigned edges to page so far. Doing the same procedure for the other bins , , we assign edges in addition to page . These account for the items that are placed in some bin , , for which we will assign one rainbow edge to page . We “fill up” page to the budget , by assigning dummy edges to page ; we argue in the end that there are sufficiently many dummy edges. Furthermore, recall that they do not nest any other edge. We repeat these steps for every item in the bin , and for every bin of the solution to eventually obtain a linear layout . Thanks to the above arguments, is an admissible queue layout. It remains to argue that there are enough dummy edges to fill up every page. We assign non-rainbow edges from the item gadgets to every page. Thus, every page “needs” additional edges. There are in total rainbow edges, and we need in total to fill up the page budgets. This gives an imbalance of precisely edges, which is the number of dummy edges. Combining all, we conclude that is a positive instance of FOCAPQL.
(⇔) Assume that admits a solution . We now construct a partitioning of into bins . Consider an item and the corresponding item gadget. Due to Observation 22, there exists a page that contains every edge of the star . We place the item in the bin and repeat this process for the remaining items of . Towards arguing that is a solution of we assume that it is not. Since we have , this means there exists a bin such that . First, assume that . By construction, this implies that we have assigned at least edges to page . Observe that we have . However, the budget of page is (recall that we have ). This contradicts the assumption that is a solution. Hence, a bin with cannot exist. Now, assume that there is a bin with . From and the pigeonhole principle, this means that there is a different bin , , , such that . However, by the above reasoning this cannot be the case. Combining all, we conclude that is a solution of .
Consequences of Theorem 23. We can observe that the hardness-construction behind Theorem 23 creates instances that have as many pages as the instance of BIN
PACKING has bins, i.e., k. This, together with the fact that the hardness already applies for monochromatic instances, allows us to derive hardness results with respect to several parameter combinations, which we discuss in the following. First, note that unary BIN PACKING is W[1]-hard with respect to the number of bins k [34]:
▶ Corollary 24. FIXED ORDER CAPACITATED QUEUE LAYOUT is W[1]-hard when parameterized by the number of pages even when restricted to balanced and monochromatic instances.
Second, we can use the same “trick” as for Theorem 21 to turn the conflict graph Q into a connected graph. To this end, we add a new edge uv of color that spans the entire instance, i.e., which ensures that Q is connected. By adding a page and adjusting the budget of every page such that precisely the additional edge uv is placed on page , we preserve equivalence between the two instances:
▶ Theorem 25. FIXED ORDER CAPACITATED QUEUE LAYOUT is NP-complete even when restricted to tight instances where and is connected.
Proof. As already observed several times, NP-membership is immediate. Towards showing NP-hardness, recall first that FOCAPQL is NP-complete even when restricted to monochromatic instances by Theorem 23. Let be such a monochromatic instance. We now construct an instance of FOCAPQL as follows. For , we take and introduce two new vertices and which are adjacent. We set and for all remaining edges of . The new spine order is obtained by taking the transitive closure of for every and for every with . For the budgets, we set and for every page . Moreover, we set and .
Since uv nests every edge , is connected. can be constructed in polynomial time. Moreover, by the definition of the budgets , we can transform every solution of to a solution of by assigning the edge uv to page . Symmetrically, a solution of can be transformed into a solution of by dropping the edge uv, which shows correctness and completes the proof.
Third, by applying (the reasoning that led to) Corollary 24 to Theorem 25 and observing that we only need one additional page to ensure that Q is connected, we can conclude:
▶ Corollary 26. FIXED ORDER CAPACITATED QUEUE LAYOUT is W[1]-hard when parameterized by the number of pages even when restricted to instances where and is connected.
4.3 Parameterizing by the Number of Pages and Colors
In this section, we show that FOCAPQL is in XP when parameterized by the number of pages and the number of colors . By Corollary 24, this result is the “best possible” we can hope for. Moreover, FOCAPQL is paraNP-hard when parameterized by and alone; recall Theorems 19 and 23. On a high-level, we employ a dynamic program (DP), which considers the edges in lexicographic order < according to , i.e., for two edges with and we have if and only if , or and . When processing the next edge , we consider every possible page assignment for . Processing the edges in lexicographic order has the algorithmic advantage that we can easily prevent two nesting edges as the following lemma underlines; see also Figure 11.
Capacitated Linear Layouts

Figure 11 Visualization of Lemma 27. Observe that only the edges uv and are nesting. The edges uv and are not nesting although . Note that implies .
▶ Lemma 27. Let be two edges such that , and . The edges and are nesting if and only if .
Proof. Let be two edges as in the statement.
(⇒) Assume that the two edges are nesting, which means that we have or . Only the former is possible by , which completes this direction.
(⇔) Assume that we have . From we get that must hold. Observe that is not possible since and would imply . Thus, we have and together with and , this implies , i.e., the two edges nest.
We can now present our XP-algorithm, which can be seen as a more involved variant of the classical polynomial-time algorithm for fixed-order queue layouts [29].
▶ Theorem 28. FIXED ORDER CAPACITATED QUEUE LAYOUT can be solved constructively in time (which is XP in ).
Proof. For the following arguments, fix an instance of FOCAPQL. We first order the edges of lexicographically according to . This preprocessing step can be done in time. Let denote the resulting order of the edges. For ease of presentation, we re-index the edges of according to , i.e., for every two edges we have if and only if . Furthermore, we index the vertices of according to , i.e., for every two vertices we have if and only if . Call this first step the preprocessing step.
The Algorithm. We employ a dynamic programming (DP) approach that considers the edges according to the lexicographic order < and evaluates all potential page assignments for each new edge. Thanks to Lemma 27 it is sufficient to store for each page, in addition to the number of edges on that page of each color, the rightmost vertex which is incident to an edge on that page. More formally, we consider states, which are defined by an edge , a number for every page and color , and up to one vertex for every page . For a state , we use to address the edge , to address for and , and to address the vertex for or if there is no such vertex . Let be the graph where . We call a state with feasible if and only if there exists an -page queue layout of such that there are precisely edges of color assigned to page , for every and , and is the rightmost vertex which is incident to an edge on page , for every . If no edge is assigned to a page , then we require . In our algorithm, we maintain a binary DP-table which should store, for every state , whether it is feasible.
Consider a state . We now describe how to compute , assuming that has already been computed for every state where , , and . First, we consider the base case where , . We set if and only if there exists a page such that
B1.
B2. for every color ,
B3. for every page and color ,
B4. , and
B5. for every page .
Observe that the above conditions encode the assignment of the edge to the page p.
Now consider the general case with , , for some . We set if and only if there exists a state with , , and a page such that all of the following conditions are satisfied.
G1.
G2. for every color ,
G3. for every page and color ,
G4. or for some with ,
G5. , and
G6. for every page .
As before, these conditions encode the assignment of the edge to the page . In particular, Condition G4 ensures that the edge does not nest another edge on page ; recall Lemma 27.
We now show that the above conditions preserve feasibility of the states.
▷ Claim 29. Let I be a state. We have if and only if I is feasible.
Proof. We show the claim using induction on (the order of) .
As our base case, we consider states with . Recall for the following arguments Conditions B1–B5. Assume that is feasible. Thus, by definition, there exists an -page queue layout of such that there are precisely edges of color assigned to page , for every and , and is the rightmost vertex which is incident to an edge on page , for every . Since contains precisely the edge , the page witnesses that all conditions are satisfied. Thus, we have . Conversely, assume . Let be the page that satisfies Conditions B1–B5 and consider the linear layout with . Since contains precisely the edge , this layout witnesses the feasibility of .
For the inductive step, we assume that the statement holds for all states with for . Recall for the following arguments Conditions G1–G6. Assume that is feasible and consider the -page queue layout of witnessing this. Observe that the layout with for all with is an -page queue layout of . In particular, the layout witnesses the feasibility of the corresponding state . Observe that we consider when evaluating as . Moreover, in terms of the values , the two states differ precisely in , and we have . Regarding the -values, the two states differ only on the page . Since for every edge of , we have that for ; recall Lemma 27. Consequently, we satisfy Conditions G1–G6 for state by choosing and thus have . Finally, assume and consider the state and the page that we used to satisfy Conditions G1–G6. Since and , is feasible by induction hypothesis. Consider the -page queue layout of witnessing feasibility of and extend it by assigning the edge to page . We observe that the resulting layout is an -page queue layout of . To see why this is the case, assume that two edges nest on some page and observe that must be one of them. Let the other edge be with . Since we consider the edges in lexicographic order, we have . Thus, we have ( would
Capacitated Linear Layouts
imply . Since , satisfies Condition G4. This implies or for some with . However, this contradicts the above-established order as the endpoint of the edge on page is to the right of . Thus, and cannot nest and is an -page queue layout of . The remaining conditions ensure consistency between the two states. Hence, witnesses feasibility of .
Once the DP-table has been computed, we evaluate every state with and and check whether it adheres to our budget constraints, i.e., whether we have for every page and color . If we can find such a state, then we can conclude, by Claim 29, that is a positive instance. On the other hand, if is a positive instance, the corresponding solution witnesses feasibility for some state with , which implies by Claim 29. Call this last step the postprocessing step. Combining all, we conclude that our DP-algorithm is correct and we now argue its running time.
Running Time. We first bound the size of the DP-table . The graph contains edges and the value ranges between 0 and for every page and color . Moreover, there are possible values for for every page ; recall the dummy value . Hence, there are different states , which also bounds the size of . Evaluating a single state takes time, since we just need to examine all potential page assignments for the edge and evaluate the resulting state , for which only the rightmost vertex is still unspecified. Thus, filling the entire table takes time. Since this dominates the time for the pre- and postprocessing steps, this also bounds the overall running time of our algorithm. Finally, we can obtain an admissible -page queue layout by standard backtracking techniques (if there exists one).
4.4 Towards Completing the Complexity Landscape
In this section, we consider the remaining parameter combinations depicted in Figure 2. First, we parameterize by the number of pages , the number of colors , and the maximum size of a connected component in the conflict graph Q. There, we can apply the same proof strategy as for Theorem 14 (when considering nestings instead of crossings). More concretely, we partition the connected components of Q into different types such that components of the same type are equal up to a (color-preserving) isomorphism. Then, we formulate an ILP with variables that constrains the number of components of each type that can use the same page assignment. Together with Proposition 9, this implies:
▶ Theorem 30. FIXED ORDER CAPACITATED QUEUE LAYOUT is FPT in the number of pages , number of colors , and the maximum size of a connected component of .
Finally, we parameterize by the number of connected components in the conflict graph and their maximum size . Consider an instance of FOCAPQL. Since contains one vertex for each edge of and we can assume without loss of generality that there are no isolated vertices in , we have . With this we can show that we can restrict ourselves to a bounded number of pages and colors, i.e., obtain a kernel, which allows us to brute-force :
▶ Theorem 31. FIXED ORDER CAPACITATED QUEUE LAYOUT can be solved constructively in time (which is FPT in the number of connected components of and their maximum size ).
Proof. Let be an instance of FOCAPQL. Consider the conflict graph . It has at most vertices and since it contains precisely one vertex for every edge of , we get . Moreover, we can assume without loss of generality that there are no isolated vertices in , as they can be removed without affecting the existence of a solution. Thus, we have .
Since , we can also assume that holds. Otherwise, we can remove unused colors and renumber them from 1 to to obtain an equivalent instance where the above inequality holds. By similar arguments, we can also assume that holds for every page and color . Consequently, there are at most different budget functions . If has more than pages with the same budget vector , then we can remove one page from the instance without affecting the existence of a solution. This is because, by the pigeonhole principle, in every solution one of these pages will remain empty so we can convert any solution into one where the “removed pages” are empty. Thus, it suffices to consider at most different pages and we can find them after a -time preprocessing step.
This allows us to brute-force all possible page assignments, which are many. For each page assignment , we can check in polynomial time (in ) whether they correspond to a solution . The statement now follows.
5 Generalizations and Concluding Remarks
In this paper, we have introduced the concept of a capacitated linear layout and studied the complexity of computing an -page capacitated stack/queue layout with given spine order . Although we only considered unweighted graphs in this paper, our algorithmic results can be extended to edge-weighted graphs (when the largest edge-weight is a parameter).
One prominent open question is settling the complexity of FOCAPQL when parameterized by the number of colors and the size of the largest connected component in the conflict graph Q; recall Figure 2. Furthermore, recent work studied the parameterized complexity of computing an -page stack and queue layout with respect to several graph parameters (even when is not part of the input); see for example [17]. Extending these results to the capacitated setting is an interesting direction for future work. A further natural direction is other variants of capacitated linear layouts, such as capacitated mixed linear layouts.
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 Muhammad Jawaherul Alam, Michael A. Bekos, Vida Dujmovic, Martin Gronemann, Michael Kaufmann, and Sergey Pupyrev. On dispersable book embeddings. Theoretical Computer Science, 861:1–22, 2021. doi:10.1016/J.TCS.2021.01.035.
3 Patrizio Angelini, Michael A. Bekos, Philipp Kindermann, and Tamara Mchedlidze. On mixed linear layouts of series-parallel graphs. Theoretical Computer Science, 936:129–138, 2022. doi:10.1016/J.TCS.2022.09.019.
4 Patrizio Angelini, Marco Di Bartolomeo, and Giuseppe Di Battista. Implementing a partitioned 2-page book embedding testing algorithm. In Walter Didimo and Maurizio Patrignani, editors, Proc. 20th International Symposium on Graph Drawing and Network Visualization (GD'12), volume 7704 of Lecture Notes in Computer Science, pages 79–89. Springer, 2013. doi:10.1007/978-3-642-36763-2_8.
Capacitated Linear Layouts
5 Patricia Bachmann, Ignaz Rutter, and Peter Stumpf. On 3-Coloring circle graphs. Journal of Graph Algorithms and Applications, 28(1):389–402, 2024. doi:10.7155/JGAA.V28I1.2991.
6 Michael A. Bekos, Carla Binucci, Emilio Di Giacomo, Walter Didimo, Luca Grilli, Maria Eleni Pavlidi, Alessandra Tappini, and Alexandra Weinberger. Stack and queue layouts with defects. In Proc. 34th International Symposium on Graph Drawing and Network Visualization (GD'26), 2026. To appear.
7 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 Journal on Computing, 48(5):1487–1502, 2019. doi:10.1137/19M125340X.
8 Michael A. Bekos, Michael Kaufmann, Maria Eleni Pavlidi, and Xenia Rieger. On the deque and riche numbers of complete and complete bipartite graphs. In Denis Pankratov, editor, Proc. 35th Canadian Conference on Computational Geometry (CCCG'23), pages 89–95, 2023.
9 Frank Bernhart and Paul C. Kainen. The Book Thickness of a Graph. Journal of Combinatorial Theory, Series B, 27(3):320–331, 1979. doi:10.1016/0095-8956(79)90021-2.
10 Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin Nöllenburg. Parameterized algorithms for book embedding problems. In Daniel Archambault and Csaba D. Tóth, editors, Proc. 27th International Symposium on Graph Drawing and Network Visualization (GD'19), volume 11904 of Lecture Notes in Computer Science, pages 365–378. Springer, 2019. doi:10.1007/978-3-030-35802-0_28.
11 Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin Nöllenburg. Parameterized algorithms for book embedding problems. Journal of Graph Algorithms and Applications, 24(4):603–620, 2020. doi:10.7155/JGAA.00526.
12 Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin Nöllenburg. Parameterized algorithms for queue layouts. Journal of Graph Algorithms and Applications, 26(3):335–352, 2022. doi:10.7155/JGAA.00597.
13 Fan R. K. Chung, Frank T. Leighton, and Arnold L. Rosenberg. Embedding graphs in books: A layout problem with applications to VLSI design. SIAM Journal on Algebraic and Discrete Methods, 8(1):33–58, 1987.
14 Andreas Darmann and Janosch Döcker. On a simple hard variant of not-all-equal 3-sat. Theoretical Computer Science, 815:147–152, 2020. doi:10.1016/j.tcs.2020.02.010.
15 Syamantak Das and Andreas Wiese. On minimizing the makespan when some jobs cannot be assigned on the same machine. In Kirk Pruhs and Christian Sohler, editors, Proc. 25th European Symposium on Algorithms (ESA'17), volume 87 of LIPIcs, pages 31:1–31:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPICS.ESA.2017.31.
16 Guilherme de C. M. Gomes, Carlos V. G. C. Lima, and Vinícius Fernandes dos Santos. Parameterized complexity of equitable coloring. Discrete Mathematics & Theoretical Computer Science, 21(1), 2019. doi:10.23638/DMTCS-21-1-8.
17 Thomas Depian, Simon D. Fink, Robert Ganian, and Vaishali Surianarayanan. Linear layouts revisited: Stacks, queues, and exact algorithms. In Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz Herman, editors, Proc. 33rd European Symposium on Algorithms (ESA'25), volume 351 of LIPIcs, pages 15:1–15:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPICS.ESA.2025.15.
18 Emilio Di Giacomo, Walter Didimo, Henry Förster, Torsten Ueckerdt, and Johannes Zink. Linear layouts of graphs with priority queues. In Pat Morin and Eunjin Oh, editors, Proc. 19th International Symposium on Algorithms and Data Structures (WADS'25), volume 349 of LIPIcs, pages 29:1–29:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPICS.WADS.2025.29.
19 Vida Dujmovic, Gwenaël Joret, Piotr Micek, Pat Morin, Torsten Ueckerdt, and David R. Wood. Planar graphs have bounded queue-number. Journal of the ACM, 67(4):22:1–22:38, 2020. doi:10.1145/3385731.
20 Vida Dujmovic and David R. Wood. On linear layouts of graphs. Discrete Mathematics & Theoretical Computer Science, 6(2):339–358, 2004. doi:10.46298/DMTCS.317.
21 Peter Eades, Seokhee Hong, Giuseppe Liotta, Fabrizio Montecchiani, Martin Nöllenburg, Tommaso Piselli, and Stephen K. Wismath. Introducing fairness in network visualization. Information Sciences, 691:121642, 2025. doi:10.1016/J.INS.2024.121642.
22 Henry Förster, Michael Hoffmann, Stephen G. Kobourov, Maria Eleni Pavlidi, Alexandra Weinberger, and Johannes Zink. Weighted book thickness. In Proc. 34th International Symposium on Graph Drawing and Network Visualization (GD'26), 2026. To appear.
23 Vincent Froese, Leon Kellerhals, and Rolf Niedermeier. Modification-fair cluster editing. In Proc. 36th AAAI Conference on Artificial Intelligence (AAAI'22), pages 6631–6638. AAAI Press, 2022. doi:10.1609/AAAI.V36I6.20617.
24 Robert Ganian, Fabian Klute, and Sebastian Ordyniak. On structural parameterizations of the bounded-degree vertex deletion problem. Algorithmica, 83(1):297–336, 2020. doi:10.1007/s00453-020-00758-8.
25 Robert Ganian, Haiko Müller, Sebastian Ordyniak, Giacomo Paesani, and Mateusz Rychlicki. A tight subexponential-time algorithm for two-page book embedding. In Karl Bringmann, Martin Grohe, Gabriele Puppis, and Ola Svensson, editors, Proc. 51st International Colloquium on Automata, Languages and Programming (ICALP'24), volume 297 of LIPIcs, pages 68:1–68:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.ICALP.2024.68.
26 Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman, 1979.
27 Christian Haslinger and Peter F. Stadler. RNA structures with pseudo-knots: Graph-theoretical, combinatorial, and statistical properties. Bulletin of Mathematical Biology, 61(3):437–467, 1999. doi:10.1006/bulm.1998.0085.
28 Deborah Haun, Laura Merker, and Sergey Pupyrev. Forbidden patterns in mixed linear layouts. In Olaf Beyersdorff, Michal Pilipczuk, Elaine Pimentel, and Kim Thang Nguyen, editors, Proc. 42nd Symposium on Theoretical Aspects of Computer Science (STACS'25), volume 327 of LIPIcs, pages 45:1–45:21. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPICS.STACS.2025.45.
29 Lenwood S. Heath and Arnold L. Rosenberg. Laying out graphs using queues. SIAM Journal on Computing, 21(5):927–958, 1992. doi:10.1137/0221055.
30 John Hopcroft and Robert Tarjan. Efficient planarity testing. Journal of the ACM, 21(4):549–568, 1974. doi:10.1145/321850.321852.
31 Tanmay Inamdar, Daniel Lokshtanov, Saket Saurabh, and Vaishali Surianarayanan. Parameterized complexity of fair bisection: (FPT-Approximation meets unbreakability). In Inge Li Görtz, Martin Farach-Colton, Simon J. Puglisi, and Grzegorz Herman, editors, Proc. 31st Annual European Symposium on Algorithms (ESA'23), volume 274 of LIPIcs, pages 63:1–63:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.ESA.2023.63.
32 Guy Jacobson. Space-efficient static trees and graphs. In Proc. 30th Annual Symposium on Foundations of Computer Science (FOCS'89), pages 549–554. IEEE Computer Society, 1989. doi:10.1109/SFCS.1989.63533.
33 Klaus Jansen. The mutual exclusion scheduling problem for permutation and comparability graphs. Information and Computation, 180(2):71–81, 2003. doi:10.1016/s0890-5401(02)00028-7.
34 Klaus Jansen, Stefan Kratsch, Dániel Marx, and Ildikó Schlotter. Bin packing with fixed number of bins revisited. Journal of Computer and System Sciences, 79(1):39–49, 2013. doi:10.1016/j.jcss.2012.04.004.
35 Paul C. Kainen. The book thickness of a graph II. Congressus Numerantium, 71:121–132, 1990.
36 Julia Katheder, Michael Kaufmann, Sergey Pupyrev, and Torsten Ueckerdt. Transforming stacks into queues: Mixed and separated layouts of graphs. In Olaf Beyersdorff, Michal
Capacitated Linear Layouts
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Pilipczuk, Elaine Pimentel, and Kim Thang Nguyen, editors, Proc. 42nd Symposium on Theoretical Aspects of Computer Science (STACS'25), volume 327 of LIPIcs, pages 56:1–56:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPICS.STACS.2025.56.
Hendrik W. Lenstra. Integer programming with a fixed number of variables. Mathematics of Operations Research, 8(4):538–548, 1983. doi:10.1287/moor.8.4.538.
Jure Leskovec, Daniel P. Huttenlocher, and Jon M. Kleinberg. Signed networks in social media. In Elizabeth D. Mynatt, Don Schoner, Geraldine Fitzpatrick, Scott E. Hudson, W. Keith Edwards, and Tom Rodden, editors, Proc. 28th International Conference on Human Factors in Computing Systems (CHI'10), pages 1361–1370. ACM, 2010. doi:10.1145/1753326.1753532.
Yunlong Liu, Jie Chen, and Jingui Huang. Parameterized algorithms for fixed-order book drawing with bounded number of crossings per edge. In Weili Wu and Zhongnan Zhang, editors, Proc. 14th International Conference on Combinatorial Optimization and Applications (COCOA'20), volume 12577 of Lecture Notes in Computer Science, pages 562–576. Springer, 2020. doi:10.1007/978-3-030-64843-5_38.
Giordano Da Lozzo, Fabrizio Frati, and Ignaz Rutter. Upward book embeddings of partitioned digraphs. In Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri, editors, Proc. 42nd International Symposium on Computational Geometry (SoCG'26), volume 367 of LIPIcs, pages 36:1–36:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2026. doi:10.4230/LIPICS.SOCG.2026.36.
Laura Merker and Torsten Ueckerdt. Local and union page numbers. In Daniel Archambault and Csaba D. Tóth, editors, Proc. 27th International Symposium on Graph Drawing and Network Visualization (GD'19), volume 11904 of Lecture Notes in Computer Science, pages 447–459. Springer, 2019. doi:10.1007/978-3-030-35802-0_34.
Laura Merker and Torsten Ueckerdt. The local queue number of graphs with bounded treewidth. In David Auber and Pavel Valtr, editors, Proc. 28th International Symposium on Graph Drawing and Network Visualization (GD'20), volume 12590 of Lecture Notes in Computer Science, pages 26–39. Springer, 2020. doi:10.1007/978-3-030-68766-3_3.
J. Ian Munro and Venkatesh Raman. Succinct representation of balanced parentheses and static trees. SIAM Journal on Computing, 31(3):762–776, 2001. doi:10.1137/S0097539799364092.
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, Proc. 5th Symposium on the Theory of Computing (STOC'73), pages 268–277. ACM, 1973. doi:10.1145/800125.804058.
Victor Reis and Thomas Rothvoss. The subspace flatness conjecture and faster integer programming. In Proc. 64th IEEE Annual Symposium on Foundations of Computer Science (FOCS'23), pages 974–988. IEEE, 2023. doi:10.1109/focs57990.2023.00060.
Arnold L. Rosenberg. The diogenes approach to testable fault-tolerant arrays of processors. IEEE Transactions on Computers, 32(10):902–910, 1983. doi:10.1109/TC.1983.1676134.
Ajaykrishnan E. S., Robert Ganian, Daniel Lokshtanov, and Vaishali Surianarayanan. A quasi-polynomial time algorithm for 3-Coloring circle graphs. In Sepehr Assadi and Eva Rotenberg, editors, Proc. 9th SIAM Symposium on Simplicity in Algorithms (SOSA'26), pages 65–80. SIAM, 2026. doi:10.1137/1.9781611978964.6.
Robert E. Tarjan. Sorting using networks of queues and stacks. Journal of the ACM, 19(2):341–346, 1972. doi:10.1145/321694.321704.
Walter Unger. On the k-colouring of circle-graphs. In Robert Cori and Martin Wirsing, editors, Proc. 5th Symposium on Theoretical Aspects of Computer Science (STACS'88), volume 294 of Lecture Notes in Computer Science, pages 61–72. Springer, 1988. doi:10.1007/BFB0035832.
Jennifer Vandenbussche, Douglas B. West, and Gexin Yu. On the pagenumber of k-trees. SIAM Journal on Discrete Mathematics, 23(3):1455–1464, 2009. doi:10.1137/080714208.
51 Veit Wiechert. On the queue-number of graphs with bounded tree-width. The Electronic Journal of Combinatorics, 24(1):1, 2017. doi:10.37236/6429.
52 Avi Wigderson. The Complexity of the Hamiltonian Circuit Problem for Maximal Planar Graphs. Technical Report 298, Princeton University, 1982.