Parameterized Algorithms for Queue Layouts
Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, Martin Nöllenburg
PParameterized Algorithmsfor Queue Layouts (cid:63)
Sujoy Bhore , , Robert Ganian , Fabrizio Montecchiani , andMartin N¨ollenburg Algorithms and Complexity Group, TU Wien, Vienna, Austria { sujoy,rganian,noellenburg } @ac.tuwien.ac.at Universit´e libre de Bruxelles (ULB), Bruxelles, Belgium Dipartimento di Ingegneria, Universit`a degli Studi di Perugia, Perugia, Italy [email protected]
Abstract. An h -queue layout of a graph G consists of a linear order ofits vertices and a partition of its edges into h queues , such that no twoindependent edges of the same queue nest. The minimum h such that G admits an h -queue layout is the queue number of G . We present twofixed-parameter tractable algorithms that exploit structural propertiesof graphs to compute optimal queue layouts. As our first result, we showthat deciding whether a graph G has queue number 1 and computinga corresponding layout is fixed-parameter tractable when parameterizedby the treedepth of G . Our second result then uses a more restrictiveparameter, the vertex cover number, to solve the problem for arbitrary h . Keywords:
Queue number · Parameterized complexity · Treedepth · Vertex Cover Number · Kernelization An h -queue layout of a graph G is a linear layout of G consisting of a linearorder of its vertices and a partition of its edges into queues , such that no twoindependent edges of the same queue nest [21]; see Fig. 1 for an illustration. The queue number qn( G ) of a graph G is the minimum number of queues in anyqueue layout of G . While such linear layouts represent an abstraction of variousproblems such as, for instance, sorting and scheduling [3, 27], they also play acentral role in three-dimensional graph drawing. It is known that a graph classhas bounded queue number if and only if every graph in this class has a three-dimensional crossing-free straight-line grid drawing in linear volume [9, 13]. Werefer the reader to [15, 24] for further references and applications. Moreover, itis worth recalling that stack layouts [23, 29] (or book embeddings ), which allownesting edges but forbid edge crossings, form the “dual” concept of queue layouts. (cid:63) Research of FM partially supported by Dip. Ingegneria Univ. Perugia, RICBA19FM:“Modelli, algoritmi e sistemi per la visualizzazione di grafi e reti”. RG acknowledgessupport from the Austrian Science Fund (FWF) grant P 31336, SB and MN ac-knowledge support from FWF grant P 31119. a r X i v : . [ c s . C G ] A ug Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin N¨ollenburg
Fig. 1.
A 4-queue layout of K . A rich body of literature is concerned with the study of upper bounds forthe queue number of several planar and non-planar graph families (see, e.g., [1,2, 8, 11–13, 20, 28] and also [14] for additional references). For instance, a graphof treewidth w has queue number at most O (2 w ) [28], while every proper minor-closed class of graphs (including planar graphs) has constant queue number [12].Of particular interest to us is the corresponding recognition problem, whichwe denote by Queue Number : Given a graph G and a positive integer h , de-cide whether G admits an h -queue layout. In 1992, in a seminal paper, Heathand Rosenberg proved that 1- Queue Number , i.e., the restriction of
QueueNumber to h = 1, is NP -complete [21]. In particular, they characterized thegraphs that admit queue layouts with only one queue as the arched leveled-planargraphs, and showed that the recognition of these graphs is NP -complete [21].Since Queue Number is NP -complete even for a single queue, it is natural toask under which conditions the problem can be solved efficiently. For instance,it is known that if the linear order of the vertices is given (and the aim isthus to simply partition the edges of the graph into queues), then the problembecomes solvable in polynomial time [20]. We follow up on recent work made forthe stack number [4] and initiate the study of the parameterized complexity of Queue Number by asking under which parameterizations the problem is fixed-parameter tractable. In other words, we are interested in whether (1-)
QueueNumber can be solved in time f ( k ) · n O (1) for some computable function f ofthe considered structural parameter k of the n -vertex input graph G .As our main result, we show 1- Queue Number is fixed-parameter tractableparameterized by the treedepth of the input graph (Section 3). We remark thattreedepth is a fundamental graph parameter with close ties to the theory of graphsparsity (see, e.g., [22]). The main technique used by the algorithm is iterativepruning, where we recursively identify irrelevant parts of the input and removethese until we obtain a bounded-size equivalent instance (a kernel ) solvable bybrute force. While the iterative pruning technique has already been used in a fewother algorithms that exploit treedepth [17–19], the unique challenge here lay inestablishing that the removal of seemingly irrelevant parts of the graph cannotchange NO-instances to YES-instances. The proof of this claim, formalized inLemma 1, uses a new type of block decomposition of 1-queue layouts. arameterized Algorithms for Queue Layouts 3
For our second result, we turn to the general
Queue Number problem. Here,we establish fixed-parameter tractability when parameterized by a larger param-eter, namely the vertex cover number (Section 4). This result is also achievedby kernelization and forms a natural counterpart to the recently establishedfixed-parameter tractability of computing the stack number under the same pa-rameterization [4], although the technical arguments and steps of the proof differdue to the specific properties of queue layouts.
Note:
Full proofs of statements marked with (*) can be found in the appendix.
We can assume that our input graphs are connected, as the queue number of agraph is the maximum queue number over all its connected components. Givena graph G = ( V, E ) and a vertex v ∈ V , let N ( v ) be the set of neighbors of v in G . Also, for r ∈ N , we denote by [ r ] the set { , . . . , r } . An h -queue layout of G is a pair (cid:104)≺ , σ (cid:105) , where ≺ is a linear order of V , and σ : E → [ h ] is a functionthat maps each edge of E to one of h queues. In an h -queue layout (cid:104)≺ , σ (cid:105) of G ,it is required that no two independent edges in the same queue nest , that is, forno pair of edges uv, wx ∈ E with four distinct end-vertices and σ ( uv ) = σ ( wx ),the vertices are ordered as u ≺ w ≺ x ≺ v . Given two distinct vertices u and v of G , u is to the left of v if u ≺ v , else u is to the right of v . Note that a 1-queuelayout of G is simply defined by a linear order ≺ of V and σ ≡ Treedepth.
Treedepth is a parameter closely related to treewidth, and the struc-ture of graphs of bounded treedepth is well understood [22]. We formalize a fewnotions needed to define treedepth, see also Fig. 2 for an illustration. A rootedforest F is a disjoint union of rooted trees. For a vertex x in a tree T of F , the height (or depth ) of x in F is the number of vertices in the path from the rootof T to x . The height of a rooted forest is the maximum height of a vertex of theforest. Let V ( T ) be the vertex set of any tree T ∈ F . Definition 1 (Treedepth).
Let the closure of a rooted forest F be the graphclos ( F ) = ( V c , E c ) with the vertex set V c = (cid:83) T ∈F V ( T ) and the edge set E c = { xy | x is an ancestor of y in some T ∈ F} . A treedepth decomposition of agraph G is a rooted forest F such that G ⊆ clos ( F ) . The treedepth td ( G ) of agraph G is the minimum height of any treedepth decomposition of G . An optimal treedepth decomposition can be computed by an FPT algorithm.
Proposition 1 ( [26] ).
Given an n -vertex graph G and an integer k , it ispossible to decide whether G has treedepth at most k , and if so, to compute anoptimal treedepth decomposition of G in time O ( k ) · n . Proposition 2 ( [22] ).
Let G be a graph and td ( G ) ≤ k . Then G has no pathof length k . Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin N¨ollenburg (a)
32 1 5468791211 10 C C C (b) Fig. 2. (a) A graph G and (b) a treedepth decomposition F of G of height 4. Inparticular, P = { , } , A = { C , C , C } , and m = 3. Vertex cover number. A vertex cover C of a graph G = ( V, E ) is a subset C ⊆ V such that each edge in E has at least one incident vertex in C . The vertexcover number of G , denoted by τ ( G ), is the size of a minimum vertex cover of G .Observe that td ( G ) ≤ τ ( G ) + 1: it suffices to build F as a single path with vertexset C and with leaves V \ C . Computing an optimal vertex cover of G is FPT. Proposition 3 ( [5] ).
Given an n -vertex graph G and a constant τ , it ispossible to decide whether G has vertex cover number at most τ , and if so, tocompute a vertex cover C of size τ of G in time O (2 τ + τ · n ) . In this section, we establish our main result: the fixed-parameter tractability of 1-
Queue Number parameterized by treedepth. We formalize the statement below.
Theorem 1.
Let G be a graph with n vertices and constant treedepth k . We candecide in O ( n ) time whether G has queue number one, and, if this is the case,we can also output a -queue layout of G . Since we assume G to be connected, any treedepth decomposition of G consistsof a single tree T . Now, suppose that a treedepth decomposition T of G of depth k is given. For a vertex t of T , let P t be the set of ancestors of t including t , let A t be the set of connected components of G − P t which contain a child of t , and m t be the maximum number of vertices in a component in A t ; see also Fig. 2(b). Observation 1
For every component C ∈ A t and for every vertex v ∈ C , itholds that N ( v ) ⊆ C ∪ P t . Moreover, | C ∪ P t | ≤ m t + k . arameterized Algorithms for Queue Layouts 5 Now, we define the following equivalence over components in A t . Components B, C ∈ A t satisfy B ∼ C if and only if there exists a bijective renaming function η B,C : B → C over (the vertices of) B, C such that each vertex b i ∈ B has a counterpart η B,C ( b i ) = c i ∈ C that satisfies: (i) N ( b i ) ∩ P t = N ( c i ) ∩ P t and (ii) b i is adjacent to b j ∈ B if and only if c i is adjacent to its counterpart c j . When B, C are clear from the context, we may drop the subscript of η for brevity.By Observation 1, the number of equivalence classes of ∼ is upper-bounded bythe number of possible graphs on k + m t vertices, which is at most 2 ( k + m t ) . Thenext observation allows us to propagate the bounds formalized by the notationabove from children towards the root. Observation 2
If for a vertex t of T there exist integers a, b such that eachchild q of t satisfies | A q | ≤ a and m q ≤ b , then m t ≤ ( a · b ) + 1 . The main component of our treedepth algorithm is Lemma 1, stated be-low. Intuitively, applying Lemma 1 bottom-up on T (together with Observa-tion 2) allows us to iteratively remove subtrees from T while preserving the(non-)existence of a hypothetical solution—in particular, we will be able to prunesubtrees of parents with a very large number of children until we reach an equiv-alent instance where each vertex has a bounded number of children. To formalizethe meaning of “very large”, we define the following function for i ≥ children ( k, i ) = (cid:0)(cid:0) (2 ( k +1) + 1) size ( k,i ) + 1 (cid:1) · ( size ( k, i ) + k )! (cid:1) · ( k + size ( k,i )) , where size ( k, i ) is a recursively defined function that captures the size boundgiven by Observation 2 as follows: – size ( k, i ) = ( size ( k, i − · children ( k, i − i ≥
2, and – size ( k,
1) = children ( k,
1) = 0.
Lemma 1.
Assume G has a vertex t at depth i in T such that | A t | ≥ k, i ) ,but m t ≤ size( k, i ) and every descendant q of t in T satisfies that | A q | ≤ k, i − . Then there exists a component B of A t such that G − B has queue number one if and only if G has queue number one. Moreover, B canbe computed in time size( k, i )! · k, i ) . The proof of the lemma is deferred to Section 3.2. Before proceeding, weshow how Lemma 1 is used to obtain Theorem 1.
Proof (of Theorem 1).
We start by applying Proposition 1 to compute a treedepthdecomposition T of G of depth at most k . Consider now vertices at depth k − T , i.e., vertices whose children are all leaves in T , and set i = 2. Observe thatevery vertex v at this depth satisfies m v ≤ size ( k,
2) since size ( k,
2) = 1 and m v = 1. If | A v | ≥ ( k, v at depth k − | A v | < ( k, k −
1. In particular, assume that for some depth 1 ≤ d ≤ k − v Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin N¨ollenburg at depth d satisfies | A v | < ( k, i ), where i = k − d + 1. Then we canset d (cid:48) := d − i (cid:48) := i + 1, and recall from Observation 2 that every vertex v (cid:48) at depth d (cid:48) satisfies m v ≤ size ( k, i (cid:48) ). Hence, if v (cid:48) has too many subtrees—inparticular, if | A v (cid:48) | ≥ ( k, i (cid:48) )—we will once again apply Lemma 1 toobtain an equivalent smaller instance, in which case we restart the algorithm.Repeating this procedure for d (cid:48) will eventually stop, and at that point it willhold that | A v (cid:48) | < ( k, i (cid:48) ) for every v (cid:48) at depth d (cid:48) , in turn allowing us tocontinue with the induction.The above procedure will halt only once the root r of T satisfies | A r | < ( k, k ) and m r ≤ size ( k, k ). At that point, we have a kernel G (cid:48) [7, 10]—an equivalent graph that has size bounded by a function of k , notably by f ( k ) = ( k, k ) · size ( k, k ) + 1. To prove Theorem 1, it suffices to decide whether G (cid:48) admits a 1-queue layout by a brute-force algorithm that runs in time O ( f ( k )! · f ( k ) ). Since Lemma 1 is applied O ( n ) times and the runtime of the associatedalgorithm is O ( size ( k, k ) · ( k, k ) ), the total runtime is upper-boundedby a function of k times n . Finally, we note that while it would be possible toprovide a term upper-bounding the dependency on k of the running time, it isclear that such a term must necessarily be non-elementary—indeed, the recursivedefinition of the two functions ( k, k ) and size ( k, k ) results in a towerof exponents of height k . (cid:117)(cid:116) Since we have | A t | ≥ (cid:0)(cid:0) (2 ( k +1) +1) size ( k,i ) +1 (cid:1) · ( size ( k, i )+ k )! (cid:1) · ( k + size ( k,i )) = children ( k, i )and the number of equivalence classes of ∼ is upper-bounded by 2 ( k + m t ) ≤ ( k + size ( k,i )) , there must exist an equivalence class, denoted A ∼ t ⊆ A t , containingat least (cid:0) (2 ( k +1) + 1) size ( k,i ) + 1 (cid:1) · ( size ( k, i ) + k )! connected components in A t which are pairwise equivalent w.r.t. ∼ . Moreover, this equivalence class can becomputed in time at most size ( k, i )! · children ( k, i ) by simply brute-forcing overall potential renaming functions η between arbitrarily chosen children ( k, i )-many components in A t to construct the set of all equivalence classes of thesecomponents. Let B be an arbitrarily selected component in A ∼ t . First, observethat if G is a YES-instance then so is G − B , as deleting vertices and edges cannotincrease the queue number. On the other hand, assume there is a 1-queue layoutof G − B with linear order ≺ . Our aim for the rest of the proof is to obtain alinear order ≺ (cid:48) of G that extends ≺ and yields a valid 1-queue layout of G . A Refined Equivalence.
Let ≡ ≺ be an equivalence over components in A ∼ t definedas follows. C ≡ ≺ D if and only if the following holds: the linear order ≺ restrictedto P t ∪ η C,D ( C ) is the same as ≺ restricted to P t ∪ C . In other words, ≡ ≺ is arefinement of ∼ restricted to A ∼ t which groups components based on the orderin which their vertices appear (also taking into account which subinterval theyappear in w.r.t. P t ). Note that ≡ ≺ has at most ( m t + k )! ≤ ( size ( k, i ) + k )! arameterized Algorithms for Queue Layouts 7 many equivalence classes, and hence by the virtue of A ∼ t having size at least (cid:0) (2 ( k +1) + 1) size ( k,i ) + 1 (cid:1) · ( size(k,i) + k )!, there must exist an equivalence class U of ≡ ≺ containing at least (2 ( k +1) + 1) size ( k,i ) + 1 components of A ∼ t .We adopt the following terminology for U : we will denote the components in U as C , C , . . . , C u , where u = | U | , we will identify the vertices in a component C i by using the lower index i , and for each such vertex v , say v = v i ∈ C i , use v j to denote its counterpart η C i ,C j ( v i ). Identifying Delimiting Components.
Consider two adjacent vertices v i , w i ∈ C i .We say that component C j is vw - separate from C i if edges v i w i and v j w j neithernest nor cross each other. On the other hand, C j is vw - interleaving (respectively, vw - nesting ) with C i if v i w i and v j w j cross each other (respectively, if one of v i w i and v j w j nests the other). By the definition of ≡ ≺ and U , these three cases areexhaustive. Moreover, if v i w i is an edge then so is v j w j and hence C j cannot be vw -nesting with C i . Our next aim will be to find two components — we will callthem delimiting components — that are not vw -separate for any edge vw . Tothis end, for some two adjacent vertices v i , w i of C i , denote by D the componentwhose counterpart to v i (say v ) is placed leftmost in ≺ among all componentsin U . We now define a sequence of components as follows: D (cid:96) is the uniquecomponent that is (i) vw -separate from D (cid:96) − and whose vertex v (cid:96) is placed(ii) to the right of v (cid:96) − , and (iii) v (cid:96) is placed leftmost among all componentssatisfying properties (i) and (ii). Let d be the maximum integer such that D d exists. Lemma 2 (*). d ≤ k +1 + 1 . Moreover, each component C q in U can be uniquely assigned to one com-ponent D (cid:96) as defined above (w.r.t. the chosen edge vw ) as follows: If C q = D (cid:96) for some (cid:96) , then C q is assigned to itself; otherwise, D (cid:96) is the component whosevertex v (cid:96) is to the left of and simultaneously closest to the corresponding vertex v q in C q among all components D , . . . , D d . Lemma 3 (*).
Let C q and C p be two components assigned to the same compo-nent D (cid:96) w.r.t. the edge vw . Then C q and C p are vw -interleaving. We are now ready to construct our delimiting components. Recall that atthis point, | U | ≥ (2 ( k +1) + 1) size ( k,i ) + 1 while the maximum number of edgesinside a component in U is upper-bounded by m t ≤ size ( k, i ) . Hence by thepigeon-hole principle and by applying the bound provided in Lemma 2 for eachedge inside the components of U , there must exist two components in U , say C x and C y , which for each edge vw are assigned to the same component D vw(cid:96) . ByLemma 3 it now follows that they are vw -interleaving for every edge vw . Using Delimiting Components.
Before we use C x and C y to insert B , we canshow that the way they interleave with each other is “consistent” in ≺ . Lemma 4 (*).
Assume, w.l.o.g., that some vertex v x is to the left of v y . Thenfor each vertex w x it holds that w x is to the left of w y . Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin N¨ollenburg v i,(cid:96) i B L i v i, x v i(cid:96) i x v i v i, y . . . B i v i, B . . . (a) L L L L L L L L L B B B B B B B B B (b) Fig. 3.
Reinsertion of B i : (a) A schematic illustration, and (b) an example where blueand red vertices belong to C x and C y , respectively. We remark that it is not the case that C x must be vw -interleaving with C y if vw is not an edge – this is, in fact, a major complication that we willneed to overcome to complete the proof. W.l.o.g. and recalling Lemma 4, wewill hereinafter assume that every vertex v x ∈ C x is placed to the left of itscounterpart v y ∈ C y . The following definition allows us to partition the verticesof C x into subsequences that should not be interleaved with vertices of B . Definition 2 (Block). A block L = { v x , v x , . . . , v hx } of C x is a maximal set ofvertices of C x such that: (1) there is no vertex v iy (the counterpart in C y of v ix ),with ≤ i ≤ h , between two vertices of L in ≺ ; (2) there are no two vertices of L such that one has a neighbor to its left and one has a neighbor to its right. We observe that, as an immediate consequence of Definition 2, no two verticesof L are adjacent (an edge uv in L would imply that u has a neighbor to its rightand v has a neighbor to its left, or vice versa).For each block L = { v x , v x , . . . , v hx } of C x , there is a corresponding set ofvertices { v B , v B , . . . , v hB } of B , i.e., the set containing the counterparts of L in B . We will obtain a linear order of G by processing the blocks of C x one by oneas encountered in a left-to-right sweep of ≺ , and for each block L , we will extend ≺ by suitably inserting the corresponding vertices of B .Consider the i -th encountered block L i = { v i, x , v i, x , . . . , v i,(cid:96) i x } of C x , refer toFig. 3 for an illustration. Note that, because C x and C y are equivalent compo-nents, it holds v i, y ≺ v i, y · · · ≺ v i,(cid:96) i y (even though such vertices might not beconsecutive). Also, let v i be the first vertex to the left of v i, y in ≺ (possibly v i = v i,(cid:96) i x ). We insert all vertices in the corresponding block B i of B such that: arameterized Algorithms for Queue Layouts 9 v i ≺ v i, B ≺ v i, B ≺ . . . v i,(cid:96) i B ≺ v i, y . After processing the last block of C x , we knowthat all vertices of C x have been considered and hence all vertices of B havebeen reinserted, that is, we extended ≺ to a linear order ≺ (cid:48) of the whole graph G . The next observation immediately follows by the procedure described above. Observation 3
For every vertex v x , it holds that v x ≺ (cid:48) v B ≺ (cid:48) v y . We now establish the correctness of ≺ (cid:48) , completing the proof of Lemma 1. Lemma 5 (*).
The linear order ≺ (cid:48) yields a valid -queue layout of G .Proof (sketch). To prove the statement, we argue that no two edges of G nestin the 1-queue layout defined by ≺ (cid:48) . We recall that ≺ (cid:48) extends ≺ , hence we donot need to argue about pairs of edges in G − B . Moreover, by construction, ≺ (cid:48) restricted to C x is the same as ≺ (cid:48) restricted to B (up to the renaming function η ). Consequently, no two edges having both endpoints in B can nest.We first consider any edge v B w for w ∈ P t and v B ∈ B , and assume v B ≺ (cid:48) w (else the argument is symmetric). Suppose, for a contradiction, that v B w nestsanother edge ab . Recall that since C x and B are equivalent components, if v B is to the left of w , the same holds for v x . By Observation 3, we know v x ≺ (cid:48) v B ≺ (cid:48) w , which implies that ab is nested by v x w as well, a contradiction withthe correctness of ≺ . Similarly, if v B w is nested by an edge ab , then we know v B ≺ (cid:48) v y ≺ (cid:48) w , which implies that ab nests v y w as well, again a contradiction.We now consider any edge v B w B , with v B ≺ (cid:48) w B , and we assume for acontradiction that v B w B nests an edge ab . Since Definition 2 ensures that ablock cannot contain a pair of adjacent vertices, we know that v x and w x belongto different blocks, say L i and L j (with i < j ) respectively. Therefore, we canrename the vertices as v x = v i,i (cid:48) x and w x = v j,j (cid:48) x , and similarly v B = v i,i (cid:48) B and w B = v j,j (cid:48) B ; refer to Fig. 4(a) for an illustration. By Observation 3, it holds v i,i (cid:48) x ≺ (cid:48) v i,i (cid:48) B ≺ (cid:48) v i,i (cid:48) y and v j,j (cid:48) x ≺ (cid:48) v j,j (cid:48) B ≺ (cid:48) v j,j (cid:48) y . Moreover, the correctness of ≺ implies that v i,i (cid:48) B ≺ (cid:48) a ≺ (cid:48) v i,i (cid:48) y (since v i,i (cid:48) y v j,j (cid:48) y cannot nest ab ) and v j,j (cid:48) x ≺ (cid:48) b ≺ (cid:48) v j,j (cid:48) B (since v i,i (cid:48) x v j,j (cid:48) x cannot nest ab ). Because a is between v i,i (cid:48) B and v i,i (cid:48) y , eitherthere exists another vertex v i, y (the counterpart to the first vertex in block L i ,where possibly v i, y = a ) such that v i,i (cid:48) B ≺ (cid:48) v i, y (cid:22) (cid:48) a ≺ (cid:48) v i,i (cid:48) y , or a = v i,i (cid:48) y .Suppose first a (cid:54) = v i, y and a (cid:54) = v i,i (cid:48) y . Observe that v i, x has at least oneneighbor in C x (because C x is connected), and that v j,j (cid:48) x is to the right of v i,i (cid:48) x ,hence, by Definition 2, v i, x also has a neighbor to its right, say v l,j ∗ x . Becauseno two edges nest in ≺ , it must be: (i) v i, x ≺ (cid:48) v i,i (cid:48) x , (ii) v l,j ∗ x ≺ (cid:48) b , and (iii) v l,j ∗ y ≺ (cid:48) b (possibly v l,j ∗ y = b ). Altogether, this implies that v j,j (cid:48) x and v l,j ∗ x arein the same block (i.e., l = j ) and hence v j,j (cid:48) B ≺ (cid:48) v j,j ∗ y ≺ (cid:48) b , which contradicts b ≺ (cid:48) v j,j (cid:48) B . If instead a = v i, y or a = v i,i (cid:48) y , then b is either a vertex of C y or avertex of P t . If b ∈ C y , the argument is similar, as we can set b = v j,j ∗ y andobserve that v j,j (cid:48) B should be to the left of v j,j ∗ y , see Fig. 4(b). If b ∈ P t , we wouldhave v j,j (cid:48) x ≺ (cid:48) b ≺ (cid:48) v j,j (cid:48) y , which contradicts the fact that C x and C y are equivalentcomponents, see Fig. 4(c). (cid:117)(cid:116) v i, x v i,i (cid:48) B v i,i (cid:48) y a b v j,j (cid:48) B v j,j (cid:48) y v j,j ∗ x v i, y v i,i (cid:48) x v j,j (cid:48) x v j,j ∗ y (a) v i,i (cid:48) x v i,i (cid:48) B a = v i,i (cid:48) y b = v j,j ∗ y v j,j (cid:48) B v j,j (cid:48) y v j,j (cid:48) x v j,j ∗ x (b) v i,i (cid:48) x v i,i (cid:48) B a = v i,i (cid:48) y b v j,j (cid:48) B v j,j (cid:48) y v j,j (cid:48) x (c) Fig. 4.
Illustration for the proof of Lemma 5: v i,i (cid:48) B v j,j (cid:48) B nests an edge ab .arameterized Algorithms for Queue Layouts 11 We now turn to the general
Queue Number problem and show that it is fixed-parameter tractable when parameterized by the vertex cover number by proving:
Theorem 2.
Let G be a graph with n vertices and vertex cover number τ = τ ( G ) . A queue layout of G with the minimum number of queues can be computedin O (2 τ O ( τ ) + τ log τ · n ) time. Before describing the algorithm behind Theorem 2, we make an easy observation(which matches an analogous observation in [4]).
Lemma 6.
Every n -vertex graph G = ( V, E ) with a vertex cover C of size τ admits a τ -queue layout. Moreover, if G and C are given as input, such a τ -queue layout can be computed in O ( n + τ · n ) time.Proof. Denote by c , . . . , c τ the τ vertices of C and let ≺ be any linear order of G such that c i ≺ c i +1 , for i = 1 , , . . . , τ −
1. A queue assignment σ of G on h queues can be obtained as follows. Let U = V \ C . For each i ∈ [ τ ] all edges uc i with u ∈ U ∪ { c , . . . , c i − } are assigned to queue i . Now, consider the edgesassigned to any queue i ∈ [ τ ]. By construction, they are all incident to vertex c i ,and thus no two of them nest each other. Therefore, the pair (cid:104)≺ , σ (cid:105) is a τ -queuelayout of G and can be computed in O ( n + τ · n ) time. (cid:117)(cid:116) Let C be a vertex cover of size τ of graph G . For any subset U of C , a vertex v ∈ V \ C is of type U if N ( v ) = U . This defines an equivalence relation on V \ C and in particular partitions V \ C into at most (cid:80) τi =1 (cid:0) τi (cid:1) = 2 τ − < τ distincttypes. Denote by V U the set of vertices of type U . Lemma 7.
Let h ∈ N and v ∈ V U such that | V U | ≥ · h τ + 2 . Then G admitsan h -queue layout if and only if G (cid:48) = G − { v } does. Moreover, an h -queue layoutof G (cid:48) can be extended to an h -queue layout of G in linear time. The proof of Lemma 7 is deferred to Section 4.2.
Proof (of Theorem 2).
By Proposition 3, we can determine the vertex covernumber τ of G and compute a vertex cover C of size τ in time O (2 τ + τ · n ).With Lemma 7 in hand, we can then apply a binary search on the number ofqueues h ≤ τ as follows. If h > τ , by Lemma 6 we can immediately concludethat G admits a τ -queue layout and compute one in O ( n + τ · n ) time. Hencewe shall assume that h ≤ τ . We construct a kernel G ∗ from G of size h O ( τ ) asfollows. We first classify each vertex of G based on its type. We then remove anarbitrary vertex from each set V U with | V U | > · h τ + 1 until | V U | ≤ · h τ + 1.Thus, constructing G ∗ can be done in O (2 τ + τ · n ) time, since 2 τ is the numberof types and τ · n is the maximum number of edges of G . From Lemma 7 weconclude that G admits an h -queue layout if and only if G ∗ does. Given a linear order ≺ ∗ of G ∗ , a queue assignment σ ∗ such that (cid:104)≺ ∗ , σ ∗ (cid:105) is an h -queue layout of G ∗ exists if and only if σ ∗ contains no h -rainbow [20],i.e., h independent edges that pairwise nest, which can be easily checked (andcomputed if it exists) in h O ( τ ) time [20]. Consequently, determining whether G ∗ admits an h -queue layout can be done by first guessing all linear orders, andthen for each of them by testing for the existence of an h -rainbow. Since wehave 2 τ types, and each of the at most 2 · h τ + 1 elements of the same type areequivalent in the queue layout (that is, the position of two elements of the sametype can be exchanged in ≺ ∗ without affecting σ ∗ ), the number of linear orderscan be upper bounded by (2 τ ) O ( h τ ) = 2 τ O ( τ ) . Thus, whether h queues suffice for G ∗ can be determined in 2 τ O ( τ ) · h O ( τ ) = 2 τ O ( τ ) time. An h -queue layout of G ∗ (if any) can be extended to one of G by iteratively applying the constructiveprocedure of Lemma 7, in O ( τ · n ) time. Finally, by applying a binary search on h we obtain an overall time complexity of O (2 τ O ( τ ) + τ log τ · n ), as desired. (cid:117)(cid:116) One direction follows easily, since removing a vertex from an h -queue layout stillgives an h -queue-layout of the resulting graph. So let (cid:104)≺ , σ (cid:105) be an h -queue layoutof G (cid:48) . We prove that an h -queue layout of G can be constructed by inserting v immediately to the right of a suitable vertex u in V U and by assigning the edgesof v to the same queues as the corresponding edges of u .We say that two vertices u , u ∈ V U are queue equivalent , if for each vertex w ∈ U , the edges u w and u w are both assigned to the same queue accordingto σ . Each vertex in V U has degree exactly | U | , hence this relation partitionsthe vertices of V U into at most h | U | ≤ h τ sets. Let V ∗ U = V U \ { v } . Since | V ∗ U | ≥ · h τ +1, at least three vertices of this set, which we denote by u , u , and u , arequeue equivalent. Consider now the graph induced by the edges of these threevertices that are assigned to a particular queue. By the above argument, such agraph is a K l, , for some l >
0. However, K , does not admit a 1-page queuelayout, because any graph with queue number 1 is planar [21]. As a consequence, l ≤
2, that is, each u i ∈ V ∗ U has at most two edges on each queue. Denote suchtwo edges by u i w and u i z and assume, w.l.o.g., that u ≺ u ≺ u and w ≺ z .We now claim that w ≺ u ≺ u ≺ u ≺ z , else two edges would nest. We candistinguish a few cases based on the position of u (recall that u ≺ u ≺ u ),refer to Fig. 5 for an illustration. – Case A: w ≺ z ≺ u , then the nesting edges are zu and wu . – Case B: u ≺ w ≺ z , then we distinguish three more subcases. • Case B.1: u ≺ w , then the nesting edges are u z and u w . • Case B.2: w ≺ u ≺ z , then the nesting edges are u z and wu . • Case B.3: z ≺ u , then the nesting edges are zu and wu . – Case C: w ≺ u ≺ z , if w ≺ u ≺ u ≺ z the claim follows. Else, we havetwo more subcases based again on the position of u . • Case C.1: w ≺ z ≺ u , then the nesting edges are wu and u z . arameterized Algorithms for Queue Layouts 13 w u u u z (a) Case A wu u u z (b) Case B.1 wu u u z (c) Case B.2 wu u u z (d) Case B.3 w u u u z (e) Case C.1 w u u u z (f) Case C.2 Fig. 5.
Illustration for the proof of Lemma 7. • Case C.2: w ≺ u ≺ z ≺ u , then the nesting edges are wu and u z .It follows that we can extend ≺ by introducing v as the first vertex to the rightof u and, for each edge vw such that w ∈ U , we can assign vw to the samequeue as u w . This operation does not introduce any nesting. Namely, if vw isassigned to a queue containing only one edge of u , the graph induced by theedges in this queue is a star with center w and no two edges can nest. If vw isassigned to a queue containing two edges of u , say u w and u z , then we knowthat all vertices of V U are between w and z in ≺ and again no two edges nest. We proved that h - Queue Number is fixed-parameter tractable parameterizedby treedepth for h = 1, and by the vertex cover number for arbitrary h ≥ h ≥ h = 2.2. Extending Theorem 1 to graphs of bounded treewidth is also an interestingproblem; here the main issue is to be able to forget information about verticesin a partial order, thus an approach based on testing arched leveled-planaritymight be more suitable.3. Finally, we mention the possibility of studying the parameterized complexityof mixed linear layouts, using both queues and stacks, see [6, 16, 21, 25]. References
1. Bannister, M.J., Devanny, W.E., Dujmovi´c, V., Eppstein, D., Wood, D.R.: Tracklayouts, layered path decompositions, and leveled planarity. Algorithmica (2018).https://doi.org/10.1007/s00453-018-0487-52. Bekos, M.A., F¨orster, H., Gronemann, M., Mchedlidze, T., Montecchiani,F., Raftopoulou, C.N., Ueckerdt, T.: Planar graphs of bounded degreehave bounded queue number. SIAM J. Comput. (5), 1487–1502 (2019).https://doi.org/10.1137/19M125340X3. Bhatt, S.N., Chung, F.R.K., Leighton, F.T., Rosenberg, A.L.: Scheduling tree-dags using FIFO queues: A control-memory trade-off. J. Parallel Distrib. Comput. (1), 55–68 (1996). https://doi.org/10.1006/jpdc.1996.00244. Bhore, S., Ganian, R., Montecchiani, F., Nllenburg, M.: Parameterized al-gorithms for book embedding problems. J. Graph Algorithms Appl. (2020).https://doi.org/10.7155/jgaa.005265. Chen, J., Kanj, I.A., Xia, G.: Improved upper bounds for vertex cover. Theor. Com-put. Sci. (40-42), 3736–3756 (2010). https://doi.org/10.1016/j.tcs.2010.06.0266. de Col, P., Klute, F., N¨ollenburg, M.: Mixed linear layouts: Complexity, heuris-tics, and experiments. In: Archambault, D., Tth, C.D. (eds.) Graph Drawing andNetwork Visualization (GD’19). LNCS, vol. 11904, pp. 460–467. Springer (2019).https://doi.org/10.1007/978-3-030-35802-0 357. Cygan, M., Fomin, F.V., Kowalik, L., Lokshtanov, D., Marx, D., Pilipczuk,M., Pilipczuk, M., Saurabh, S.: Parameterized Algorithms. Springer (2015).https://doi.org/10.1007/978-3-319-21275-38. Di Battista, G., Frati, F., Pach, J.: On the queue number of planar graphs. SIAMJ. Comput. (6), 2243–2285 (2013). https://doi.org/10.1137/1309080519. Di Giacomo, E., Liotta, G., Meijer, H.: Computing straight-line 3d griddrawings of graphs in linear volume. Comput. Geom. (1), 26–58 (2005).https://doi.org/10.1016/j.comgeo.2004.11.00310. Downey, R.G., Fellows, M.R.: Fundamentals of Parameterized Complexity. Textsin Computer Science, Springer (2013). https://doi.org/10.1007/978-1-4471-5559-111. Dujmovi´c, V.: Graph layouts via layered separators. J. Comb. Theory, Ser. B ,79–89 (2015). https://doi.org/10.1016/j.jctb.2014.07.00512. Dujmovi´c, V., Joret, G., Micek, P., Morin, P., Ueckerdt, T., Wood, D.R.: Pla-nar graphs have bounded queue-number. In: Foundations of Computer Science(FOCS’19). pp. 862–875. IEEE (2019). https://doi.org/10.1109/FOCS.2019.0005613. Dujmovi´c, V., Morin, P., Wood, D.R.: Layout of graphs withbounded tree-width. SIAM J. Comput. (3), 553–579 (2005).https://doi.org/10.1137/S009753970241614114. Dujmovi´c, V., Morin, P., Wood, D.R.: Layered separators in minor-closedgraph classes with applications. J. Comb. Theory, Ser. B , 111–147 (2017).https://doi.org/10.1016/j.jctb.2017.05.00615. Dujmovi´c, V., Wood, D.R.: On linear layouts of graphs. Discrete Math. Theor.Comput. Sci. (2), 339–358 (2004)16. Dujmovi´c, V., Wood, D.R.: Stacks, queues and tracks: Layouts of graph subdivi-sions. Discrete Math. Theor. Comput. Sci. (1), 155–202 (2005)17. Ganian, R., Ordyniak, S.: The complexity landscape of decomposi-tional parameters for ILP. Artificial Intelligence , 61–71 (2018).https://doi.org/10.1016/j.artint.2017.12.006arameterized Algorithms for Queue Layouts 1518. Ganian, R., Peitl, T., Slivovsky, F., Szeider, S.: Fixed-parameter tractability ofdependency QBF with structural parameters. In: Principles of Knowledge Repre-sentation and Reasoning (KR’20) (2020), to appear.19. Gutin, G.Z., Jones, M., Wahlstr¨om, M.: The mixed Chinese postman problemparameterized by pathwidth and treedepth. SIAM J. Discrete Math. (4), 2177–2205 (2016). https://doi.org/10.1137/15M103433720. Heath, L.S., Leighton, F.T., Rosenberg, A.L.: Comparing queues and stacks asmechanisms for laying out graphs. SIAM J. Discrete Math. (3), 398–412 (1992).https://doi.org/10.1137/040503121. Heath, L.S., Rosenberg, A.L.: Laying out graphs using queues. SIAM J. Comput. (5), 927–958 (1992). https://doi.org/10.1137/022105522. Neˇsetˇril, J., Ossona de Mendez, P.: Sparsity – Graphs, Structures, andAlgorithms, Algorithms and combinatorics, vol. 28. Springer (2012).https://doi.org/10.1007/978-3-642-27875-423. Ollmann, T.: On the book thicknesses of various graphs. In: Southeastern Confer-ence on Combinatorics, Graph Theory and Computing. Congressus Numerantium,vol. VIII, p. 459 (1973)24. Pemmaraju, S.V.: Exploring the powers of stacks and queues via graph layouts.Ph.D. thesis, Virginia Tech (1992)25. Pupyrev, S.: Mixed linear layouts of planar graphs. In: Frati, F., Ma, K.L. (eds.)Graph Drawing and Network Visualization (GD’17). LNCS, vol. 10692, pp. 197–209. Springer (2018). https://doi.org/10.1007/978-3-319-73915-1 1726. Reidl, F., Rossmanith, P., Villaamil, F.S., Sikdar, S.: A faster parameterized al-gorithm for treedepth. In: Automata, Languages, and Programming (ICALP’14).LNCS, vol. 8572, pp. 931–942. Springer (2014). https://doi.org/10.1007/978-3-662-43948-7 7727. Tarjan, R.E.: Sorting using networks of queues and stacks. J. ACM (2), 341–346(1972). https://doi.org/10.1145/321694.32170428. Wiechert, V.: On the queue-number of graphs with bounded tree-width. Electr. J.Comb. (1), P1.65 (2017). https://doi.org/10.37236/642929. Yannakakis, M.: Embedding planar graphs in four pages. J. Comput. Syst. Sci. (1), 36–67 (1989). https://doi.org/10.1016/0022-0000(89)90032-96 Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin N¨ollenburg AppendixA Missing Proofs for Section 3
Lemma 2. d ≤ k +1 + 1 .Proof. Consider for a contradiction that there exists a component D (cid:96) such that (cid:96) > k and (cid:96) < d − k , i.e., that there is a sequence of pairwise vw -separatedcomponents to the left as well as to the right of D (cid:96) . By the connectivity of G , there must be a path from v to some vertex in P t , say p . However, by thedefinition of ≡ ≺ every vertex in P t lies either to the left of v or to the rightof w d , and hence a path from v to p would need to pass through a sequence of2 k edges forming disjoint intervals in the linear order ≺ . Since nestings are notallowed, such a path must have at least one vertex inside each of these intervals,and hence its length is at least 2 k , which contradicts Proposition 2. Lemma 3.
Let C q and C p be two components assigned to the same component D (cid:96) w.r.t. the edge vw . Then C q and C p are vw -interleaving.Proof. Assume w.l.o.g. that w (cid:96) is placed to the right of v (cid:96) . Since both C q and C p are assigned to D (cid:96) , the counterparts w q and w p to w (cid:96) must be placed to theright of w (cid:96) while the counterparts v q and v p to v (cid:96) must be placed to the leftof w (cid:96) . Hence C q and C p cannot be vw -separate, and the observation follows byrecalling that C q and C p cannot be vw -nesting either. Lemma 4.
Assume, w.l.o.g., that some vertex v x is to the left of v y . Then foreach vertex w x it holds that w x is to the left of w y .Proof. Consider for a contradiction that there is a vertex w x to the right of w y . Consider a v x - w x path P x in G [ C x ], and let P y be the v y - w y path in G [ C y ]consisting of the counterparts of P x . Let a x b x be the first edge on P x such that a x is placed to the left of a y but b x is placed to the right of b y . Then the edges a x b x and a y b y would be nesting, contradicting the correctness of ≺ . Lemma 5.
The linear order ≺ (cid:48) yields a valid -queue layout of G .Proof (missing part). To conclude the proof of the lemma, we consider any edge v B w B , with v B ≺ (cid:48) w B , and we assume for a contradiction that v B w B is nestedby an edge ab . Again we can rename the vertices as v x = v i,i (cid:48) x and w x = v j,j (cid:48) x ,and similarly v B = v i,i (cid:48) B and w B = v j,j (cid:48) B . By the position of b we can deduceeither that b = v j,j (cid:48) y (possibly j (cid:48) = 1) or that edge v i,i ∗ y v j, y exists. In the lattercase either v i,i ∗ y v j, y is also nested by ab or v i,i (cid:48) B ≺ (cid:48) a , and in both cases weobtain a contradiction; refer to Fig. 6(a) for an illustration. In the former case,we should again distinguish whether a ∈ C y or a ∈ P t . If a ∈ C y , it shouldbe v i,i (cid:48) B ≺ a = v i,i ∗ y , see Fig. 6(b). If a ∈ P t , we would have v i,i (cid:48) x ≺ (cid:48) a ≺ (cid:48) v i,i (cid:48) y ,which again contradicts the fact that C x and C y are equivalent components, seeFig. 6(c). arameterized Algorithms for Queue Layouts 17 v i,i (cid:48) x v i,i (cid:48) B v i,i (cid:48) y a bv j,j (cid:48) B v j,j (cid:48) y v j,j (cid:48) x v j, y v i,i ∗ y (a) v i,i (cid:48) x v i,i (cid:48) B v i,i (cid:48) y a = v i,i ∗ y b = v j,j (cid:48) y v j,j (cid:48) B v j,j (cid:48) x (b) v i,i (cid:48) x v i,i (cid:48) B v i,i (cid:48) y a b = v j,j (cid:48) y v j,j (cid:48) B v j,j (cid:48) x (c) Fig. 6.
Illustration for the proof of Lemma 5: v i,i (cid:48) B v j,j (cid:48) B is nested by an edge abab