Upward Book Embeddings of Partitioned Digraphs
Abstract
In 1999, Heath, Pemmaraju, and Trenk [SIAM J. Comput. 28(4), 1999] extended the classic notion of book embeddings to digraphs, introducing the concept of upward book embeddings, in which the vertices must appear along the spine in a topological order and the edges are partitioned into pages, so that no two edges in the same page cross. For a partitioned digraph , that is, a digraph whose edge set is partitioned into subsets, an upward book embedding is required to assign edges to pages as prescribed by the given partition. In a companion paper, Heath and Pemmaraju [SIAM J. Comput. 28(5), 1999] proved that the problem of testing the existence of an upward book embedding of a partitioned digraph is linear-time solvable for and recently Akitaya, Demaine, Hesterberg, and Liu [GD, 2017] have shown the problem -complete for . In this paper, we study upward book embeddings of partitioned digraphs and focus on the unsolved case . Our first main result is a novel characterization of the upward embeddings that support an upward book embedding in two pages. We exploit this characterization in several ways, and obtain a rich picture of the complexity landscape of the problem. First, we show that the problem remains -complete when , thus closing the complexity gap for the problem. Second, we show that, for an -vertex partitioned digraph with a prescribed planar embedding, the existence of an upward book embedding that respects the given planar embedding can be tested in time. Finally, leveraging the SPQ(R)-tree decomposition of biconnected graphs into triconnected components, we present a cubic-time testing algorithm for biconnected directed partial -trees.
Keywords and phrases:
upward book embeddings, partitioned digraphs, SPQ-trees, -treesCopyright and License:
2012 ACM Subject Classification:
Theory of computation Computational geometry ; Mathematics of computing Graph algorithms ; Theory of computation Design and analysis of algorithmsAcknowledgements:
This research was initiated at the Fourth Summer Workshop on Graph Drawing (SWGD 2024). Thanks to the organizers and the participants for an inspiring atmosphere.Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir NayyeriSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Book embeddings are a classic and influential topic in combinatorial and algorithmic graph theory. The notion of a book as a topological space was introduced in the late 60s by Persinger [48] and Atneosen [5], and later developed in its current and more popular form by the seminal work of Ollmann [47]. In a book embedding of a graph , all vertices lie along a line – referred to as the spine – while edges are placed into distinct half-planes bounded by the spine, known as the pages of the book. Therefore, constructing such an embedding for amounts to computing a pair , where is a linear ordering of the vertices and is a partition of the edges into pages so that no two edges in the same page cross according to , i.e., their end-vertices do not alternate in ; see Fig. 1(a) for an example. The minimum value of for which this is possible is the book thickness of (also called stack number or page number).
Research on book embeddings originated from problems in VLSI circuit design [20], and has since found applications in sorting permutations [49, 52], fault-tolerant processing [50], compact graph encodings [40, 46], graph drawing [14, 25, 29, 33], computational origami [1, 45], parallel process scheduling [13], parallel matrix computations [36], and other domains. For a more comprehensive overview of applications, see [28]. The notion of book embedding was extended to digraphs by Heath, Pemmaraju, and Trenk [37] by introducing the natural requirement that in a book embedding of a digraph the ordering must be a topological ordering of ; see Figs. 1(b) and 1(c) for an example. Such book embeddings are called upward book embeddings as they are naturally depicted with vertices placed on a vertical line and edges drawn as arcs monotonically increasing in the -direction in their page.
Next, we provide an overview of the major algorithmic results on book embeddings; in the full version [21], we also discuss combinatorial results. Concerning undirected graphs, already in 1979, Bernhart and Kainen [10] showed that the graphs of book thickness are the outerplanar graphs and that the graphs of book thickness are the sub-Hamiltonian (planar) graphs. Whereas the former are recognizable in linear time [54], recognizing the latter is -complete, even for planar triangulations [55]. Recently, Ganian et al. [31] presented a sub-exponential-time algorithm for testing sub-Hamiltonicity, which is asymptotically tight under ETH. Concerning digraphs, the problem of testing the existence of an upward book embedding in pages is called Upward Book Embedding. For more than two decades, the only known -completeness result for the problem was the one shown by Heath and Pemmaraju [35] when . Recently, in two subsequent papers, Binucci et al. [16] and Bekos et al. [8, 9] closed the computational gap by showing -completeness for and , respectively. These results, together with the linear-time algorithm for [35], completely characterize the complexity of the Upward Book Embedding problem with respect to . For , efficient algorithms have been devised for special classes [15, 42, 43].
Partitioned book embeddings.
Due to the -hardness of testing the existence of a book embedding , it is natural to study the complexity of the problem if or is given as part of the input. If the vertex ordering is fixed, the problem becomes the -coloring problem for circle graphs. The problem is clearly linear-time solvable for . Unger [53] showed that it is -complete for . The complexity of the case is still open [6, 7], although a quasi-polynomial-time algorithm for has recently been proposed [51]. Conversely, if the partition into pages is given, for undirected graphs, there are polynomial-time algorithms for [35] and [4, 38, 39], whereas the problem is -complete for [3]. For directed graphs, in which the vertex ordering has to be a topological ordering, the problem is called Partitioned Upward Book Embedding. For it coincides with the “unpartitioned” case, solved in [35, 37]. For , it was first studied by Akitaya et al. [1]. They connected the problem to applications in map folding [45] and attributed it to Edmonds, who, in 1997, posed the question specifically for when the edges assigned to each page form a matching. They showed -completeness for and for even if the edges in each page form a matching. For , they gave a linear-time algorithm for the special case when the edges in each page form a matching. However, they left the complexity of the general case for open. See Table 1 for an overview of the complexity landscape.
| vertex order | |||
| fixed | variable | ||
| page assignment | fixed | O(n+m) time |
1 page: O(n) time [35]
2 pages: -complete (Theorem 4) pages: -complete [1] |
| variable |
2 pages: O(n) time
3 pages: OPEN [7] pages: -complete [53] |
2 pages: -complete [9]
pages: -complete [16] |
|
Our Contributions.
We study the Partitioned Upward Book Embedding problem in the unsolved case . As every upward book embedding corresponds to an upward planar drawing, i.e., the edges are drawn as non-crossing -monotone curves, we make use of combinatorial descriptions of such drawings, called upward embeddings [11]. Our first main result is a characterization of the upward embeddings that support an upward book embedding in two pages. We exploit this characterization in several ways and obtain a rich picture of the complexity landscape of the problem. First, we show that the problem remains -complete when , thus closing the complexity gap and exhibiting a sharp contrast with the undirected case, where the problem is linear-time solvable [39]. Our proof also implies that the problem is W[1]-hard with respect to the treewidth. Second, we show that, when the planar embedding is prescribed, the problem can be solved in time. Our algorithm is inspired by the network-flow approach of Bertolazzi et al. [11] and requires the use of several non-trivial ingredients arising from our characterization. Finally, in the variable-embedding setting, we present a cubic-time algorithm for biconnected directed partial -trees. Our algorithm exploits a compact representation, called descriptor pair, of the features of upward embeddings of subgraphs that admit an extension to an upward embedding, satisfying our characterization, of the entire graph. This allows us to compute, for the subgraph associated with each node of the SPQ(R)-tree, its set of realizable descriptor pairs by dynamic programming. While we focus on the decision problem, all our algorithms are constructive and can be modified to compute an upward book embedding, if one exists. A full version of the paper with complete proofs can be found in [21].
2 Preliminaries
Two planar drawings of a connected digraph are topologically equivalent if they have the same clockwise order of the edges around each vertex and the same clockwise order of the edges along the boundary of the outer face. A planar embedding is a class of topologically equivalent planar drawings. A plane digraph is a planar digraph together with a planar embedding. A planar embedding of a digraph is bimodal if, for every vertex , the edges that have their tail at are consecutive in the clockwise order of the edges incident to .
Upward planarity.
A switch in a digraph is a source or a sink. A drawing of is upward if every edge is represented by a Jordan arc that is strictly increasing in the -direction from its tail to its head. If admits an upward planar drawing, it is an upward planar digraph. Let be a bimodal planar embedding of . An angle at a vertex is an ordered pair of edges incident to where immediately follows in clockwise order around . An angle is a switch angle if is the head or the tail of both and , otherwise it is a flat angle. The set of angles of is denoted as . An angle assignment for is a function , and it is upward-consistent if it satisfies the following conditions: (C1) For each angle in , we have if and only if is flat. (C2) For each vertex of , we have , where the sum is over the angles at . (C3) For each face of , we have if is an internal face and if is the outer face, where the sum is over the angles in .
Let be an upward planar drawing with planar embedding , see Fig. 2. Clearly, is bimodal. Also, it defines an angle assignment as follows. Let be an angle of . If is flat, then . Otherwise, consider the geometric angle in corresponding to . We define if and if . Note that is upward-consistent.
A pair of a planar embedding and an angle assignment is an upward embedding if there exists an upward planar drawing with embedding such that . Angles with are flat; also, we say that an angle is large if and small if . An angle assignment is determined by assigning each switch to an incident angle, which corresponds to making that angle large; a switch angle to which no switch is assigned is small. A digraph equipped with an upward embedding is an upward plane digraph.
Upward Book Embeddings.
An -vertex partitioned digraph is a digraph whose edge set is partitioned into sets. An upward book embedding (in pages) of is a bijection such that: (i) for each edge , it holds that , and (ii) for any , no two edges cross, where and cross if or . We focus on the case and let and . We often omit that our upward book embeddings are in two pages and call left and right the edges in and , respectively, since an upward book embedding of determines an upward planar drawing of where the vertices lie along a vertical line, called spine, so that the -coordinate of each vertex is , and each edge in (resp. in ) is drawn as a semi-circle to the left (resp. to the right) of the spine. In all the illustrations, the edges in are blue and solid, while the edges in are red and dashed.
An upward planar drawing respects a planar embedding if it belongs to the equivalence class . An upward book embedding respects a planar embedding if the associated upward planar drawing does and respects an upward embedding if it respects and .
In an upward embedding , a vertex is 4-modal if: (i) If is not a switch, then in clockwise order around in we have all outgoing left edges, all outgoing right edges, all incoming right edges, and all incoming left edges; one of the former two sets and/or one of the latter two sets might be empty. (ii) If is a source (resp. a sink), then in clockwise order around in we have the large angle at , all outgoing left edges, and all outgoing right edges (resp. the large angle at , all incoming right edges, and all incoming left edges); one of the two sets might be empty. Also, is 4-modal if all vertices are 4-modal.
Property 2.
Let be an upward book embedding of a partitioned digraph and let be the upward embedding of defined by . Then is 4-modal.
Partial 2-trees.
A graph is an (undirected) partial -tree if, equivalently, it has treewidth at most two, or it excludes as a minor, or it is a subgraph of a -tree, which is a graph that can be obtained from an edge by repeatedly inserting a degree- vertex adjacent to two adjacent vertices. Notably, the class of partial -trees includes the series-parallel graphs.
Let be a biconnected partial -tree and let be an edge of , see Fig. 3. The SPQ-tree of with respect to is a rooted tree that describes a recursive decomposition of into smaller partial -trees; it is a specialization of the well-known SPQR-tree, which is defined for general biconnected planar graphs [24, 34], and can be computed in linear time.
The root of is a Q-node associated with and with a single child . Define as the pertinent graph of , and let and be the poles of . We proceed recursively. Suppose we are given a quadruple , where is a node of with poles and , and is its pertinent graph (initially, this is ). Three cases can occur:
-
If is a single edge , then is a Q-node representing that edge; is a leaf of .
-
If is not biconnected, then is an S-node. Let be an arbitrary cut-vertex of . Then has two children and in corresponding to the two subgraphs and , respectively, obtained by splitting at . The poles of are and , and those of are and . The construction of recurses on and on .
-
If is biconnected, then is a P-node. Then has children , where is the number of subgraphs obtained by splitting at and . For , the poles of are and , and the construction of recurses on .
A directed partial -tree is a digraph whose underlying graph is a partial -tree, where the underlying graph is the undirected graph obtained by ignoring the edge directions. An SPQ-tree of a biconnected directed partial -tree is an SPQ-tree of its underlying graph, although the edges of the pertinent graph of each node are oriented as in .
3 Characterization for Upward Embeddings
In this section we characterize the upward embeddings of a partitioned upward plane digraph that allow for the construction of an upward book embedding.
For a face of , let (resp. ) be the set of maximal directed paths in the boundary of that consist of edges with to their right (resp. to their left). The face is impossible if it satisfies one of the following two conditions (see Fig. 4(a)):
-
(i)
contains a path with the following properties: a) consists of edges in ; b) the rest of the boundary of is not a single edge; and c) let and be the edges of incident to the extremes and of , respectively; then the angle in incident to and to the right of and the angle in incident to and to the right of are small.
-
(ii)
contains a path with the following properties: a) consists of edges in ; b) the rest of the boundary of is not a single edge; and c) let and be the edges of incident to the extremes and of , respectively; then the angle in incident to and to the left of and the angle in incident to and to the left of are small.
A good embedding is an upward embedding that is 4-modal and that is such that no face of is impossible. We now prove our characterization.
Theorem 3.
Let be a partitioned upward plane digraph with upward embedding . Then admits an upward book embedding respecting if and only if is good.
Sketch.
We sketch the proof for the case where is connected; the general case is discussed in the full version. For the necessity, let be an upward book embedding of respecting . Then is 4-modal by Property 2. Suppose, for a contradiction, that a face of is impossible. W.l.o.g., assume that contains a path satisfying condition (i) and let be defined as above. Let further and be the vertices adjacent to and , respectively, such that the edge follows in clockwise order around and the edge follows in counter-clockwise order around . Since is upward planar, the order of the vertices of along the spine is the same as their order in , with below ; also, lies above and below . If or lies in the strip delimited by the horizontal lines through and , then or would cross an edge of the path , because the small angles in force the edges and to be to the right of and , respectively. However, no point of the spine lies to the right of and in the strip . It follows that has to lie above and below . This, however, implies that the edges and cross each other, given that they are both drawn to the right of the spine. This proves the necessity.
For the sufficiency, we build on a procedure by Bertolazzi et al. [12], who showed that any upward plane digraph can be augmented to a plane -graph by adding edges, while maintaining the upward embedding. A plane -graph is an upward plane digraph with one source and one sink that are incident to the outer face. The boundary of each face of consists of two directed paths and , called left and right path, respectively. In the full version, we extend the technique of Bertolazzi et al. and show that, by suitably adding paths and carefully assigning their edges to and , we can augment a good embedding of the given partitioned upward plane digraph to a good embedding of a partitioned plane -graph. For this reason, we now assume that is a partitioned plane -graph. In this case, a face is impossible if only consists of edges in and is not a single edge, or if only consists of edges in and is not a single edge; see Fig. 4(b).
To show that a partitioned plane -graph with a good embedding admits an upward book embedding , we use the fact that it can be constructed starting from the left path of the outer face by repeatedly adding the right path of an internal face whose left path already belongs to the graph, see, e.g., [2, 23, 30, 44]. We start by drawing in the edges of as semi-circles in their assigned side of the spine. When we draw the right path of a face whose left path already belongs to the subgraph of drawn in , we distinguish two cases. First, if is a single edge , then, since is simple, contains an internal vertex. Since is not impossible, . Then we just draw as a semi-circle to the right of the spine.
Second, if is not a single edge, as in Fig. 5, then contains a left edge , since is not impossible. If both the first and the last edge of are in , we place all the internal vertices of on the spine between and in the order in which they appear along and draw the edges of as semi-circles in their assigned side of the spine; see Fig. 5(a). Otherwise, if the first edge of is in and its last edge is in , then also the first edge of is in due to the 4-modality of . We can then choose as the first edge of and proceed as discussed in the previous case; see Fig. 5(b). The case where the first edge of is in and its last edge is in is analogous. Finally, if both the first and the last edge of are in , then so are the first edge and the last edge of , by the 4-modality of . If is a single edge, then it plays the role of and we place the internal vertices of and draw its edges as above. Otherwise, since is not impossible, contains an edge . We embed the internal vertices of the subpath of from its start to , including , between and in the order as they appear along , and we embed the internal vertices of the subpath of from to its end, including , between and in the order as they appear along , and draw the edges of as semi-circles in their assigned side of the spine; see Fig. 5(c).
4 Computational Complexity with Variable Embedding
In this section we study the complexity of testing whether a partitioned digraph admits an upward book embedding in two pages. We show that the problem is -complete by exploiting Theorem 3 and the -hardness of Upward Planarity Testing.
Theorem 4.
It is -complete to decide whether a partitioned planar digraph admits an upward book embedding.
Proof.
Clearly, the problem is in . In order to prove -hardness, we give a reduction from Upward Planarity Testing, which was proved to be -hard by Garg and Tamassia [32]. Given a planar digraph , we construct a partitioned digraph as follows. Subdivide each edge with a new vertex ; these subdivision vertices, together with the vertices in , form . The edge set consists of the edges outgoing from vertices in (and incoming into vertices in ), and the edge set consists of the remaining edges. Clearly, can be constructed from in polynomial time. It remains to show that admits an upward book embedding if and only if admits an upward planar drawing.
For the necessity, observe that an upward book embedding of is an upward planar drawing of . Then an upward planar drawing of is obtained from by (i) placing each vertex of in as in and by (ii) drawing in each edge of as the Jordan arc formed by the union of the drawings of and of in .
For the sufficiency, suppose that admits an upward planar drawing . An upward planar drawing of can be constructed from by placing each subdivision vertex at any internal point of the Jordan arc representing the edge . Let be the upward embedding corresponding to . We prove that is 4-modal. Consider any vertex of . If , then has one incoming and one outgoing edge in , hence it is trivially 4-modal. If then, by construction, all the edges outgoing from (incoming into ), if any, are in (resp. are in ) and are consecutive in the clockwise order of the edges incident to , due to the bimodality of . It follows that is 4-modal. Finally, has no impossible face, since by construction any maximal directed path in the boundary of any face contains both an edge in and an edge in . Hence, is a good embedding. By Theorem 3, we have that admits an upward book embedding respecting .
Upward Planarity Testing is known to be W[1]-hard with respect to the treewidth [41]. Also, the reduction shown in Theorem 4 constructs a graph which is a subdivision of the original instance of Upward Planarity Testing. Since any two graphs, one of which is a subdivision of the other one, have the same treewidth, we get the following.
Corollary 5.
It is W[1]-hard with respect to the treewidth to decide whether a partitioned digraph admits an upward book embedding.
Furthermore, by subdividing the edges twice, rather than once, so that the edges incident to vertices in are in and the other edges in , the reduction gives an instance where one edge part induces a matching and the other one a forest of stars. This is in sharp contrast with the fact that the problem is linear-time solvable when both edge parts are matchings [1].
5 Test for Graphs with a Fixed Planar Embedding
In this section we show how to exploit the characterization of Theorem 3 in order to prove that, for an -vertex partitioned plane digraph with a given planar embedding , it can be tested in time whether admits an upward book embedding respecting . We assume that is connected and refer to the full version for the case in which it is not.
We review a tool for testing whether admits an upward planar drawing respecting . By Theorem 1, the bimodality of is necessary for the existence of and can be tested in time. Thus, the existence of corresponds to the existence of an upward-consistent angle assignment for , which can be decided by the following strategy of Bertolazzi et al. [11]. Starting from the plane digraph with planar embedding , one can construct a planar flow network , as illustrated in Fig. 6, where:
-
for each switch of , the network contains a source supplying a single unit of flow;
-
for each face of , the network contains a sink that demands a number of units of flow equal to or , depending on whether is an internal face or the outer face of , respectively (where is the number of switch angles incident to );
-
for each angle in at a switch of , the network contains a node ; and
-
the network contains an arc from each source to each node such that the angle is incident to in and an arc from each node to each sink such that the angle is incident to in ; all such arcs have a capacity of a single unit of flow.
By [11], there exists an upward-consistent angle assignment for if and only if admits a feasible flow whose value is the sum of the demands of the sinks in . Indeed, upward-consistent angle assignments and (integral) feasible flows with value are in bijection. Namely, from an upward-consistent angle assignment , one gets a feasible flow for with value by assigning flow only to arcs incident to a node where is assigned a large angle by , and from a feasible flow for with value , one gets an upward-consistent angle assignment by assigning a large angle to each switch angle such that the arcs incident to node are assigned one unit of flow, and a small angle to all other switch angles. Testing whether admits an upward planar drawing respecting then becomes equivalent to testing whether admits a flow whose value is , which can be done in time [17].
Our idea is to modify so that there is an upward-consistent angle assignment for such that is a good embedding if and only if has a feasible flow whose value is . The correspondence is actually stronger: As we show in the full version, the integral feasible flows with value for the modified network are in bijection with the upward-consistent angle assignments for such that is a good embedding. We show an algorithm, called -modifier, that performs a sequence of modifications to . Along the way, -modifier might stop and conclude that has no upward book embedding respecting .
The -modifier algorithm. We start by describing the modifications to to ensure 4-modality. Consider any vertex of . If is not a switch, then its 4-modality does not depend on the angle assignment, thus we check whether in , in clockwise order around , we have outgoing left edges, outgoing right edges, incoming right edges, and incoming left edges. If the test is negative, then admits no upward book embedding respecting . If is a switch, say a source, then we check whether in the outgoing left edges are consecutive. If the test is negative, then admits no upward book embedding respecting . If the test is positive and has no outgoing left edges or no outgoing right edges, the processing of is concluded. If the test is positive and has both outgoing left and outgoing right edges, we modify as follows; see Fig. 7. Let be the left edge outgoing from such that the edge preceding in clockwise order around is a right edge, let be the angle . For each angle incident to in , the algorithm -modifier removes and its incident arcs from . This forces the arc to be assigned one unit of flow, hence making large.
We next describe the modifications -modifier applies to in order to ensure the absence of impossible faces. Consider any face of and any maximal directed path in the boundary of with to its right (the treatment of the maximal directed paths with to their left is analogous). If contains a left edge or if the rest of the boundary of is a single edge, then the processing of is concluded. Otherwise, let and be the extremes of , let and be the edges of incident to and , let be the angle in incident to and to the right of , and let be the angle in incident to and to the right of . By Theorem 3, at least one of the angles and has to be large. By the maximality of , both and are switch angles. We say that (resp. ) is enlargeable if the node (resp. the node ) is in . Note that, even if (resp. ) is a switch of , (resp. ) might not be in , because of some previous modification of . We distinguish three cases.
-
If neither nor is enlargeable, then admits no upward book embedding respecting .
-
If just one of and , say , is enlargeable, we modify as follows: For each angle incident to in , we remove and its incident arcs from , thus forcing the arc to be assigned one unit of flow and making large.
-
Finally, suppose that both and are enlargeable, as in Fig. 8. If there exists no angle incident to whose corresponding node is in , or no angle incident to whose corresponding node is in , then the processing of is concluded, since it is already guaranteed that one of and will be a large angle. Otherwise, we add to a sink with demand , as well as arcs and with capacity , and decrease by the demand of . This forces one of and (and consequently one of and ) to be assigned one unit of flow, hence making large or , respectively. Note that remains a planar flow network.
The described algorithm is the main ingredient for the proof of the following theorem.
Theorem 6.
Let be an -vertex partitioned plane digraph with planar embedding . It is possible to test in time whether admits an upward book embedding respecting .
Sketch.
In the full version, we prove the mentioned bijection between the feasible flows with value of the network constructed by -modifier and the upward-consistent angle assignments such that is a good embedding. Then Theorem 3 implies that has an upward book embedding respecting if and only if -modifier did not conclude the opposite and has a feasible flow with value . Since -modifier can be easily implemented to run in time and the algorithm by Borradaile et al. [17] to test whether has a feasible flow with value runs in time, the theorem follows.
6 Test for Biconnected Partitioned Directed Partial -Trees
In this section we show how to test whether an -vertex biconnected partitioned directed partial -tree admits an upward book embedding in two pages. We leverage tools introduced in [18, 19] to efficiently test whether a directed partial -tree is upward planar. Note that, lacking a characterization such as the one in Theorem 3, it would be prohibitive to lift such tools to work for our problem. Let be an edge of . We test in time whether admits a good embedding with on the outer face. Repeating this test for all choices of yields an -time algorithm to decide whether admits a good embedding. By Theorem 3, this is equivalent to testing whether admits an upward book embedding.
Let be an SPQ-tree of , rooted at the Q-node corresponding to . Let be a node of with poles and and with pertinent graph . A -external good embedding of is a good embedding of in which and are incident to the outer face. The requirement that is incident to the outer face of any upward embedding of implies that the restriction of to is indeed a -external good embedding of .
A -external good embedding of can be succinctly represented by a descriptor pair, which consists of a shape descriptor and of a pbe descriptor (short for partitioned book embedding descriptor) , with the following meaning. Let the left outer path (resp. the right outer path ) be the path obtained by traversing the boundary of the outer face of from to in clockwise (resp. counterclockwise) direction. The label () is the sum of the labels assigned by to the angles in at the vertices of (resp. ), excluding and . The values and are the labels of the angles at and in , respectively. The label is in or out depending on whether the edge of incident to is incoming or outgoing at , respectively; the values , , and are defined analogously. The label is or depending on whether the edge of incident to belongs to or , respectively; the values , , and are defined analogously. The label is 1 if is a directed path from to and all its edges belong to or if is a directed path from to and all its edges belong to , it is 0 otherwise. The label is defined analogously for . The label is 1 if contains a directed path from to a vertex whose edges belong to or a directed path from a vertex to whose edges belong to and if assigns a small angle at in ; the label is 0 otherwise. The labels , , and are defined analogously, with respect to rather than and/or with respect to rather than .
The information in a descriptor pair fully describes how a -external good embedding of interfaces with the rest of for the construction of a good embedding of with on the outer face. That is, for a good embedding of with on the outer face, let be the -external good embedding of in , and let be the descriptor pair of . Replacing with any other -external good embedding of with descriptor pair still results in a good embedding of with on the outer face. Even more, for a -external good embedding of with descriptor pair , let be a child of with poles and , and let be the descriptor pair of the -external good embedding of in . Replacing with any other -external good embedding of with descriptor pair results in a -external good embedding of with descriptor pair . This allows us to only keep track of the descriptor pairs that are “realizable” by , rather than of the actual -external good embeddings of . This is formalized by the notion of feasible set for , which contains all the descriptor pairs such that admits a -external good embedding with descriptor pair .
The core of our algorithm consists of a bottom-up computation of the feasible set for each node of . If is a non-root Q-node, then has a unique -external good embedding, hence contains a unique descriptor pair and is computed in time.
If is an S-node, let and be the children of in and let be the unique vertex shared by and . We combine every descriptor pair in with every descriptor pair in ; for every such combination, we assign the two angles at in the outer face with every possible label in . We test in time whenever the combination and the assignment result in a descriptor pair of a good embedding of , by checking whether the properties of Theorems 1 and 3 are satisfied. In the positive case, we add to . Thus, the computation of takes time , which is in . This sums up to time over all S-nodes of .
If is a P-node with children , we cannot just combine the descriptor pairs in , as the number of combinations might be super-polynomial. Instead, we consider every descriptor pair that might describe a -external good embedding of and test whether it is in . This is done as follows. A set of descriptor pairs is -universal if: (i) for every -vertex biconnected partitioned directed partial -tree with , for every two vertices and of , and for every -external good embedding of , the descriptor pair of is in , and (ii) for every descriptor pair in , there exists a biconnected partitioned directed partial -tree that contains two vertices and and admits a -external good embedding with descriptor pair . Note that . We can construct an -universal set with in time.
Consider a -external good embedding of with descriptor pair . Assume, w.l.o.g. up to a change of the indices, that the clockwise order around in of the pertinent graphs of the children of starting at the outer face is . The descriptor sequence of is the sequence of the descriptor pairs of the -external good embeddings of in . The contracted descriptor sequence of is obtained from by identifying equal consecutive descriptor pairs, see Fig. 9. Finally, the generating set for is the set of contracted descriptor sequences that a P-node with poles and can have in a -external good embedding with descriptor pair . We can prove that has size , can be constructed in time, and that each contracted descriptor sequence in has length .
In order to compute , we construct the generating set of , for each descriptor pair in , in overall time. For each contracted descriptor sequence in , we test whether is realizable by , i.e., whether there exists a -external good embedding of whose contracted descriptor sequence is a subsequence of containing the first and last elements of , which ensures that belongs to . We decide whether is realizable by in time, by constructing an auxiliary graph with vertex set and with an edge between and if belongs to , and by then testing whether each vertex in can be assigned to a neighbor, so that both and are assigned at least one vertex. We add to if some in is realizable by . Since , , and the realizability of a contracted descriptor sequence can be decided in time, the computation of takes time, which sums up to time over all P-nodes of .
Finally, if is the root Q-node , we treat it as a P-node with two children, corresponding to and , and compute in time. Then has a good embedding with on the outer face if and only if is non-empty. We thus get the following.
Theorem 7.
Let be an -vertex biconnected partitioned directed partial -tree. It is possible to test in time whether admits an upward book embedding.
7 Conclusions
We studied upward book embeddings of partitioned digraphs, focusing on the unsolved case of two pages – one of the final open algorithmic book-embedding problems. We closed the complexity gap for the problem by proving its -hardness. We provided a characterization of the upward embeddings that admit such layouts and combined this with several algorithmic tools, including flow techniques, SPQ-decompositions, and compact embedding representations, obtaining efficient testing and embedding algorithms for digraphs with a fixed planar embedding and for biconnected partial 2-trees with variable embedding. We aim to (i) remove the linear overhead in our algorithm for biconnected partial 2-trees caused by rerouting the SPQ-tree at each Q-node, and (ii) extend the method to arbitrary simply connected partial 2-trees. The latter is challenging due to nested biconnected components in the block-cut-vertex tree, which must be arranged while keeping cut vertices 4-modal and avoiding impossible faces. Additional research directions include:
-
studying the complexity of the problem for partitioned digraphs with few sources;
-
determining whether the problem is -complete for bounded-treewidth instances; and
-
developing FPT algorithms for parameters more restrictive than treewidth.
References
- [1] Hugo A. Akitaya, Erik D. Demaine, Adam Hesterberg, and Quanquan C. Liu. Upward partitioned book embeddings. In Fabrizio Frati and Kwan-Liu Ma, editors, 25th International Symposium on Graph Drawing and Network Visualization (GD’17), volume 10692 of LNCS, pages 210–223. Springer, 2017. doi:10.1007/978-3-319-73915-1_18.
- [2] Patrizio Angelini, Giordano Da Lozzo, Giuseppe Di Battista, and Fabrizio Frati. Strip planarity testing for embedded planar graphs. Algorithmica, 77(4):1022–1059, 2017. doi:10.1007/S00453-016-0128-9.
- [3] Patrizio Angelini, Giordano Da Lozzo, and Daniel Neuwirth. Advancements on SEFE and partitioned book embedding problems. Theor. Comput. Sci., 575:71–89, 2015. doi:10.1016/j.tcs.2014.11.016.
- [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, 20th International Symposium on Graph Drawing (GD’12), volume 7704 of LNCS, pages 79–89. Springer, 2012. doi:10.1007/978-3-642-36763-2_8.
- [5] Gail H. Atneosen. One-dimensional -leaved continua. Fund. Math., 74(1):43–45, 1972. doi:10.4064/fm-74-1-43-45.
- [6] Patricia Bachmann, Ignaz Rutter, and Peter Stumpf. On 3-coloring circle graphs. In Michael A. Bekos and Markus Chimani, editors, 31st International Symposium on Graph Drawing and Network Visualization, (GD’23), volume 14465 of LNCS, pages 152–160. Springer, 2023. doi:10.1007/978-3-031-49272-3_11.
- [7] Patricia Bachmann, Ignaz Rutter, and Peter Stumpf. On 3-coloring circle graphs. J. Graph Algorithms Appl., 28(1):389–402, 2024. doi:10.7155/jgaa.v28i1.2991.
- [8] Michael A. Bekos, Giordano Da Lozzo, Fabrizio Frati, Martin Gronemann, Tamara Mchedlidze, and Chrysanthi N. Raftopoulou. Recognizing DAGs with page-number 2 is NP-complete. In Patrizio Angelini and Reinhard von Hanxleden, editors, 30th International Symposium on Graph Drawing and Network Visualization (GD’22), volume 13764 of LNCS, pages 361–370. Springer, 2022. doi:10.1007/978-3-031-22203-0_26.
- [9] Michael A. Bekos, Giordano Da Lozzo, Fabrizio Frati, Martin Gronemann, Tamara Mchedlidze, and Chrysanthi N. Raftopoulou. Recognizing DAGs with page-number 2 is NP-complete. Theor. Comput. Sci., 946:113689, 2023. doi:10.1016/J.TCS.2023.113689.
- [10] 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.
- [11] Paola Bertolazzi, Giuseppe Di Battista, Giuseppe Liotta, and Carlo Mannino. Upward drawings of triconnected digraphs. Algorithmica, 12(6):476–497, 1994. doi:10.1007/BF01188716.
- [12] Paola Bertolazzi, Giuseppe Di Battista, Carlo Mannino, and Roberto Tamassia. Optimal upward planarity testing of single-source digraphs. SIAM J. Comput., 27(1):132–169, 1998. doi:10.1137/S0097539794279626.
- [13] Sandeep N. Bhatt, Fan R.K. Chung, F.Thomas Leighton, and Arnold L. Rosenberg. Scheduling tree-dags using FIFO queues: A control–memory trade-off. Journal of Parallel and Distributed Computing, 33(1):55–68, 1996. doi:10.1006/jpdc.1996.0024.
- [14] T. Biedl, T. Shermer, S. Whitesides, and S. Wismath. Bounds for orthogonal 3-D graph drawing. Journal of Graph Algorithms and Applications, 3(4):63–79, January 1999. doi:10.7155/jgaa.00018.
- [15] Carla Binucci, Giordano Da Lozzo, Emilio Di Giacomo, Walter Didimo, Tamara Mchedlidze, and Maurizio Patrignani. Upward book embeddings of st-graphs. In Gill Barequet and Yusu Wang, editors, 35th International Symposium on Computational Geometry (SOCG’19), volume 129 of LIPIcs, pages 13:1–13:22. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.SoCG.2019.13.
- [16] Carla Binucci, Giordano Da Lozzo, Emilio Di Giacomo, Walter Didimo, Tamara Mchedlidze, and Maurizio Patrignani. Upward book embeddability of st-graphs: Complexity and algorithms. Algorithmica, 85(12):3521–3571, 2023. doi:10.1007/s00453-023-01142-y.
- [17] Glencora Borradaile, Philip N. Klein, Shay Mozes, Yahav Nussbaum, and Christian Wulff-Nilsen. Multiple-source multiple-sink maximum flow in directed planar graphs in near-linear time. SIAM J. Comput., 46(4):1280–1303, 2017. doi:10.1137/15M1042929.
- [18] Steven Chaplick, Emilio Di Giacomo, Fabrizio Frati, Robert Ganian, Chrysanthi N. Raftopoulou, and Kirill Simonov. Parameterized algorithms for upward planarity. In Xavier Goaoc and Michael Kerber, editors, 38th International Symposium on Computational Geometry (SOCG’22), volume 224 of LIPIcs, pages 26:1–26:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.SOCG.2022.26.
- [19] Steven Chaplick, Emilio Di Giacomo, Fabrizio Frati, Robert Ganian, Chrysanthi N. Raftopoulou, and Kirill Simonov. Testing upward planarity of partial 2-trees. In Patrizio Angelini and Reinhard von Hanxleden, editors, 30th International Symposium on Graph Drawing and Network Visualization (GD’22), volume 13764 of LNCS, pages 175–187. Springer, 2022. doi:10.1007/978-3-031-22203-0_13.
- [20] Fan R. K. Chung, Frank Thomson Leighton, and Arnold L. Rosenberg. Embedding graphs in books: A layout problem with applications to VLSI design. SIAM Journal on Algebraic Discrete Methods, 8(1):33–58, 1987. doi:10.1137/0608002.
- [21] Giordano Da Lozzo, Fabrizio Frati, and Ignaz Rutter. Upward book embeddings of partitioned digraphs, 2026. URL: https://arxiv.org/abs/2603.17128.
- [22] Giuseppe Di Battista, Peter Eades, Roberto Tamassia, and Ioannis G. Tollis. Graph Drawing: Algorithms for the Visualization of Graphs. Prentice-Hall, 1999.
- [23] Giuseppe Di Battista and Roberto Tamassia. Algorithms for plane representations of acyclic digraphs. Theor. Comput. Sci., 61:175–198, 1988. doi:10.1016/0304-3975(88)90123-5.
- [24] Giuseppe Di Battista and Roberto Tamassia. On-line planarity testing. SIAM J. Comput., 25(5):956–997, 1996. doi:10.1137/S0097539794280736.
- [25] Emilio Di Giacomo, Walter Didimo, Giuseppe Liotta, and Stephen K. Wismath. Book embeddability of series-parallel digraphs. Algorithmica, 45(4):531–547, 2006. doi:10.1007/s00453-005-1185-7.
- [26] Walter Didimo, Francesco Giordano, and Giuseppe Liotta. Upward spirality and upward planarity testing. SIAM J. Discret. Math., 23(4):1842–1899, 2009. doi:10.1137/070696854.
- [27] Reinhard Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. Springer, 2012.
- [28] Vida Dujmović and David R. Wood. On linear layouts of graphs. Discret. Math. Theor. Comput. Sci., 6(2):339–358, 2004. doi:10.46298/dmtcs.317.
- [29] Hazel Everett, Sylvain Lazard, Giuseppe Liotta, and Stephen Wismath. Universal sets of points for one-bend drawings of planar graphs with vertices. Discret. Comput. Geom., 43(2):272–288, 2010. doi:10.1007/s00454-009-9149-3.
- [30] Fabrizio Frati, Joachim Gudmundsson, and Emo Welzl. On the number of upward planar orientations of maximal planar graphs. Theor. Comput. Sci., 544:32–59, 2014. doi:10.1016/J.TCS.2014.04.024.
- [31] 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, 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.
- [32] Ashim Garg and Roberto Tamassia. On the computational complexity of upward and rectilinear planarity testing. SIAM J. Comput., 31(2):601–625, 2001. doi:10.1137/S0097539794277123.
- [33] F. Giordano, G. Liotta, T. Mchedlidze, A. Symvonis, and S.H. Whitesides. Computing upward topological book embeddings of upward planar digraphs. Journal of Discrete Algorithms, 30:45–69, 2015. doi:10.1016/j.jda.2014.11.006.
- [34] Carsten Gutwenger and Petra Mutzel. A linear time implementation of SPQR-trees. In Joe Marks, editor, 8th International Symposium on Graph Drawing (GD’00), volume 1984 of LNCS, pages 77–90. Springer, 2000. doi:10.1007/3-540-44541-2_8.
- [35] Lenwood S. Heath and Sriram V. Pemmaraju. Stack and queue layouts of directed acyclic graphs: Part II. SIAM J. Comput., 28(5):1588–1626, 1999. doi:10.1137/S0097539795291550.
- [36] Lenwood S Heath, Sriram V Pemmaraju, and Calvin J Ribbens. Sparse matrix-vector multiplication on a small linear array. University of Iowa, Department of Computer Science, 1993.
- [37] Lenwood S. Heath, Sriram V. Pemmaraju, and Ann N. Trenk. Stack and queue layouts of directed acyclic graphs: Part I. SIAM J. Comput., 28(4):1510–1539, 1999. doi:10.1137/S0097539795280287.
- [38] Seok-Hee Hong and Hiroshi Nagamochi. Two-page book embedding and clustered graph planarity. Technical report, Dept. of Applied Mathematics and Physics, University of Kyoto, Japan, 2009.
- [39] Seok-Hee Hong and Hiroshi Nagamochi. Simpler algorithms for testing two-page book embedding of partitioned graphs. Theor. Comput. Sci., 725:79–98, 2018. doi:10.1016/J.TCS.2015.12.039.
- [40] G. Jacobson. Space-efficient static trees and graphs. In 30th Annual Symposium on Foundations of Computer Science (FOCS ’89), pages 549–554. IEEE Computer Society, 1989. doi:10.1109/SFCS.1989.63533.
- [41] Bart M. P. Jansen, Liana Khazaliya, Philipp Kindermann, Giuseppe Liotta, Fabrizio Montecchiani, and Kirill Simonov. Upward and orthogonal planarity are W[1]-hard parameterized by treewidth. In Michael A. Bekos and Markus Chimani, editors, 31st International Symposium on Graph Drawing and Network Visualization (GD’23), volume 14466 of LNCS, pages 203–217. Springer, 2023. doi:10.1007/978-3-031-49275-4_14.
- [42] Tamara Mchedlidze and Antonios Symvonis. Crossing-free acyclic Hamiltonian path completion for planar -digraphs. In Yingfei Dong, Ding-Zhu Du, and Oscar H. Ibarra, editors, 20th International Symposium on Algorithms and Computation (ISAAC’09), volume 5878 of LNCS, pages 882–891. Springer, 2009. doi:10.1007/978-3-642-10631-6_89.
- [43] Tamara Mchedlidze and Antonios Symvonis. Crossing-optimal acyclic HP-completion for outerplanar -digraphs. J. Graph Algorithms Appl., 15(3):373–415, 2011. doi:10.7155/jgaa.00231.
- [44] Kurt Mehlhorn. Data Structures and Algorithms: Multi-dimensional Searching and Computational Geometry, volume 3 of EATCS Monographs on Theoretical Computer Science. Springer, 1984. doi:10.1007/978-3-642-69900-9.
- [45] T. D. Morgan. Map folding. PhD thesis, Massachusetts Institute of Technology, 2012. Ph.D. thesis. URL: https://hdl.handle.net/1721.1/77030.
- [46] J. Ian Munro and Venkatesh Raman. Succinct representation of balanced parentheses and static trees. SIAM J. Comput., 31(3):762–776, 2001. doi:10.1137/S0097539799364092.
- [47] T. Ollmann. On the book thicknesses of various graphs. In F. Hoffman, R.B. Levow, and R.S.D. Thomas, editors, Southeastern Conference on Combinatorics, Graph Theory and Computing, volume VIII of Congressus Numerantium, page 459, 1973.
- [48] C. A. Persinger. Subsets of -books in . Pacific J. Math., 18:169–173, 1966. URL: http://projecteuclid.org/euclid.pjm/1102994417.
- [49] Vaughan R. Pratt. Computing permutations with double-ended queues, parallel stacks and parallel queues. In 5th Symposium on Theory of Computing (STOC’73), pages 268–277. ACM, 1973. doi:10.1145/800125.804058.
- [50] Arnold L. Rosenberg. The diogenes approach to testable fault-tolerant arrays of processors. IEEE Trans. Computers, 32(10):902–910, 1983. doi:10.1109/TC.1983.1676134.
- [51] 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, 9th Symposium on Simplicity in Algorithms (SOSA’26), pages 65–80. SIAM, 2026. doi:10.1137/1.9781611978964.6.
- [52] Robert Tarjan. Sorting using networks of queues and stacks. J. ACM, 19(2):341–346, April 1972. doi:10.1145/321694.321704.
- [53] Walter Unger. On the k-colouring of circle-graphs. In Robert Cori and Martin Wirsing, editors, 5th Annual Symposium on Theoretical Aspects of Computer Science (STACS ’88), volume 294 of LNCS, pages 61–72. Springer, 1988. doi:10.1007/BFb0035832.
- [54] Manfred Wiegers. Recognizing outerplanar graphs in linear time. In Gottfried Tinhofer and Gunther Schmidt, editors, 13th International Workshop on Graph-Theoretic Concepts in Computer Science (WG’87), pages 165–176. Springer, 1987. doi:10.1007/3-540-17218-1_57.
- [55] Avi Wigderson. The complexity of the Hamiltonian circuit problem for maximal planar graphs. Technical Report TR-298, EECS Department, Princeton University, 1982. URL: https://www.math.ias.edu/avi/node/820.
