arXiv:2610.18071cs.DSOct 2026

Manuscript Offprint

arXiv:2610.18071

On the Parameterized Complexity of Capacitated Stack and Queue Layouts with Colored Edges

Thomas Depian, Giuseppe Liotta, Fabrizio Montecchiani, Martin Nöllenburg

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 ⟨≺,σ⟩\langle\prec,\sigma\rangle of a graph GG consists of a total ordering ≺\prec of its vertices and of a partitioning σ\sigma 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 (p,c)(p,c) – this budget determines the maximum number of edges of color cc that page pp 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 ≺\prec is part of the input – for which an ordinary 2-page stack or ℓ\ell-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 ≺\prec. 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 ⟨≺,σ⟩\langle\prec,\sigma\rangle of a graph GG consists of a total order ≺\prec of its vertices and a partition σ\sigma of its edges into pages, such that edges on the same page avoid specified patterns with respect to ≺\prec. 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 ≺\prec: 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 ℓ\ell such that G admits a stack (queue) layout in which the edges incident to each vertex belong to at most ℓ\ell 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 χ\chi colors, and each page has a separate budget for each color. The goal is to find a stack or queue layout using at most ℓ\ell 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 χ=1\chi = 1 and assigning every page a budget of ∣E(G)∣|E(G)|; 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 ∣E(G)∣|E(G)| 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

Figure

(a)

Figure

(b)

Figure

(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 ≺1\prec_1 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 G=(V,E)G = (V, E), an edge coloring function δ:E→[χ]\delta: E \to [\chi] on χ\chi colors, a linear order ≺\prec on VV, an integer ℓ∈N\ell \in \mathbb{N}, and budgets bp:[χ]→N0b_p: [\chi] \to \mathbb{N}_0 for every page p∈[ℓ]p \in [\ell].

Question Does there exist an ℓ\ell-page stack (queue) layout ⟨≺,σ⟩\langle \prec, \sigma \rangle of GG such that ∣{e∈E∣δ(e)=c,σ(e)=p}∣≤bp(c)|\{e \in E \mid \delta(e) = c, \sigma(e) = p\}| \leq b_p(c) for every page p∈[ℓ]p \in [\ell] and color c∈[χ]c \in [\chi]?

Since we mainly consider ℓ=2\ell = 2 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 bb times, for some value of bb; 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 ≺\prec and the number of allowed colors is the number of pages ℓ\ell. However, recall that we have, on the one hand, an edge-colored graph GG and we can observe, on the other hand, that known hardness results for bounded vertex colorings for constant bb require an unbounded number of colors, i.e., pages. In contrast, when adding edge colors we show that, despite ≺\prec being fixed, both problems are NP-complete already for two pages ( ℓ=2\ell = 2), which clearly separates the complexity of the problems with and without page capacities unless P=NPP = NP. 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.

References (50)