Upward Book Embeddings of Partitioned Digraphs
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…
Authors: Giordano Da Lozzo, Fabrizio Frati, Ignaz Rutter
Up w a rd Bo ok Emb eddings of P a rtitioned Digraphs Giordano Da Lozzo # ICIT A Departmen t, Roma T re Univ ersit y , Italy F abrizio F rati # ICIT A Departmen t, Roma T re Univ ersit y , Italy Ignaz R utter # F acult y of Computer Science and Mathematics, Universit y of Passau, Germany Abstract In 1999, Heath, P emmara ju, and T renk [SIAM J. Comput. 28(4), 1999] extended the classic notion of b ook em beddings to digraphs, in tro ducing the concept of upwar d b o ok emb eddings , in which the v ertices m ust appear along the spine in a top ological order and the edges are partitioned into pages, so that no tw o edges in the same page cross. F or a partitioned digraph G = ( V , S k i =1 E i ) , that is, a digraph whose edge set is partitioned into k subsets, an up ward b o ok em b edding is required to assign edges to pages as prescribed by the given partition. In a companion paper, Heath and P emmara ju [SIAM J. Comput 28(5), 1999] pro ved that the problem of testing the existence of an up ward b o ok em b edding of a partitioned digraph is linear-time solv able for k = 1 and recen tly Akita y a, Demaine, Hesterb erg, and Liu [GD, 2017] ha ve shown the problem NP -complete for k ≥ 3 . In this pap er, w e study up ward b o ok em b eddings of partitioned digraphs and fo cus on the unsolved case k = 2 . Our first main result is a nov el c haracterization of the upwar d emb e d dings that supp ort an upw ard b o ok embedding in t wo pages. W e exploit this characterization in several w ays, and obtain a ric h picture of the complexity landscap e of the problem. First, we show that the problem remains NP -complete when k = 2 , thus closing the complexit y gap for the problem. Second, w e show that, for an n -v ertex partitioned digraph G with a prescrib ed planar embedding, the existence of an up w ard b o ok em b edding of G that resp ects the given planar em b edding can b e tested in O ( n log 3 n ) time. Finally , leveraging the SPQ(R)-tree decomposition of biconnected graphs in to triconnected comp onen ts, we present a cubic-time testing algorithm for biconnected directed partial 2 -trees. 2012 ACM Subject Classification Theory of computation → Computational geometry; Mathematics of computing → Graph algorithms; Theory of computation → Design and analysis of algorithms Keyw o rds and phrases upw ard b ook embeddings, partitioned digraphs, SPQ-trees, 2 -trees Related V ersion A preliminary version of the pap er app ears at the 42nd In ternational Symposium on Computational Geometry (SoCG ’26). 1 Intro duction Bo ok em b eddings are a classic and influential topic in com binatorial and algorithmic graph theory . The notion of bo ok as a top ological space was introduced in the late 60s by P ersinger [ 77 ] and A tneosen [ 7 ], and later dev elop ed in its curren t and more popular form b y the seminal work of Ollmann [ 76 ]. In a b o ok emb e dding of a graph G = ( V , E ) , all vertices lie along a line—referred to as the spine —while edges are placed in to distinct half-planes b ounded by the spine, known as the p ages of the bo ok. Therefore, constructing suc h an em b edding for G amoun ts to computing a pair ( π , σ ) , where π : V ↔ { 1 , . . . , | V |} is a linear ordering of the vertices and σ : E → { 1 , . . . , k } is a partition of the edges into k pages so that no tw o edges in the same page cross according to π , i.e., their end-vertices do not alternate in π ; see Fig. 1a for an example. The minim um v alue of k for whic h this is p ossible is the b o ok thickness of G (also called stack numb er or p age numb er ) and the b o ok thickness of a graph class G is the maxim um b o ok thickness among all graphs in G . 2 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs Researc h on b o ok embeddings and b o ok thickness originated from problems in VLSI circuit design [ 30 ], and has since found applications in a v ariety of domains. These include sorting p erm utations [ 78 , 82 ], fault-tolerant processing [ 80 ], compact graph enco dings [ 59 , 73 ], graph dra wing [ 21 , 35 , 40 , 48 ], computational origami [ 1 , 72 ], parallel pro cess sc heduling [ 18 ], and parallel matrix computations [ 53 ], among others. F or additional references and a more comprehensiv e ov erview of applications, see e.g. [ 39 ]. The notion of b o ok em b edding w as extended to digraphs by Heath, P emmara ju, and T renk [ 54 ] b y introducing the natural requiremen t that in a b o ok embedding ( π , σ ) of a digraph G the ordering π m ust b e a top ological ordering of G ; see Figs. 1b and 1c for an example. Such bo ok embeddings are called upwar d b o ok emb e ddings as they are naturally depicted with vertices placed on a v ertical line and edges drawn as arcs monotonically increasing in the y -direction in their page. Next, w e provide an o verview of the ma jor results on b o ok embeddings. Undirected graphs. In 1979, Bernhart and Kainen [ 14 ] show ed that the graphs of b o ok thic kness 1 are exactly the outerplanar graphs and that the graphs of b o ok thickness 2 are exactly the sub-Hamiltonian planar graphs. Whereas the former are kno wn to be recognizable in linear time [ 85 ], recognizing sub-Hamiltonian planar graphs is NP -complete, ev en for planar triangulations [ 86 ]. Sev eral classes of planar graphs are kno wn to admit a b o ok em b edding in tw o pages, e.g., 4-connected planar graphs [ 83 ], planar graphs without separating triangles [ 63 ], planar graphs of maximum degree 4 [ 13 ], triconnected planar graphs of maximum degree 5 [ 55 ], maximal planar graphs of maximum degree 6 [ 41 ], Halin graphs [ 31 ], series-parallel graphs [ 79 ], and bipartite planar graphs [ 32 ]. Recen tly , Ganian et al. [ 45 ] presen ted a 2 O ( √ n ) -time algorithm for testing the existence of a b o ok embedding of an n -v ertex graph on tw o pages–a bound whic h is asymptotically tigh t under ETH. P erhaps the most celebrated result concerning b o ok thicknes s is the one due to Y annakakis, who sho w ed that ev ery planar graph has b o ok thic kness at most 4 [ 87 , 88 ]. This upp er bound w as only recently sho wn to b e tigh t indep endently b y Y annakakis [ 89 ] and Bekos et al. [ 64 ]. F or more results on b o ok thickness see also [ 2 , 10 , 12 , 25 , 27 , 38 , 46 , 49 , 51 , 58 , 67 , 68 ]. Finally , w e remark that, for arbitrary k , the problem of testing the existence of a b o ok embedding in k pages is known to be fixed-parameter tractable (FPT) with respect to the v ertex cov er n um b er [ 20 ] and the feedbac k edge num b er [ 45 ]. 1 2 3 4 5 6 (a) 1 2 3 4 5 6 (b) 1 2 3 4 6 5 (c) Figure 1 (a) A bo ok embedding of the o ctahedron in 2 pages. (b) An orientation of the o ctahedron. (c) An up w ard b o ok em bedding of the directed o ctahedron in (b) in 3 pages, which is optimal. G. Da Lozzo, F. F rati, and I. Rutter 3 Directed graphs. On the com binatorial side, a large b o dy of research has directed its focus to w ard establishing upper and lo wer bounds on the bo ok thic kness of digraphs. Tight upp er b ounds hav e long b een kno wn for directed trees and unicyclic digraphs [ 54 ], for series-parallel digraphs [ 3 , 35 ], and for N-free up ward planar digraphs [ 69 ]. In [ 54 ], Heath, Pemmaraju and T renk conjectured a constan t upp er b ound for the b o ok thickness of outerplanar digraphs. The conjecture was first confirmed for sev eral families of outerplanar digraphs by Bhore et al. [ 19 ] and b y Nöllenburg and Pup yrev [ 74 ], and finally settled by Jungeblut, Merk er, and Uec kerdt [ 61 ]. The ma jor unsolved question in this area is the one p osed more than 30 y ears ago by No wak owski and P arker [ 75 ] of whether planar posets, and more generally up w ard planar digraphs, hav e b ounded b o ok thick eness. Recen tly , Jungeblut, Merker, and Uec k erdt [ 62 ] presented the first sublinear upp er b ound on the page num b er of up ward planar graphs. A large b o dy of researc h has dev oted its atten tion to testing the existence of a b o ok em b edding of a D AG in k pages. The problem is called Upw ard Book Embedding . F or more than tw o decades, the only kno wn NP -completeness result for the problem w as the one sho wn by Heath and P emmara ju [ 52 ] when k = 6 . Recently , in t w o subsequent pap ers, Bin ucci et al. [ 24 ] and Bek os et al. [ 11 ] closed the computational gap b y showing NP -completeness for k ≥ 3 and k = 2 , respectively . These results, together with the linear-time algorithm for testing the existence of 1-page bo ok embeddings of DA Gs [ 52 ], completely c haracterize the complexit y of the Upw ard Book Embedding problem with respect to the num b er of a v ailable pages. F or k = 2 , efficient algorithms hav e b een devised for outerplanar and planar triangulated st -graphs [ 70 ], and the problem is kno wn to b e FPT for st -graphs of b ounded treewidth [ 23 ] and for st -graphs whose vertices can b e cov ered by a b ounded num b er of directed paths [ 69 ]. F or arbitrary k , the Upw ard Book Embedding problem has b een pro v ed FPT with respect to the vertex co ver n umber [ 19 , 66 ]. P artitioned b o ok embeddings. In the construction of a b o ok embedding of a (di)graph, one is allow ed to select a v ertex ordering π and a page assignment σ . Since, as discussed, determining the existence of suc h a pair ( π , σ ) so to minimize the n um b er of pages is NP -hard, it is natural to study the complexity of the problem if π or σ is given as part of the input. Determining an assignmen t on k pages for a fixed v ertex ordering π naturally corresp onds to a k -coloring problem on circle graphs. Observ e that, in this case, the undirected and directed ve rsions retain the same complexity , as a linear-time pre-processing can b e used to reject directed instances for whic h the prescrib ed v ertex ordering is not a topological ordering. The problem is called Fixed-Order Book Embedding and is clearly p olynomial-time solv able for k ≤ 2 . Unger [ 84 ] show ed that it is NP -complete for k ≥ 4 . The complexit y of the case k = 3 is still unsolv ed [ 8 , 9 ], although a quasi-polynomial-time algorithm has recently b een prop osed [ 81 ]. F or arbitrary k , FPT algorithms for Fixed-Order Book Embedding ha v e also been presented with resp ect to the vertex co ver n umber [ 20 ] and the pathwidth of the v ertex ordering [ 20 , 65 ]. The complementary problem asks, for a giv en partition σ of the edges in k pages, whether there is an ordering π of the vertices that yields a b o ok em b edding. In the case of undirected graphs, this problem is p olynomial-time solv able for k = 1 [ 52 ], k = 2 [ 6 , 56 , 57 ] and NP -complete for k ≥ 3 [ 5 ]. This paper studies the complexity of this problem for directed graphs, i.e., for up ward bo ok embeddings, in which π is required to be a top ological ordering of the input graph. This problem is called P ar titioned Upw ard Book Embedding . F or k = 1 it coincides with the “unpartitioned” case already solved in [ 52 , 54 ]. F or k > 1 , it was first studied systematically by Akita ya et al. [ 1 ]. They connected the problem to applications in map folding [ 72 ] and attributed it to Edmonds, who, already in 1997, p osed 4 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs v ertex order π fixed v ariable page assignmen t σ fixed O(n+m) time ✓ 1 page: O(n) time [ 52 ] 2 pages: NP -complete ( Theorem 4 ) ≥ 3 pages: NP -complete [ 1 ] v ariable 2 pages: O(n) time ✓ 3 pages: OPEN [ 9 ] ≥ 4 pages: NP -complete [ 84 ] 2 pages: NP -complete [ 11 ] ≥ 3 pages: NP -complete [ 24 ] T able 1 Kno wn results on the computational complexit y of testing the existence of an up ward b ook embedding of a digraph. Results marked with the symbol ✓ are trivial. the question sp ecifically for k = 4 when the edges assigned to eac h page form a matching. They sho wed that the problem is NP -complete for k ≥ 3 , it is NP -complete for k ≥ 4 ev en if the edges in eac h page form a matc hing, and they gav e a linear-time algorithm for the case k = 2 when the edges in eac h page form a matc hing. T able 1 provides a comprehensiv e view of the complexity of the problem of computing up ward bo ok embeddings of digraphs. Our Contributions. In this paper, w e study the P ar titioned Upw ard Book Embedding problem and fo cus on the unsolv ed case k = 2 . Note that every up ward bo ok embedding is an upwar d planar dr awing , i.e., a planar dra wing where each edge appears as a y -monotone curv e. The topological information in an upw ard planar dra wing is represen ted by the concept of upwar d emb e dding [ 15 ]. Our first main result is a c haracterization of the up ward embed- dings that supp ort an upw ard bo ok em b edding in t wo pages. W e exploit this characterization in sev eral w a ys and obtain a rich picture of the complexit y landscap e of the problem. First, we show that the P ar titioned Upw ard Book Embedding problem remains NP -complete when k = 2 , thus closing the complexit y gap for the problem and exhibiting a sharp contrast with the undirected case, in whic h the problem is linear-time solv able [ 57 ]. Our pro of also implies that the problem is W[1]-hard with resp ect to the treewidth. Second, w e sho w that, for an n -v ertex digraph with a prescrib ed planar embedding, the existence of an up ward bo ok em b edding that respects the given planar embedding can b e tested in O ( n log 3 n ) time. Our algorithm is inspired b y the netw ork-flow approac h of Bertolazzi et al. [ 15 ] and requires the use of several non-trivial ingredients arising from our c haracterization. Finally , we presen t a cubic-time algorithm that tests the existence of an up ward bo ok em b edding for a given biconnected directed partial 2 -tree G . Our algorithm exploits a compact representation (called descriptor p air ) of the features of an upw ard embedding of a subgraph of G that are relev ant for its extensibilit y to an up ward em b edding, satisfying our c haracterization, of G . This allo ws us to compute, via a bottom-up dynamic programming algorithm built on the SPQ(R)-tree decomp osition of G , whic h descriptor pairs are realizable b y eac h subgraph asso ciated with a no de of the SPQ(R)-tree. In the description of our algorithms, w e focus on the decision problem, ho w ever they can b e made constructive in order to yield the desired up ward bo ok embeddings, if any . 2 Prelimina ries All the graphs considered in this pap er are finite and simple , i.e., they contain neither self-lo ops nor multiple edges. F or an integer k > 0 , let [ k ] denote the set { 1 , . . . , k } . G. Da Lozzo, F. F rati, and I. Rutter 5 Digraphs. A dir e cte d gr aph G , or digr aph , is a graph whose edges hav e an assigned orien tation. W e denote a directed edge as ( u, v ) if it is orien ted from u to v ; then w e say that u is the tail and v is the he ad of the edge. A vertex u of G is a sour c e (resp. a sink ) if it is the tail (resp. the head) of all its inciden t edges. A vertex that is a source or a sink is a switch . A dir e cte d acyclic gr aph (for short, D A G ) is a digraph with no directed cycle. Dra wings and emb eddings. A dr awing of a digraph maps eac h v ertex to a distinct p oint in R 2 and each edge to a Jordan arc connecting the images of its end-vertices, so that eac h arc that is the image of an edge do es not contain an y p oin t that is the image of a v ertex, except for its end-p oints. A dra wing of a digraph is planar if no tw o edges cross. A digraph is planar if it admits a planar drawing. A planar drawing partitions the plane in to top ologically connected regions, called fac es . The unique unbounded face is the outer fac e , whereas the remaining faces are the internal fac es . The set of edges incident to a face forms its b oundary . Suc h edges determine a collection of w alks or a single w alk if the digraph is connected. T w o planar dra wings of a connected digraph are top olo gic al ly e quivalent if they hav e the same clo c kwise order of the edges around eac h vertex and the same clockwise order of the edges along the boundary of the outer face. F or disconnected digraphs, the notion of top ological equiv alence additionally comprises the r elative p ositions of connected comp onents to one another, that is, the information ab out the containmen t of eac h connected comp onent inside the regions of the plane delimited by the face b oundaries of another connected comp onent 1 . A planar emb e dding is a class of top ologically equiv alent planar dra wings. All the drawings in the same equiv alence class r esp e ct the embedding defined by the class. A plane digr aph is a planar digraph together with a planar em b edding. A planar em b edding of a digraph G is bimo dal if, for every v ertex v , the edges of G that ha v e their tail at v are consecutive in the clo ckwis e order of the edges incident to v . Up wa rd planarit y . A dra wing of a digraph is upwar d if ev ery edge is represented b y a Jordan arc that is strictly increasing in the y -direction from its tail to its head. A digraph that admits an upw ard planar drawing is an upwar d planar digr aph . Clearly , an upw ard planar digraph is a DA G, as a directed cycle cannot b e drawn up ward. A planar st -gr aph is a DA G with one source s and one sink t that admits a planar embedding in whic h s and t are on the b oundary of the outer face. A planar st -graph equipp ed with a planar embedding suc h that s and t are incident to the outer face is a plane st -gr aph . A plane st -graph G alw a ys admits an up ward planar drawing resp ecting the planar embedding of G [ 33 ]. A face f of a planar em b edding E of a plane digraph is an st -fac e if its b oundary consists of t w o directed paths. These are called left p ath and right p ath of f , and are denoted by ℓ f and r f , resp ectively , where the edge of ℓ f inciden t to the source s f of the cycle b ounding f immediately precedes the edge of the righ t path incident to s f in the clo ckwise order of the edges inciden t to s f if f is an in ternal face, or immediately follows it if f is the outer face. The left and right path of the outer face are also called leftmost and rightmost path of G , resp ectiv ely . Let E b e a bimo dal planar em b edding of a digraph G = ( V , E ) . F or v ∈ V , an angle at v is an ordered pair ( e 1 , e 2 ) of edges inciden t to v suc h that e 2 immediately follo ws e 1 in the 1 In the literature, topological equiv alence betw een t wo dra wings of a disconnected digraph sometimes only requires top ological equiv alence b etw een the drawings of the connected comp onents of the digraph, without taking into accoun t the relativ e p ositions of the components. This relaxed notion of equiv alence would make our research easier, as the existence of an upw ard b o ok em b edding of digraph w ould boil down to the existence of an upw ard b o ok em b edding for each connected comp onent of the digraph. 6 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs (a) +1 +1 +1 +1 +1 +1 +1 +1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 − 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 − 1 +1 − 1 − 1 0 − 1 0 − 1 0 (b) Figure 2 (a) An upw ard planar dra wing Γ and its big, small, and flat angles depicted as red, green, and yello w sectors, respectively . (b) The upw ard-consistent angle assignmen tas λ Γ defined by Γ . clo c kwise order of edges around v . An angle ( e 1 , e 2 ) is a switch angle if v is the head or the tail of both e 1 and e 2 . An angle that is not a switch angle is a flat angle . F or a vertex v , w e denote by A E ( v ) the set of angles inciden t to v . Also, w e denote by A E = S v ∈ V A E ( v ) the set of angles of E and, for a face f , b y A E ( f ) the set of angles incident to f . An angle assignment for E is a function λ : A E → {− 1 , 0 , 1 } . An angle assignment is upwar d-c onsistent if it satisfies the following conditions: C1 F or eac h angle a ∈ A E : λ ( a ) = 0 if and only if a is flat. C2 F or eac h v ertex v ∈ V : P a ∈ A E ( v ) λ ( a ) = 2 − deg( v ) . C3 F or eac h face f of E : P a ∈ A E ( f ) λ ( a ) = − 2 if f is an internal face and P a ∈ A E ( f ) λ ( a ) = 2 if f is the outer face. Let Γ b e an upw ard planar dra wing of a digraph G with planar embedding E ; refer to Fig. 2 . Clearly , E is bimo dal. Moreo ver, it defines an angle assignment λ Γ as follo ws. Let a = ( e 1 , e 2 ) b e an angle of E . If a is flat, then we define λ Γ ( a ) = 0 . Otherwise, consider the geometric angle α in Γ corresp onding to a , i.e., lying clo ckwise after e 1 and b efore e 2 . W e define λ Γ ( a ) = − 1 if α < π and λ Γ ( a ) = 1 if α > π . Observe that α = π , since a is a switc h angle. It is not hard to see that λ Γ is up w ard-consisten t [ 15 , 36 ]. A pair ( E , λ ) of a planar embedding E and an angle assignment λ is an upwar d emb e dding if there exists an up ward planar drawing Γ with em b edding E suc h that λ = λ Γ . W e hav e that angles a with λ ( a ) = 0 are flat; also, we call an angle a lar ge if λ ( a ) = 1 and smal l if λ ( a ) = − 1 . An angle assignment is completely determined b y assigning eac h switch to one of its incident angles, which corresponds to making that angle large; the switch angles to whic h no switc h is assigned are small. ▶ Theo rem 1 ([ 15 , 36 ]) . L et G b e a digr aph, let E b e a planar emb e dding of G , and let λ b e an angle assignment for E . Then the p air ( E , λ ) is an upwar d emb e dding if and only if E is bimo dal and λ is upwar d-c onsistent. A digraph equipp ed with an upw ard embedding is an upwar d plane digr aph . In the paper, we often sa y that a face or an angle is to the left (or to the right ) of a directed path, p ossibly a single edge. This means that the face or angle is to the left (to the righ t) of the directed path when trav ersing the path according to its orientation. G. Da Lozzo, F. F rati, and I. Rutter 7 Up wa rd Bo ok Emb eddings. A p artitione d digr aph is a digraph G = ( V , S k i =1 E i ) , whose edge set is partitioned in to k sets. An upwar d b o ok emb e dding (in k pages) of an n -v ertex partitioned digraph G = ( V , S k i =1 E i ) is a bijection π : V ↔ { 1 , . . . , n } such that: (i) for each edge e = ( u, v ) , it holds that π ( u ) < π ( v ) , i.e., the tail of e precedes the head of e according to π , and (ii) for any i ∈ [ k ] , no tw o edges ( u, v ) , ( w , x ) ∈ E i cross, where ( u, v ) and ( w , x ) cr oss if π ( u ) < π ( w ) < π ( v ) < π ( x ) or π ( w ) < π ( u ) < π ( x ) < π ( v ) , i.e., their end-vertices in terlea ve in the total order of V defined by π . In this pap er, we focus on the case k = 2 and denote the sets E 1 and E 2 as L and R , resp ectiv ely . W e often omit that our upw ard b o ok em b eddings are in t wo pages and just talk ab out upw ard b o ok embeddings. Also, w e call the edges in L left e dges and the edges in R right e dges . This terminology is motiv ated b y the fact that an up ward b o ok em b edding ( π , σ ) of G = ( V , L ∪ R ) determines an up ward planar dra wing of G as follo ws: The vertices of G lie along a vertical line, called spine , so that the y -co ordinate of each v ertex v is π ( v ) , and eac h edge ( u, v ) in L (resp. in R ) is drawn as a semi-circle with diameter π ( v ) − π ( u ) to the left (resp. to the righ t) of the spine. W e often implicitly refer to such a representation and sa y that in an upw ard b o ok embedding the edges lie to the left or to the right of the spine. In all the illustrations, the edges in L are blue and solid, while the edges in R are red and dashed. An upw ard planar drawing r esp e cts a planar em b edding E if it b elongs to the equiv alence class E . An upw ard b o ok em b edding Γ r esp e cts a planar em b edding E if the upw ard planar dra wing asso ciated with Γ resp ects E , and it r esp e cts an up ward embedding ( E , λ ) if it resp ects E and λ Γ = λ . Let G = ( V , L ∪ R ) be a partitioned digraph with an upw ard embedding ( E , λ ) . A v ertex v ∈ V is 4-mo dal if it satisfies the follo wing condition: (i) if v is a non-switch vertex, then in clockwise order around v in E w e ha ve all the outgoing left edges, all the outgoing righ t edges, all the incoming righ t edges, and all the incoming left edges; one of the former tw o sets and/or one of the latter tw o sets might be empty . (ii) if v is a source (resp. a sink), then in clockwise order around v in ( E , λ ) w e hav e the large angle at v , all the outgoing left edges, and all the outgoing righ t edges (resp. the large angle at v , all the incoming right edges, and all the incoming left edges); one of the tw o sets of outgoing (resp. incoming) edges might be empty . W e sa y that ( E , λ ) is 4-mo dal if all the vertices of G are 4-modal. ▶ Prop ert y 1. L et Γ b e an upwar d b o ok emb e dding of a p artitione d digr aph G = ( V , L ∪ R ) and let ( E , λ ) b e the upwar d emb e dding of G define d by Γ . Then ( E , λ ) is 4-mo dal. Pro of. Consider an y non-switc h vertex v of G . Since Γ is an up w ard bo ok em b edding, the left (righ t) edges are to the left (resp. righ t) of the spine of Γ . Also, since Γ is an up ward planar dra wing, the edges incoming into v (outgoing from v ), lie b elow (resp. abov e) the horizon tal line through v . Hence, the outgoing left, outgoing right, incoming righ t, and incoming left edges are incident in to v in the second, first, fourth, and third quadran t, respectively . Th us, v is 4-mo dal. If v is a source (a sink), w e analogously hav e that the outgoing left and outgoing righ t edges (resp. the incoming righ t and incoming left edges) inciden t to v lie in the second and first (resp. fourth and third) quadrant, respectively , while the large angle at v o ccupies the third and fourth (resp. first and second) quadrant, hence v is 4-modal. ◀ 8 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs 0 0 ℓ b c d k h g +1 0 +1 +1 0 +1 f +1 a +1 +1 w 0 u +1 0 0 0 i +1 0 0 0 0 e v j e ∗ (a) Q Q S S Q S Q Q P S Q S Q Q S Q Q Q Q Q S Q Q P Q P S S Q S u , v a , c c , v a , c a , b b , c d , v a , e e , v e , k k , v e , k e , k e , f f , k u , w w , v w , i i , v i , ℓ ℓ , v g , i w , i w , j j , i w , h h , i Q S σ ∗ u , v ρ ∗ u , a P u , v u , a a , v a , v a , v a , v a , d a , c P Q Q Q S Q P w , j w , g g , j w , j S (b) Figure 3 (a) An upw ard planar dra wing Γ of a biconnected partitioned directed partial 2 -tree G . The lab eling λ Γ of the angles determined by Γ is shown; the missing labels are equal to − 1 . (b) The SPQ-tree of G ro oted at the Q-node corresp onding to the edge e ∗ of G . P artial 2-trees. The class of (undirected) p artial 2 -tr e es can b e defined in several equiv alent w a ys. Namely , a graph is a partial 2 -tree if and only if: it has treewidth at most tw o; it excludes K 4 as a minor; or it is a subgraph of a 2 -tree, whic h is a graph that can b e obtained starting from an edge and rep eatedly inserting a vertex of degree t wo adjacen t to tw o adjacent v ertices. Notably , the class of partial 2 -trees includes the series-p ar al lel gr aphs , see, e.g., [ 17 , 22 , 42 ]. Let G b e a biconnected partial 2 -tree and let e ∗ b e an edge of G with end-vertices u ∗ and v ∗ ; refer to Fig. 3 . The SPQ-tr e e T of G with r esp e ct to e ∗ is a rooted tree that describ es a recursive decomposition of G in to smaller partial 2 -trees; it is a specialization of the well-kno wn SPQR-tr e e , whic h is defined for general biconnected planar graphs [ 34 , 50 ]. The ro ot of T is a Q-no de ρ ∗ asso ciated with the en tire graph G and has a single child σ ∗ . Define G − e ∗ as the p ertinent gr aph of σ ∗ , and let u ∗ and v ∗ b e the p oles of both σ ∗ and ρ ∗ . The remainder of the definition of T pro ceeds recursively as follo ws. Suppose w e are given a quadruple ⟨ µ, u, v , G µ ⟩ , where µ is a no de of T with p oles u and v , and G µ is its p ertinen t graph. Initially , this quadruple is ⟨ σ ∗ , u ∗ , v ∗ , G − e ∗ ⟩ . Three cases can o ccur: If G µ is a single edge ( u, v ) , then µ is a Q-no de representing that edge; µ is a leaf of T . If G µ is not biconnected, then µ is an S-no de. Let w b e a cut-vertex of G µ . Remo ving w splits G µ in to tw o connected comp onen ts: one, G u µ , con taining u , and the other, G v µ , con taining v . Then µ has tw o c hildren ν 1 and ν 2 in T . The pertinent graph G ν 1 (resp. G ν 2 ) is the subgraph of G µ induced by { w } ∪ V ( G u µ ) (resp. by { w } ∪ V ( G v µ ) ). The p oles of ν 1 are u and w , and those of ν 2 are w and v . The construction of T recurses on ⟨ ν 1 , u, w , G ν 1 ⟩ and on ⟨ ν 2 , w , v , G ν 2 ⟩ . If G µ is biconnected, then µ is a P-no de. If ( u, v ) is not an edge of G µ , then removing u and v splits G µ in to k connected comp onen ts G 1 µ , . . . , G k µ , with k ≥ 2 . Then µ has k c hildren ν 1 , . . . , ν k , where G ν i is the subgraph of G µ induced b y { u, v } ∪ V ( G i µ ) ; the p oles of ν i are u and v . G. Da Lozzo, F. F rati, and I. Rutter 9 f ℓ f r f f r f ℓ f t f t f s f s f (a) f ℓ f u v w z (b) Figure 4 Impossible faces in (a) a plane st -graph and (b) an upw ard plane digraph. If ( u, v ) is an edge of G µ , then removin g u and v lea v es k − 1 comp onents G 1 µ , . . . , G k − 1 µ , with k ≥ 2 . In this case, µ has k c hildren ν 1 , . . . , ν k : for i = 1 , . . . , k − 1 , the pertinent graph G ν i is the subgraph of G µ induced b y { u, v } ∪ V ( G i µ ) , excluding the edge ( u, v ) , while G ν k is the edge ( u, v ) . Again, all no des ν i ha v e poles u and v . The construction of T recurses on eac h quadruple ⟨ ν i , u, v , G ν i ⟩ . Observ e that ev ery S-no de has tw o children, whic h may themselv es b e S-nodes. The SPQ-tree of G is in general not unique: Different c hoices for the cut-v ertex w of the pertinent graph of an S-no de and different choices for the reference edge migh t result in different SPQ-trees. In this pap er, we assume that the c hoice of the cut-vertex w for eac h S-no de of a ro oted SPQ-tree is p erformed arbitrarily . On the other hand, the choice of the reference edge whic h serv es as the ro ot of the SPQ-tree will b e done in all possible wa ys, as the reference edge will be forced to b e incident to the outer face. If G has n v ertices, then its SPQ-tree has O ( n ) no des and can b e computed in O ( n ) time [ 34 ]. A dir e cte d p artial 2 -tr e e is a digraph whose underlying graph is a partial 2 -tree, where the underlying graph is the undirected graph obtained b y ignoring the edge directions. An SPQ-tree of a biconnected directed partial 2 -tree G is an SPQ-tree of its underlying graph, although the edges of the p ertinent graph of eac h no de are oriented as in G . 3 Cha racterization fo r Upw ard Emb eddings In this section w e characterize the up ward em b eddings of a partitioned digraph that allow for the construction of an up ward b o ok embedding. W e first present our characterization for plane st -graphs, and then extend it to general plane digraphs. If G is a plane st -graph with planar embedding E , there is a unique upw ard-consistent angle-assignmen t λ whic h turns E in to an upw ard embedding ( E , λ ) . Indeed, vertices differen t from s and t do not hav e any inciden t large angle, and the large angles at s and t are necessarily those in the outer face of E . Thus, for a planar st -graph, we can a void talking ab out angle-assignments and up w ard em b edding, and just consider planar embeddings. Let G = ( V , L ∪ R ) b e a partitioned plane st -graph, let E b e the planar embedding of G , and let f b e a face of E . W e sa y that f is imp ossible if the left path ℓ f of f only consists of edges in R and the righ t path r f of f is not a single edge, or if r f only consists of edges in L and ℓ f is not a single edge; see Fig. 4a . W e ha v e the follo wing. 10 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs s r f s f t f t r f u s t f v (a) t f s ℓ f s f t f t r f s s r f (b) t f s f t f t r f s w z s r f t ℓ f s ℓ f (c) Figure 5 Illustrations for the pro of of Theorem 2 . (a) ( s f , s r f ) , ( t r f , t f ) ∈ R . (b) ( s f , s r f ) ∈ L , ( t r f , t f ) ∈ R . (c) ( s f , s r f ) , ( t r f , t f ) ∈ L . ▶ Theo rem 2. L et G = ( V , L ∪ R ) b e a p artitione d plane st -gr aph and let E b e the planar emb e dding of G . Then G admits an upwar d b o ok emb e dding r esp e cting E if and only if E is 4-mo dal and no fac e of E is imp ossible. Pro of. W e first prov e the necessity . Prop erty 1 ensures the necessity of the 4-modality of E . Next, consider an upw ard b o ok embedding Γ respecting E and supp ose, for a contradiction, that there exists a face f of E suc h that ℓ f only consists of edges in R and r f con tains an in ternal v ertex v . Since ℓ f only consists of edges in R , its represen tation in Γ lies en tirely to the right of the spine of Γ , except at its v ertices. Since Γ is an up ward planar dra wing resp ecting E , we ha v e that v has to lie in the strip S delimited by the horizon tal lines through the source and the sink of f . Ho wev er, this is not p ossible since v has to lie to the righ t of ℓ f (giv en that ℓ f and r f are resp ectively the left and right path of f ) and since no point of the spine lies in the strip S and to the righ t of the curv e represen ting ℓ f in Γ . A con tradiction can be achiev ed analogously if E con tains a face such that r f only consists of edges in L and ℓ f con tains an in ternal v ertex. W e no w pro ve the sufficiency . Every plane st -graph can b e constructed starting from its leftmost path b y rep eatedly adding the right path of an in ternal face whose left path already b elongs to the graph, see, e.g., [ 4 , 33 , 44 , 71 ]; more precisely , what needs to be added are the in ternal v ertices and all the edges of the right path of the face. W e use this in order to construct an upw ard b o ok embedding Γ of G resp ecting E . W e start by dra wing in Γ the leftmost path of G so that edges in L are to the left of the spine and edges in R are to the righ t of the spine. When we draw the righ t path r f of a face f whose left path ℓ f already b elongs to the subgraph of G drawn in Γ , w e distinguish tw o cases. First, if r f is a single edge e , then, since G is simple, we ha ve that ℓ f con tains an internal v ertex. If e ∈ L , we ha ve that r f consists only of edges in L and ℓ f is not just a single edge, i.e., f is imp ossible. Thus, it follo ws that e ∈ R . Then we just dra w e as a semi-circle to the righ t of the spine (and hence to the right of the curv e representing ℓ f in Γ ). Second, supp ose that r f is not a single edge; refer to Fig. 5 . This implies that ℓ f is not en tirely comp osed of right edges, as otherwise f w ould b e an imp ossible face. Hence, let ( u, v ) b e a left edge of ℓ f . Also, let s f and t f b e the source and the sink of the cycle delimiting f , resp ectiv ely . F urthermore, let s r f and t r f b e the neighbors of s f and t f , resp ectively , in r f . G. Da Lozzo, F. F rati, and I. Rutter 11 Analogously , let s ℓ f and t ℓ f b e the neighbors of s f and t f , resp ectively , in ℓ f . W e distinguish four cases. Supp ose first that ( s f , s r f ) and ( t r f , t f ) are b oth right edges; see Fig. 5a . Then we em b ed all the in ternal v ertices of r f after u and before v on the spine, in the order in which they app ear along r f . The semi-circle represen ting ( s f , s r f ) is to the righ t of the p ortion of the curv e representing ℓ f b et w een s f and the horizon tal line through s r f , in particular it is to the righ t of the semi-circle representing ( u, v ) since ( u, v ) is a left edge. Hence, ( s f , s r f ) do es not cause crossings in Γ . Analogously , ( t r f , t f ) do es not cause crossings in Γ . Finally , the curv e represen ting the directed subpath of r f b et w een s r f and t r f do es not cause crossings in Γ , since it is pr ote cte d b y the semi-circle representing the edge ( u, v ) to its left. That is, the semi-circle representing ( u, v ) is to the left of (and do es not cross) the subpath of r f b et w een s r f and t r f , since ( u, v ) is a left edge, with u b elo w s r f and v ab o v e t r f . Also, the subpath of r f b et w een s r f and t r f do es not cross any edge different from ( u, v ) in Γ , as the intersection, if an y , of suc h an edge with the strip delimited by the horizontal lines through u and v , is to the left of ( u, v ) , given that ( u, v ) is on the righ tmost path of the graph represented in Γ before drawing r f . Supp ose next that ( s f , s r f ) is a left edge and ( t r f , t f ) is a righ t edge; see Fig. 5b . By 4-mo dalit y , the edge ( s f , s ℓ f ) is a left edge. Then w e embed all the in ternal vertices of r f after s f and before s ℓ f on the spine, in the order in whic h they appear along r f . The pro of that this do es not cause crossings is analogous to the previous case. The case in whic h ( s f , s r f ) is a right edge and ( t r f , t f ) is a left edge can b e discussed symmetrically to the previous case. Finally , suppose that ( s f , s r f ) and ( t r f , t f ) are b oth left edges. If r f is en tirely comp osed of left edges, then ℓ f is a single edge, as otherwise f w ould b e an imp ossible face. By 4-mo dalit y , ℓ f is a left edge. Therefore, w e can embed all the in ternal vertices of r f after s f and b efore t f on the spine, in the order in which they appear along r f . Otherwise, r f con tains at least one righ t edge, call it ( w , z ) ; see Fig. 5c . W e em b ed all the v ertices of the subpath of r f b et w een s r f and w after s f and before s ℓ f on the spine, in the order in whic h they app ear along r f ; note that ( s f , s ℓ f ) is a left edge, since ( s f , s r f ) is a left edge and by the 4-mo dality of E . Also, w e embed all the vertices of the subpath of r f b et w een z and t r f after t ℓ f and b efore t f on the spine, in the order in whic h they app ear along r f ; again note that ( t ℓ f , t f ) is a left edge. The curves representing suc h subpaths of r f do not cause crossings, as they are protected by the semi-circles represen ting the edges ( s f , s ℓ f ) and ( t ℓ f , t f ) to their left. Finally , the semi-circle represen ting ( w , z ) , which lies to the right of the spine, do es not cause crossings, since it lies to the righ t of the semi-circles represen ting ( s f , s ℓ f ) and ( t ℓ f , t f ) , since these are left edges, and lies to the righ t of the curve represen ting the subpath of ℓ f b et w een s ℓ f and t ℓ f , since the vertices of this subpath all come after w and before z on the spine. This concludes the pro of of the characterization. ◀ F or plane digraphs that can ha ve m ultiple sources and sinks, we generalize the notion of impossible face as follo ws. Let G = ( V , L ∪ R ) be a partitioned up ward plane digraph, let ( E , λ ) b e the upw ard em b edding of G , and let f b e a face of E . Let L f (resp. R f ) b e the set of maximal directed paths in the b oundary of f that consist of edges that hav e f to their righ t (resp. to their left). Note that, if G is not biconnected, paths from L f and paths from R f are not necessarily disjoint. The face f is imp ossible if it satisfies one of the follo wing t w o conditions (see Fig. 4b ): 12 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs (i) L f con tains a path ℓ f with the following properties. First, ℓ f consists of edges in R . Second, the rest of the b oundary of f is not a single edge. Third, let u and v b e the extremes of ℓ f , let e u f and e v f b e the edges of ℓ f inciden t to u and v , respectively; then the angle in f inciden t to u and to the righ t of e u f and the angle in f inciden t to v and to the righ t of e v f are small. (ii) R f con tains a path r f with the following prop erties. First, r f consists of edges in L . Second, the rest of the b oundary of f is not a single edge. Third, let u and v b e the extremes of r f , let e u f and e v f b e the edges of r f inciden t to u and v , respectively; then the angle in f inciden t to u and to the left of e u f and the angle in f inciden t to v and to the left of e v f are small. Note that, if G is a partitioned plane st -graph, then the new definition of impossible face coincides with the previous one. W e no w prov e our general c haracterization. A go o d emb e dding of a partitioned up ward plane digraph is an up ward em b edding ( E , λ ) that is 4-mo dal and that is such that no face of E is imp ossible. ▶ Theo rem 3. L et G = ( V , L ∪ R ) b e a p artitione d upwar d plane digr aph and let ( E , λ ) b e the upwar d emb e dding of G . Then G admits an upwar d b o ok emb e dding r esp e cting ( E , λ ) if and only if ( E , λ ) is a go o d emb e dding. Pro of. W e first assume that G is connected. W e will get rid of this assumption later. W e start b y pro ving the necessit y . Prop erty 1 ensures the necessity of the 4-mo dality of E . Next, consider an up ward b o ok embedding Γ of G resp ecting ( E , λ ) and suppose, for a con tradiction, that a face f of E is impossible. After p ossibly horizon tally mirroring the up w ard b o ok embedding and swapping the left edges with the righ t edges, we ma y assume without loss of generality that L f con tains a path ℓ f with the following properties. First, ℓ f consists of edges in R . Second, the rest of the b oundary of f , say p f , is not a single edge. Third, let u and v b e the source and sink of ℓ f , resp ectiv ely , let e u f and e v f b e the edges of ℓ f inciden t to u and v , resp ectively; then the angle α u in f inciden t to u and to the right of e u f and the angle α v in f inciden t to v and to the righ t of e v f are small. Let w and z b e the v ertices adjacen t to u and v , resp ectiv ely , such that the edge ( u, w ) follo ws the edge e u f in clo c kwise order around u and the edge ( z , v ) follo ws the edge e v f in coun ter-clo c kwise order around v . Note that w = z migh t happ en, how ev er w = v and z = u , giv en that p f is not a single edge. Since ℓ f only consists of edges in R , its represen tation in Γ lies entirely to the righ t of the spine of Γ , except at its vertices; also, b y the 4-mo dality of E , the edges ( u, w ) and ( z , v ) are in R . Since Γ is an upw ard planar dra wing, the order of the vertices of ℓ f along the spine is the same as their order in ℓ f , with u b elo w v ; also, w lies ab o ve u and z b elo w v . If an y of w and z lies in the strip S uv delimited b y the horizon tal lines through u and v , then a con tradiction can b e reached as in the pro of of Theorem 2 , giv en that, b ecause of the up w ard em b edding ( E , λ ) whic h forces α u and α v to b e small, the edges ( u, w ) and ( v , z ) ha v e to be to the righ t of e u f and e v f , resp ectively . How ev er, no p oint of the spine lies to the righ t of ℓ f and in the strip S uv . It follo ws that w has to lie abov e v and z b elo w u . This, ho w ever, implies that the edges ( u, w ) and ( z , v ) cross each other, giv en that they are b oth dra wn to the right of the spine. This contradiction completes the proof of necessit y . W e next pro ve the sufficiency . In order to do that, w e sho w that it is p ossible to augment G and its up ward em b edding ( E , λ ) , resp ectiv ely , to a partitioned plane st -graph and to a goo d em b edding of it. Then Theorem 2 implies that the augmented graph admits an up w ard b o ok em b edding resp ecting its upw ard embedding, from whic h one can obtain an up ward b o ok embedding of G resp ecting ( E , λ ) by ignoring the v ertices and edges added for the augmen tation. The augmentation consists of tw o steps. In Step 1 , we augment G and ( E , λ ) G. Da Lozzo, F. F rati, and I. Rutter 13 a d b c G H s (a) w f v u (b) w v u z (c) Figure 6 Illustrations for the pro of of Theorem 3 . (a) Upw ard embedding ( E H , λ H ) of the partitioned up ward plane digraph H obtained from G in Step 1 . (b)-(c) A ugmentation of a face f with a large angle in an upw ard em b edding ( E , λ ) to obtain the up ward embedding ( E ′ , λ ′ ) in Step 2 . so that the outer face is an st -face. In Step 2 , we adopt a mo dified v ersion of the pro cedure describ ed b y Bertolazzi et al. [ 16 ] to augmen t any up ward plane digraph to a plane st -graph, while main taining the upw ard embedding. Step 1. W e first augmen t G = ( V , L ∪ R ) and its up ward embedding ( E , λ ) to a partitioned up w ard plane digraph H = ( V ∪ { a, b, c, d } , L ∪ { ( a, c ) , ( a, d ) } , R ∪ { ( a, b ) , ( b, c ) , ( d, s ) } , where s is an y source of G that is inciden t to the outer face of E and that has a large angle in the outer face (refer to Fig. 6a ); since λ is up ward-consisten t, such a source s exists, as otherwise ev ery switc h angle at a v ertex v delimited b y tw o edges outgoing from v w ould be small, and the sum of the v alues assigned by λ to the angles incident to the outer face could not b e +2 . W e also augmen t ( E , λ ) to an upw ard embedding ( E H , λ H ) of H as follows. First, the planar embedding E H of H has the following properties: (i) the outer face of E H is delimited b y the cycle ( a, b, c ) ; (ii) the restriction of E H to G coincides with E ; (iii) the clo ckwise order of the edges incident to a is ( a, c ) , ( a, d ) , ( a, b ) ; also, the edge ( d, s ) is inciden t to s in the outer face of E . Second, the angle assignment λ H has the following prop erties: (i) λ H assigns the same v alue as λ to every angle of E H that is also an angle of E ; (ii) λ H assigns 0 to all angles incident to b and d ; (iii) λ H assigns 1 to the angles at a and c inciden t to the outer face of E H and − 1 to all other angles at a and c ; and (iv) λ H assigns 0 to the angles at s incident to the edge ( d, s ) . W e first sho w that ( E H , λ H ) is an up ward em b edding of H . T o this end, w e start by observing that ( E H , λ H ) is 4-mo dal and in particular it is bimo dal. Then, by Theorem 1 , it remains to prov e that λ H is up w ard-consisten t. W e pro ve that λ H satisfies Condition C1 . This condition is verified for ev ery angle that is also an angle of E , since λ is upw ard-consistent and λ H assigns the same v alue as λ to ev ery angle of E H that is also an angle of E . The angles at a and c are all assigned with a v alue different from 0 and indeed none of them is flat. Each angle at b or d is assigned the v alue 0 and indeed it is flat. Finally , the angles at s inciden t to ( d, s ) are b oth assigned the v alue 0 and eac h of them is flat, since s is a source in G and ( d, s ) is incoming in to s . 14 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs W e pro ve that λ H satisfies Condition C2 . This condition is verified for ev ery vertex not in { a, b, c, d, s } , since λ is upw ard-consistent and λ H assigns the same v alue as λ to every angle of E H that is also an angle of E . The tw o angles at c are assigned a − 1 and a +1 , hence their sum is 0 , whic h equals 2 − deg ( c ) . The t wo angles at eac h of b and d are assigned v alue 0 , whic h is equal to 2 min us their degree. The t w o angles at a inciden t to in ternal faces of E H are both assigned v alue − 1 , whereas the angle at a inciden t to the outer face of E H is assigned v alue +1 . Hence, the sum of these v alues is − 1 , whic h is equal to 2 − deg ( a ) . Finally , the angles at s inciden t to ( d, s ) are b oth assigned the v alue 0 , and all the other angles are assigned the v alue − 1 ; the sum of these v alues is hence equal to 2 − deg ( s ) . Finally , w e prov e that λ H satisfies Condition C3 . This condition is v erified for every face of E H that is also a face of E , since λ is up ward-consisten t and λ H assigns the same v alue as λ to every angle of E H that is also an angle of E . Also, the angles inciden t to the outer face of E H at a and c are assigned the v alue +1 , and the angle incident to the outer face of E H at b is assigned with the v alue 0 , hence the sum of these v alues is 2 , as required b y Condition C3 . It remains to discuss the condition for the in ternal face f in of E H inciden t to the v ertex d . W e distinguish three sets of angles incident to f in . The set A 1 con tains the angles of f in that are also angles in the outer face f o of E ; b y construction, the angles in A 1 are assigned b y λ H the same v alue as λ . Notice that A 1 con tains all the angles of E inciden t to f o , except for the angle σ at s , whic h by assumption is assigned v alue +1 by λ . The set A 2 con tains the fiv e angles of f in inciden t to b , d , and s , eac h of whic h is assigned the v alue 0 . Finally , the set A 3 con tains the three angles of f in inciden t to a and c , eac h of which is assigned the v alue − 1 . It follo ws that P a ∈ A E H ( f in ) λ H ( a ) = P a ∈ A 1 λ ( a ) − λ ( σ ) + 0 · | A 2 | − 1 · | A 3 | = 2 − 1 + 0 − 3 = − 2 . This concludes the pro of that ( E H , λ H ) is an upw ard embedding of H . In order to conclude the discussion of Step 1, since ( E H , λ H ) is 4-mo dal, it remains to pro v e that no face of E H is impossible. Ev ery face of E H that is also a face of E is not imp ossible, since ( E , λ ) is a goo d em b edding. By construction, the outer face of E H is an st -face and it is not imp ossible since its left path is an edge in L . Finally , consider the face f in . W e distinguish four t yp es of maximal directed paths on the b oundary of f in . First, the maximal directed paths that comprise the path ( a, d, s ) contain at least one left edge, namely ( a, d ) , and at least one right edge, namely ( d, s ) , hence they cannot mak e f in imp ossible. Second, the maximal directed path ( a, c ) has f in to its right and it consists of a left edge, hence it cannot make f in imp ossible. Similarly , the maximal directed path ( a, b, c ) has f in to its left and it consists of t wo right edges, hence it cannot make f in imp ossible. Finally , ev ery remaining maximal directed path inciden t to f in is composed entirely of edges of G . Then such a path does not mak e f in imp ossible, since the outer face f o of E is not imp ossible. Step 2. After Step 1 , we rename H and ( E H , λ H ) to G and ( E , λ ) , resp ectively , where the outer face of G in E is an st -face. W e now show that G and ( E , λ ) can be augmented, b y adding v ertices and edges, to a partitioned plane st -graph G + with a goo d embedding ( E + , λ + ) . This concludes the pro of (for connected digraphs), as then, b y Theorem 2 , we ha v e that G + admits an up war d bo ok embedding resp ecting ( E + , λ + ) , and the restriction of such an upw ard b o ok em b edding to G is an upw ard bo ok em b edding of G resp ecting ( E , λ ) . W e pro v e that G and ( E , λ ) ha ve the claimed augmen tation by induction on the n umber S of switc hes of G . F or the base case, we ha ve S = 2 , hence G is a partitioned plane st -graph and th us it suffices to set G + = G and ( E + , λ + ) = ( E , λ ) , since ( E , λ ) is a goo d em b edding, b y assumption. G. Da Lozzo, F. F rati, and I. Rutter 15 If S > 2 , then there are at least three large angles in ( E , λ ) . Since the outer face is an st -face, it has exactly t wo large angles and hence there exists an internal face f of E that con tains a large angle. Then Bertolazzi et al. [ 15 ] sho wed that f con tains three switc h angles that are consecutive in the clo ckwise order of the switch angles around f and that are small, small, and large, resp ectively (see Fig. 6b ). Let u , w , and v b e the vertices the three angles are incident to, respectively , and note that v is a switch of G . W e assume that v is a source, the case in which it is a sink is analogous. Let ˜ G b e the up w ard plane digraph obtained b y adding the edge ( u, v ) to G ; also, let ˜ E b e the planar em b edding obtained from E b y adding the edge ( u, v ) inside f ; finally , let ˜ λ b e the upw ard-consisten t angle assignment obtained from λ b y defining the tw o angles incident to ( u, v ) at u to b e small and the t wo angles inciden t to ( u, v ) at v to b e flat. Bertolazzi et al. [ 15 ] sho wed that ( ˜ E , ˜ λ ) is indeed an upw ard embedding of ˜ G . Note that ˜ G has one less switc h than G , as v is not a source in ˜ G , whic h w ould allow induction to b e applied. Unfortunately , adding ( u, v ) to either of the parts L or R of the edge set of G ma y result in an imp ossible face or in a violation of the 4-mo dality . T o remedy this, w e create a partitioned up ward plane digraph G ′ with up ward em- b edding ( E ′ , λ ′ ) from ˜ G and ( ˜ E , ˜ λ ) by additionally sub dividing the edge ( u, v ) with a new v ertex z whose inciden t angles are b oth flat (see Fig. 6c ); we assign the edge ( u, z ) to the same partition ( L or R ) as the edge that follows it in clo ckwise order around u and we assign the edge ( z , v ) to the other partition. Clearly , that ( E ′ , λ ′ ) is an up ward em b edding of G ′ still comes from the result by Bertolazzi et al.; moreov er, the choice of the partition for ( u, z ) ensures that u remains 4-modal and, since ( z , v ) is the sole incoming edge at v , the 4-modality of v is also preserved. It remains to pro ve that ( E ′ , λ ′ ) has no imp ossible face. Assume, for the sake of con tradiction, that there exists an impossible face g in ( E ′ , λ ′ ) . Since ( E , λ ) con tains no imp ossible face, it follows that g m ust b e one of the tw o faces that are inciden t to the new vertex z . Let p g b e a maximal directed path on the boundary of g that satisfies the conditions in the definition of imp ossible face. Note that p g cannot contain the path ( u, v , z ) , whic h con tains b oth an edge in L and an edge in R , whereas p g is either comp osed entirely of edges in L or of edges in R . Hence, p g is part of the b oundary of f . Since the rest of the b oundary of f con tains at least as many v ertices as the rest of the b oundary of g and since the augmen tation of ( E , λ ) to ( E ′ , λ ′ ) has only split a small angle (at u ) into t wo small angles and a large angle (at v ) into t wo flat angles, it follo ws that f is an imp ossible face, a contradiction. Since G ′ has one less switc h than G , this concludes the induction and hence the pro of for the case in which G is connected. The disconnected case. W e now discuss the case in whic h G is not connected. Let G 1 , . . . , G k b e the connected comp onen ts of G , for some in teger k ≥ 2 , and let ( E i , λ i ) b e the up ward em b edding of G i whic h is the restriction of ( E , λ ) to G i , for i = 1 , . . . , k . The proof of the necessity of the characterization uses t wo facts additional to the argumen ts presen ted for the connected case. On the one hand, the 4-modality of the upw ard em b edding ( E , λ ) b oils do wn to the 4-mo dalit y of the up ward embeddings ( E i , λ i ) , whose necessit y w e already pro ved. On the other hand, it might b e the case that ( E i , λ i ) do es not con tain an y imp ossible face, for i = 1 , . . . , k , and y et ( E , λ ) do es. This happ ens if and only if an internal face f of the planar embedding E i of a connected comp onent G i of G satisfies the follo wing prop erties. First, the planar em b edding E places a connected component G j of G with j = i in f . Second, f is an st -face suc h that its left b oundary ℓ f is composed of edges in R and its right b oundary is a single edge (also in R ), or its righ t b oundary r f is 16 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs comp osed of edges in L and its left b oundary is a single edge (also in L ). Note that f is not an imp ossible face in ( E i , λ i ) , but the face f E of E corresp onding to f is imp ossible in ( E , λ ) , as the rest (with respect to ℓ f or r f , resp ectively) of the b oundary of f E is not a single edge, giv en that it comprises the b oundary of the outer face of E j . The characterization correctly handles this situation, since in any up ward b o ok embedding of G i resp ecting ( E i , λ i ) , no part of the spine lies inside f , hence the placement of G j inside f demanded by ( E , λ ) is not p ossible. The necessit y of not ha ving any impossible face follows. The sufficiency of the c haracterization can be prov ed as follo ws. W e start by constructing an upw ard b o ok embedding Γ i of G i resp ecting ( E i , λ i ) , for i = 1 , . . . , k , as describ ed in the connected case. W e now insert the upw ard bo ok em b eddings Γ i in to an (initially empty) up w ard b o ok embedding Γ one b y one. In particular, we insert into Γ an upw ard bo ok em b edding Γ i of a comp onen t G i once every comp onent that has to con tain G i in an in ternal face is already part of Γ . When Γ i is inserted in Γ , the face f of the curren t em bedding in whic h it needs to b e inserted con tains in its interior in Γ a portion of the spine, since the face of E corresp onding to f is not imp ossible. Then the v ertices of G i can b e placed consecutiv ely in a portion of the spine inside f , thus inserting Γ i in to Γ . Ev entually , this results in an upw ard b o ok embedding Γ of G resp ecting ( E , λ ) . This concludes the pro of of the sufficiency and of the characterization. ◀ 4 Computational Complexit y with V a riable Emb edding In this section we study the complexity of testing whether a partitioned digraph admits an up w ard b o ok embedding. W e sho w that the problem is NP -complete. Our hardness proof exploits the characterization of Theorem 3 and the NP -hardness of Upw ard Planarity Testing . ▶ Theo rem 4. It is NP -c omplete to de cide whether a p artitione d planar digr aph G = ( V , L ∪ R ) admits an upwar d b o ok emb e dding. Pro of. Clearly , the problem is in NP . In order to pro ve NP -hardness, w e giv e a reduction from Upw ard Planarity Testing , whic h w as pro ved to be NP -hard by Garg and T amassia [ 47 ]. Giv en a planar digraph G = ( V , E ) , we construct a partitioned digraph G ′ = ( V ′ , L ∪ R ) as follo ws. Subdivide each edge e ∈ E with a new vertex v e ; these subdivision vertices, together with the vertices in V , form V ′ . The edge set L consists of the edges outgoing from v ertices in V (and incoming into v ertices in V ′ \ V ), and the edge set R consists of the remaining edges. Clearly , G ′ can b e constructed from G in p olynomial time. It remains to show that G ′ admits an upw ard b o ok embedding if and only if G admits an upw ard planar drawing. F or the necessity , observe that an up ward b o ok embedding Γ ′ of G ′ is an upw ard planar dra wing of G ′ . Then an upw ard planar drawing Γ of G is obtained from Γ ′ b y (i) placing eac h v ertex of G in Γ as in Γ ′ and b y (ii) dra wing in Γ eac h edge e = ( u, w ) of G as the Jordan arc formed by the union of the dra wings of ( u, v e ) and of ( v e , w ) in Γ ′ . F or the sufficiency , supp ose that G admits an upw ard planar dra wing Γ . Then an upw ard planar drawing Γ ′ of G ′ can b e constructed from Γ b y placing each subdivision v ertex v e at an y internal point of the Jordan arc represen ting the edge e . Let ( E ′ , λ ′ ) b e the up ward em b edding corresp onding to Γ ′ . W e pro v e that ( E ′ , λ ′ ) is 4-mo dal. Consider any vertex v of G ′ . If v / ∈ V , then v has one incoming and one outgoing edge in G ′ , hence it is trivially 4-mo dal. If v ∈ V then, b y construction, all the edges outgoing from v , if any , are in L and are consecutiv e in the clo ckwise order of the edges incident to v , due to the bimodality of the planar em b edding of G corresp onding to Γ . Similarly , all the edges incoming into v , if G. Da Lozzo, F. F rati, and I. Rutter 17 an y , are in R and are consecutiv e in the clo ckwise order of the edges inciden t to v . It follo ws that v is 4-modal. Finally , ( E ′ , λ ′ ) has no imp ossible face, since b y construction an y maximal directed path in the boundary of an y face con tains b oth an edge in L and an edge in R . Hence, ( E ′ , λ ′ ) is a goo d em b edding. By Theorem 3 , w e ha ve that G ′ admits an upw ard bo ok em b edding resp ecting ( E ′ , λ ′ ) . ◀ Upw ard Planarity Testing is known to b e W[1]-hard with resp ect to the treewidth [ 60 ]. Also, the reduction shown in Theorem 4 constructs a graph whic h is a sub division of the original instance of Upw ard Planarity Testing . Since any t wo graphs, one of which is a sub division of the other one, hav e the same treewidth, we get the follo wing. ▶ Co rollary 5. It is W[1]-har d with r esp e ct to the tr e ewidth to de cide whether a p artitione d digr aph G = ( V , L ∪ R ) admits an upwar d b o ok emb e dding. F urthermore, b y sub dividing the edges t wice, rather than once, so that edges incident to v ertices in V are in L and the other edges in R , the reduction giv es an instance in which one color induces a matching and the other one a forest of stars. This is in sharp con trast with the fact that the problem is solv able in linear time when b oth edge parts are matchings [ 1 ]. 5 T est fo r Graphs with a Fixed Plana r Emb edding In this section w e sho w how to exploit the c haracterization of Theorem 3 in order to prov e that, for an n -v ertex partitioned plane digraph G with a giv en planar embedding E , it can b e tested in O ( n log 3 n ) time whether G admits an upw ard b o ok embedding resp ecting E . W e start b y reviewing a tool for testing whether G admits an up ward planar dra w- ing Γ resp ecting E , assuming that G is connected; we will remov e this assumption later. By Theorem 1 , the bimo dality of E is a necessary condition for the existence of Γ . Since the bimo dalit y of E can b e easily tested in O ( n ) time, in the following w e assume that E is indeed bimo dal. Then, again by Theorem 1 , the existence of Γ is equiv alent to the existence of an up w ard-consisten t angle assignment λ for E . In order to test for the existence of λ , Bertolazzi et al. [ 15 ] prop osed the following strategy 2 . A flow network N is a directed graph such that each source is asso ciated with a non-negativ e v alue, called supply , each sink is associated with a non-negative v alue, called demand , and each edge a is associated with a non-negative v alue c a , called c ap acity . V ertices and edges of a flo w netw ork are usually called no des and ar cs , respectively . A flow is an assignment of a v alue ϕ a to each arc a of N ; the v alue ϕ a is called the flow assigne d to a . A flo w is fe asible if: (i) the flo w assigned to each arc a of N is at most its capacit y: ϕ a ≤ c a ; (ii) the sum of the flo ws assigned to the arcs outgoing each source s of N do es not exceed the supply of s ; (iii) the sum of the flo ws assigned to the arcs incoming into eac h sink t of N do es not exceed the demand of t ; and (iv) the sum of the flo ws assigned to the arcs incoming into each non-switc h no de of N is equal to the sum of the flows assigned to the arcs outgoing from the same no de. The value of a flo w is the sum of the flo ws assigned to the arcs incoming into the sinks (or, equiv alently , outgoing from the sources). Starting from the plane digraph G with planar embedding E , one can construct a planar flo w net w ork N , as illustrated in Fig. 7 , where: 2 Our description of the strategy differs slightly from the one by Bertolazzi et al. [ 15 ], as they assume G to b e triconnected (and thus, that each v ertex is inciden t to a face at most once in E ), while w e do not. 18 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs angle a switch v face f face g face h face l (a) w a s v t h t l t f t g (b) Figure 7 (a) An up ward planar dra wing Γ of an upw ard plane digraph G ; only large and small switc h angles at switc hes of G are depicted (as red and green sectors of discs cen tered at switch v ertices, resp ectively). (b) The net w ork N constructed from G and its planar embedding; for con v enience, the edges of G , whic h are not part of N , are drawn as gra y dashed curves. Arcs of N tra v ersed by the flo w are red, whereas arcs with no flow are green. for each switc h v of G , the netw ork N con tains a source s v that supplies a single unit of flo w; for eac h face f of E , the net work N con tains a sink t f that demands a num b er of units of flo w equal to n f / 2 − 1 or n f / 2 + 1 , depending on whether f is an internal face or the outer face of E , resp ectively (where n f is the num b er of switch angles inciden t to f ); for eac h angle α in E at a switc h of G , the netw ork N con tains a node w α ; and the netw ork N con tains an arc from eac h source s v to each no de w α suc h that the angle α is incident to v in E and an arc from eac h no de w α to each sink t f suc h that the angle α is inciden t to f in E ; all such arcs ha ve a capacit y of a single unit of flow. It w as pro ved in [ 15 ] that there exists an up w ard-consisten t angle assignmen t λ for E if and only if N admits a feasible flow whose v alue is the sum d T of the demands of the sinks in N (or, equiv alently , the sum of the supplies of the sources in N ). More precisely , upw ard-consistent angle assignmen ts and (integral) feasible flows with v alue d T are in bijection 3 : 1. If an angle assignment λ is upw ard-consistent then one can get a feasible flow for N with v alue d T b y assigning flo w 1 to each arc inciden t to a no de w α suc h that the angle assigned to α by λ is large, and b y assigning flow 0 to all other arcs. 2. If a feasible flo w for N has v alue d T , then one can get an up w ard-consistent angle assignmen t λ b y assigning a large angle to each switch angle α suc h that the arcs incident to no de w α are assigned one unit of flo w, and b y assigning a small angle to all other switc h angles. T esting whether G admits an up ward planar dra wing Γ resp ecting E then becomes equiv alent to testing whether N admits a flow whose v alue is d T . An algorithm solving this problem in O ( n log 3 n ) time is kno wn [ 26 ], whic h giv es the running time of the b est known up w ard planarit y testing algorithm with fixed planar embedding. 3 This statement assumes that the flow assigned to each arc is integer. This is not a loss of generality , since, in a net work with integer supplies, demands, and capacities, a non-integer feasible flow with in teger v alue can alwa ys be transformed into an integer feasible flo w with the same v alue. G. Da Lozzo, F. F rati, and I. Rutter 19 In a nutshell, our idea is to modify N so that there exists an up w ard-consistent angle assignmen t λ for E suc h that ( E , λ ) is a go o d embedding (i.e., suc h that G admits an up ward b o ok embedding resp ecting ( E , λ ) , b y Theorem 3 ) if and only if N admits a feasible flow whose v alue is d T . As in the result by Bertolazzi et al. [ 15 ], the correspondence is actually stronger, as we sho w in the pro of of Theorem 6 that, if G is connected, the integral feasible flo ws with v alue d T for the mo dified net work are in bijection with the upw ard-consistent angle assignmen ts λ for E suc h that ( E , λ ) is a goo d embedding. W e sho w an algorithm, called N -modifier , that p erforms a sequence of mo difications to N . Along the wa y , N -modifier migh t stop and conclude that G admits no upw ard b o ok embedding resp ecting E . The N -modifier algorithm. W e start by describing the mo difications to N that N - modifier p erforms in order to ensure 4-mo dality . Consider any v ertex v of G . If v is not a switch, then its 4-mo dality does not dep end on the angle assignmen t. Then N -modifier chec ks whether in E , in clo ckwise order around v , we ha ve all the outgoing left edges, then all the outgoing right edges, then all the incoming right edges, and finally all the incoming left edges, where one of the former tw o sets and/or one of the latter tw o sets might be empty . If the test is negativ e, N -modifier concludes that G admits no up w ard bo ok embedding resp ecting E . Otherwise, the pro cessing of v is concluded. v angle α e e ′ face f (a) e e ′ w α s v (b) e e ′ w α s v (c) Figure 8 Modification of N to ensure 4 -modality . (a) A v ertex v that has both outgoing left edges and outgoing right edges. (b) The part of N close to v (the edges of G do not belong to N , but they are sho wn to maintain a visual reference with (a)). (c) Modification of N that remo ves all neigh b ors of s v differen t from w α . If v is a switch, assume it is a source; if v is a sink its pro cessing is analogous. Then N -modifier c hecks whether in E , the outgoing left edges and thus also the outgoing righ t edges are consecutive, where one of the t wo sets might be empty . If the test is negativ e, N -modifier concludes that G admits no upw ard b o ok em b edding resp ecting E . If the test is positive and v do es not ha v e any outgoing left edges or an y outgoing right edges, the processing of v is concluded. If the test is p ositive, and v has b oth outgoing left edges and outgoing righ t edges, we mo dify N as follows; refer to Fig. 8 . Let e b e the left edge outgoing from v suc h that the edge e ′ preceding e in clockwise order around v is a right edge, let α b e the angle ( e, e ′ ) , and let f b e the face to the left of e . F or eac h angle β = α inciden t to v in E , the algorithm N -modifier remo v es w β and its inciden t arcs from N . This modification corresp onds to forcing the arc ( s v , w α ) to b e assigned one unit of flow, hence making α large. W e next describ e the mo difications N -modifier applies to N in order to ensure that the up w ard embeddings corresp onding to the feasible flows of N with v alue d T do not con tain an y imp ossible face. Consider any face f of E . Also, consider any maximal directed path ℓ f in the boundary of f that has f to its righ t (the treatment of the maximal directed paths 20 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs that ha ve f to their left is analogous). If ℓ f con tains a left edge or if the rest of the boundary of f is a single edge, then the processing of ℓ f is concluded. Otherwise, let u and v b e the extremes of ℓ f , let e u f and e v f b e the edges of ℓ f inciden t to u and v , let α u f b e the angle in f inciden t to u and to the right of e u f , and let α v f b e the angle in f inciden t to v and to the righ t of e v f . By Theorem 3 , the angle assignmen t needs to ensure that at least one of the angles α u f and α v f is large. Since ℓ f is a maximal directed path, b oth α u f and α v f are switc h angles. W e sa y that α u f (resp. α v f ) is enlar ge able if the no de w α u f (resp. the no de w α v f ) is in N . Note that, even if u (resp. v ) is a switch of G , it might be that w α u f (resp. w α v f ) is not in N , b y the effect of some previous modification of N . W e thu s distinguish three cases. If neither α u f nor α v f is enlargeable, then N -modifier concludes that G admits no upw ard b o ok embedding resp ecting E . If exactly one of α u f and α v f is enlargeable, sa y α u f is enlargeable and α v f is not, then N - modifier modifies N as follo ws: F or eac h angle β = α u f inciden t to u in E , the algorithm N -modifier remo ves w β and its inciden t arcs from N . This mo dification corresp onds to forcing the arc ( s u , w α u f ) to b e assigned one unit of flow, hence making α u f large. Finally , consider the situation in which b oth α u f and α v f are enlargeable; refer to Fig. 9 . If the degree of s u or s v in N is one, that is, if there exists no angle β = α u f inciden t to u suc h that the corresponding no de w β is in N , or there exists no angle β = α v f inciden t to v suc h that the corresp onding no de w β is in N , then the pro cessing of ℓ f is concluded. Indeed, it is already guaranteed that one of α u f and α v f will b e a large angle. face f ℓ f s u s v e v f e u f α v f α u f t f w α v f w α u f (a) face f ℓ f s u s v e v f e u f α v f α u f t f w α v f w α u f t uv f (b) Figure 9 Mo dification to N to a void imp ossible faces determined by a maximal directed path ℓ f comp osed of right edges that has the face f on its right, when b oth angles α u f and α v f at the extremes u and v of ℓ f , resp ectiv ely , are enlargeable and the degree of b oth s u and s v in N is greater than one. The part of N asso ciated with f before (a) and after (b) the mo dification. Otherwise, N -modifier adds to N a sink t uv f with demand 1 , as well as arcs ( w α u f , t uv f ) and ( w α v f , t uv f ) , eac h with capacity 1 , and decreases b y 1 the demand of t f . This mo difi- cation to N corresp onds to forcing one of ( w α u f , t uv f ) and ( w α v f , t uv f ) (and consequen tly one of ( s u , w α u f ) and ( s v , w α v f ) ) to b e assigned one unit of flow, hence making large the angle α u f or the angle α v f , respectively . Note that N remains a planar flo w net- w ork. Also, if ( w α u f , t uv f ) (resp. ( w α v f , t uv f ) ) is not assigned one unit of flo w, then ( w α u f , t f ) (resp. ( w α v f , t f ) ) migh t b e assigned one unit of flow, th us making large b oth α u f and α v f . W e are no w ready to state our result for plane digraphs. G. Da Lozzo, F. F rati, and I. Rutter 21 ▶ Theo rem 6. L et G = ( V , L ∪ R ) b e an n -vertex p artitione d plane digr aph with planar emb e dding E . It is p ossible to test in O ( n log 3 n ) time whether G admits an upwar d b o ok emb e dding r esp e cting E . Pro of. W e start b y considering instances suc h that G is connected. The core of the pro of consists of pro ving the aforementioned bijection betw een the feasible flo ws with v alue d T of the net w ork constructed b y the algorithm N -modifier and the upw ard-consisten t angle assignmen ts λ suc h that ( E , λ ) is a go o d embedding (below w e state suc h a bijection precisely). Then Theorem 3 implies that the existence of an upw ard b o ok em b edding of G resp ecting E is equiv alent to the fact that N -modifier b oth 1) did not conclude that G admits no upw ard b o ok em b edding respecting E and 2) constructed a planar flo w netw ork N that has a feasible flo w with v alue d T . Since N -modifier can b e easily implemented to run in O ( n ) time and since the algorithm b y Borradaile et al. [ 26 ] to test whether N admits a feasible flo w with the required v alue runs in O ( n log 3 n ) time, the theorem follows. Notation. W e in tro duce some notation. Supp ose first that N -modifier did not conclude that G admits no upw ard b o ok em b edding resp ecting E . Let N 0 b e the flow net w ork constructed b y Bertolazzi et al. [ 15 ]. Recall that, in a first phase, N -modifier considers the v ertices of G in some order, performs some chec ks, and p ossibly mo difies the flo w net w ork so to ensure the 4-mo dality of the v ertices. F or i = 1 , . . . , n , denote by N i the flo w netw ork constructed by N -modifier after considering the i -th vertex of G so to ensure its 4-modality . If N -modifier did not modify the flow netw ork when considering the i -th v ertex of G , then N i is the same net w ork as N i − 1 . In a second phase, N -modifier considers the maximal directed paths on the boundary of the faces (let p b e the num b er of such paths), p erforms some c hecks, and possibly mo difies the flo w netw ork so to ensure the absence of imp ossible faces. F or i ∈ { n + 1 , . . . , n + p } , denote b y N i the flo w netw ork constructed by N -modifier after considering the ( i − n ) -th maximal directed path on the b oundary of some face of E . If N -modifier did not mo dify the flow net work when considering suc h a path, then N i is the same netw ork as N i − 1 . If the algorithm did conclude that G admits no up w ard b o ok embedding resp ecting E , then the notation for the flo w netw orks constructed b y N -modifier is restricted to the net works constructed b efore the termination. Let N k b e the last constructed netw ork ( k = n + p if N -modifier did not conclude that G admits no up w ard b o ok embedding resp ecting E , and k < n + p otherwise). F or any i ∈ { 0 , 1 , . . . , k } , let V i b e the set of the first min { i, n } v ertices pro cessed b y N -modifier and let P i b e the set of the first max { i − n, 0 } maximal directed paths pro cessed by N -modifier. Structure. W e make some observ ations on the structure of the netw orks N 0 , N 1 , . . . , N k . Demand pr eservation. The sum of the demands of the sinks and the sum of the demands of the sources is the same v alue, which w e denote b y d T , in all the net works N 0 , N 1 , . . . , N k . Outgoing ar cs for angle no des. Any node w α corresp onding to a switch angle α in a net w ork N i , for some i ∈ { 0 , . . . , k } , has an outgoing arc to the sink t f corresp onding to the face f of E angle α is incident to. Also, w α has at most one more outgoing arc; suc h an arc, if it exists, is directed tow ards a sink asso ciate d with t f that is in tro duced when pro cessing a path in the b oundary of f . Concerning prop ert y demand pr eservation , note that whenever N -modifier mo difies the sinks and their demands, it decreases the demand of a sink t f b y 1 and in tro duces a sink t uv f asso ciated with t f with demand 1 . Th us the sum of the demands of the sinks remains the same. Also, the algorithm nev er modifies the sources and their supplies. In order to prov e property outgoing ar cs for angle no des , consider a no de w α corresp onding to a switc h angle α in a net work N i , for some i ∈ { 0 , . . . , k } . Let v and f b e the v ertex 22 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs of G and the face of E inciden t to the angle α , respectively . First, w α has an outgoing arc to the sink t f corresp onding to f . Indeed, if N -modifier remov ed the arc ( w α , t f ) from a net work N j , for some j < i , then it also remo ved the v ertex w α , whic h contradicts the assumption that w α b elongs to N i . Second, we prov e that w α has at most one more outgoing arc and that suc h an arc, if it exists, is directed to wards a sink associated with t f . Recall that v is a switc h in G . Assume it is a sink, the case in which it is a source is analogous. The algorithm N -modifier inserts an arc outgoing w α in a netw ork N j with j < i only if: there exists a maximal directed path ℓ f in the b oundary of f that ends at v , is en tirely comp osed of righ t edges, has f to its righ t, and the angle in f to the righ t of the last edge of ℓ f is α ; or there exists a maximal directed path r f in the b oundary of f that ends at v , is en tirely comp osed of left edges, has f to its left, and the angle in f to the left of the last edge of r f is α . It remains to observ e that if b oth the ab ov e paths ℓ f and r f exist, then α is delimited b y a righ t and a left edge; refer to Fig. 10 . Hence, in order to ensure the 4-mo dality of v , the algorithm N -modifier w ould ha v e remov ed from the netw ork all the no des corresp onding to angles incident to v , except for α . Thus, it w ould not hav e introduced any new sink asso ciated with t f when pro cessing paths ℓ f and r f . v ℓ f r f t f face f angle α w α (a) v ℓ f r f t f face f angle α w α (b) Figure 10 Illustration for the pro of of property outgoing ar cs for angle no des in the case in which there exists paths ℓ f and r f that ha ve a common face f to their right and left, respectively , and are directed to ward a sink v of G . The net work N b efore (a) and after (b) applying the transformation that ensures the 4 -mo dality of v . Corresp ondence. Consider an upw ard-consistent angle assignmen t λ for E and consider a net w ork N i with i ∈ { 0 , 1 , . . . , k } . W e define a corresponding flow F λ ( N i ) as follo ws. F or eac h angle α of E that is assigned a large angle by λ , consider the node w α (if it is in N i ). Then F λ ( N i ) assigns flow 1 to the unique arc incoming into w α . By prop ert y outgoing ar cs for angle no des , w α has either one or tw o outgoing arcs. If w α has one outgoing arc, then F λ ( N i ) assigns flow 1 to it. If w α has tw o outgoing arcs, then one of them is directed to the sink t f corresp onding to the face f angle α is inciden t to, and one of them is directed to a sink t uv f asso ciated with t f . If an arc incoming in to t uv f has already b een assigned flo w 1 , then F λ ( N i ) assigns flow 1 to the arc ( w α , t f ) , otherwise it assigns flo w 1 to the arc ( w α , t uv f ) . After pro cessing all angles of E that are assigned a large angle b y λ , F λ ( N i ) assigns flo w 0 to all G. Da Lozzo, F. F rati, and I. Rutter 23 arcs of N i that are not assigned flow 1 . Since all arcs of N i ha v e capacit y 1 , obviously F λ ( N i ) is feasible. Ho wev er, we will need to pro v e that the v alue of F λ ( N i ) is d T . Con v ersely , consider a feasible flo w F for a netw ork N i with i ∈ { 0 , 1 , . . . , k } . W e define a corresponding angle-assignment λ F for E as follo ws. W e hav e that λ F assigns 0 to ev ery flat angle of E . Also, it assigns 1 to a switc h angle α at a v ertex v if and only if v is a switc h in G , the node w α is in N i , and the arc ( s v , w α ) is assigned one unit of flow by F . Finally , it assigns − 1 to every switc h angle α that is not assigned flow 1 . Bijection. The bijection is formalized as follo ws. F or an y i ∈ { 0 , 1 , . . . , k } , w e hav e that: 1. If an angle assignment λ for E is up w ard-consisten t and the up ward em b edding ( E , λ ) is suc h that the vertices in V i are 4-mo dal and the paths in P i do not cause an imp ossible face, then N -modifier do es not conclude that G admits no up ward b o ok embedding resp ecting E when processing these v ertices and paths. Also, the flo w F λ ( N i ) has v alue d T . 2. If N -modifier do es not conclude that G admits no upw ard bo ok embedding respecting E when processing the v ertices in V i and the paths in P i , and if a feasible flo w F for N i has v alue d T , then ( E , λ F ) is an up ward em b edding in which the v ertices in V i are 4-mo dal and the paths in P i do not cause an imp ossible face. When i = k , the bijection provides the desired correspondence betw een the feasible flo ws with v alue d T of N k and the upw ard-consistent angle assignments λ suc h that ( E , λ ) is 4-mo dal and does not contain an y impossible face, since V k con tains all the vertices of G and P k all the maximal directed paths on the b oundary of any face. In the base case of the induction, w e hav e i = 0 and the statemen t follows b y the results of Bertolazzi et al. [ 15 ], since N 0 is the net work they construct and the sets V 0 and P 0 are empt y , hence the additional constraints of our bijection are v acuously satisfied. Supp ose now that the bijection holds true for some v alue i − 1 ∈ { 0 , 1 , . . . , k − 1 } , w e pro v e that it holds true for i , as well. First implication. Supp ose that an angle assignmen t λ for E is upw ard-consisten t and the upw ard embedding ( E , λ ) is such that the vertices in V i are 4-mo dal and the paths in P i do not cause an impossible face. By induction, N -modifier did not conclude that G admits no upw ard b o ok em b edding resp ecting E when pro cessing the v ertices in V i − 1 and the paths in P i − 1 . Also, the flow F λ ( N i − 1 ) has v alue d T . W e ha ve to pro v e that the same statements hold true with i in place of i − 1 . Supp ose first that i ≤ n (whic h implies that P i = ∅ ). Let v b e the i -th ver tex pro cessed b y N -mo difier: V i = V i − 1 ∪ { v } . W e first show that N -modifier did not conclude that G admits no upw ard bo ok em b edding resp ecting E when pro cessing v . Suc h a conclusion is reac hed b y the algorithm in one of tw o cases, namely if: (i) v is not a switc h of G and in E , in clo c kwise order around v , w e do not hav e outgoing left edges, outgoing right edges, incoming righ t edges, and incoming left edges; or if (ii) v is a switch of G and in E the left edges (and th us also the right edges) are not consecutiv e. How ever, the fact that v is 4-mo dal in ( E , λ ) ensures that these cases do not happ en. It follo ws that N -modifier did not conclude that G admits no up ward bo ok embedding resp ecting E when pro cessing v and constructed a flo w net w ork N i . In order to prov e that F λ ( N i ) satisfies the required prop erties, we distinguish t wo cases. In the first case, N i coincides with N i − 1 . This implies that F λ ( N i ) coincides with F λ ( N i − 1 ) , hence it has v alue d T . In the second case, N i is different from N i − 1 . This happ ens if v is a switch in G and has b oth left and righ t edges incident to it. Assume that v is a source, the case in whic h it is a sink being analogous. Let e b e the left edge outgoing from v suc h that the edge e ′ 24 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs preceding e in clockwise order around v is a right edge, and let α b e the angle ( e, e ′ ) . The 4-mo dalit y of v forces α to b e a large angle in ( E , λ ) . Hence, F λ ( N i − 1 ) assigns flo w 1 to the arcs incident to w α (note that there is a single arc outgoing from w α , by the assumption i ≤ n and b y property outgoing ar cs for angle no des ). Since the supply of s v is 1 , w e ha ve that F λ ( N i − 1 ) assigns flo w 0 to the arcs inciden t to w β , for ev ery angle β = α inciden t to v . Since N i coincides with N i − 1 , apart from the fact that, for every angle β = α inciden t to v , the no de w β and the arcs incident to it are not presen t in N i , it follows that F λ ( N i ) coincides with the flow for N i whic h is obtained from F λ ( N i − 1 ) b y neglecting the arcs incident to w β , for ev ery angle β = α inciden t to v . Since suc h arcs are assigned flow 0 b y F λ ( N i − 1 ) , w e ha v e that F λ ( N i ) has v alue d T . Supp ose next that n + 1 ≤ i ≤ k (whic h implies that V i is the en tire vertex set of G ). Consider the ( i − n ) -th maximal directed path pro cessed by N -mo difier. Supp ose that it is in the b oundary of a face f , with f to its righ t, the case in which the path has f to its left b eing analogous. Denote b y ℓ f suc h a path. If ℓ f con tains a left edge or the rest of the b oundary of f is a single edge, then N i coincides with N i − 1 . It follows that F λ ( N i ) coincides with F λ ( N i − 1 ) , hence it has v alue d T . If ℓ f only consists of righ t edges and the rest of the boundary of f is not a single edge, then let u and v b e the extremes of ℓ f , let e u f and e v f b e the edges of ℓ f inciden t to u and v , resp ectiv ely , let α u f b e the angle in f inciden t to u and to the right of e u f , and let α v f b e the angle in f inciden t to v and to the right of e v f . Since ℓ f do es not cause f to be an imp ossible face, it follows that one of α u f and α v f is large in ( E , λ ) . Supp ose that α u f is large in ( E , λ ) , the case in whic h α v f is large in ( E , λ ) is analogous. This implies that u is a switc h of G , hence s u is a source in N i − 1 and N i . Also, the node w α u f b elongs to N i − 1 and the arc ( s u , w α u f ) is assigned one unit of flow b y F λ ( N i − 1 ) . It follo ws that α u f is enlargeable in N i − 1 and hence the algorithm N -modifier did not conclude that G admits no upw ard b o ok embedding respecting E when pro cessing ℓ f . Since the supply of s u is 1 , w e hav e that F λ ( N i − 1 ) assigns flo w 0 to the arcs incident to w β , for ev ery angle β = α u f inciden t to u . W e no w distinguish three cases. Supp ose first that N i coincides with N i − 1 . This happ ens if there is no angle β = α u f inciden t to u in E suc h that w β is in N i − 1 , or if α v f is also enlargeable in N i − 1 and there is no angle β = α v f inciden t to v in E suc h that w β is in N i − 1 . In this case F λ ( N i ) coincides with F λ ( N i − 1 ) , hence it has v alue d T . Supp ose next that α v f is not enlargeable in N i − 1 and there is an angle β = α u f inciden t to u in E suc h that w β is in N i − 1 . By definition, w α v f do es not belong to N i − 1 . Then the net w ork N i coincides with N i − 1 , apart from the fact that, for ev ery angle β = α u f inciden t to u in E , the arcs inciden t to w β are not present in N i . It follows that F λ ( N i ) coincides with the flo w for N i whic h is obtained from F λ ( N i − 1 ) b y neglecting the arcs inciden t to w β , for every angle β = α inciden t to u . Since such arcs are assigned flow 0 b y F λ ( N i − 1 ) , we ha v e that F λ ( N i ) has v alue d T . Supp ose finally that there exists an angle β = α u f inciden t to u suc h that the corresp onding no de w β is in N i − 1 , that α v f is enlargeable in N i − 1 , and that there exists an angle β ′ = α v f inciden t to v suc h that the corresp onding node w β ′ is in N i − 1 . Then N i is obtained from N i − 1 b y inserting a sink t uv f with demand 1 , as well as arcs ( w α u f , t uv f ) and ( w α v f , t uv f ) , eac h with capacit y 1 , and b y decreasing by 1 the demand of t f . Note that w α u f has a single outgoing arc ( w α u f , t f ) in N i − 1 , as if it had at least tw o outgoing arcs in N i − 1 it w ould hav e at least three outgoing arcs in N i , which is not p ossible by prop ert y outgoing ar cs for angle no des . It follows that ( w α u f , t f ) (in addition to ( s u , w α u f ) ) is assigned G. Da Lozzo, F. F rati, and I. Rutter 25 one unit of flow by F λ ( N i − 1 ) . Analogously , w α v f has a single outgoing arc ( w α v f , t f ) in N i − 1 and, if α v f is large, then ( s v , w α v f ) and ( w α v f , t f ) are assigned one unit of flo w b y F λ ( N i − 1 ) . Now F λ ( N i ) coincides with F λ ( N i − 1 ) , except that a unit of flow that is assigned to ( w α u f , t f ) or ( w α v f , t f ) by F λ ( N i − 1 ) is assigned to ( w α u f , t uv f ) or ( w α v f , t uv f ) , resp ectiv ely , b y F λ ( N i ) . Th us F λ ( N i ) has v alue d T since F λ ( N i − 1 ) has v alue d T . This completes the induction and hence the pro of of the forward implication. Second implication. Supp ose that N -modifier did not conclude that G admits no up w ard b o ok em b edding resp ecting E when processing the vertices in V i and the paths in P i . Supp ose also that a feasible flo w F i for N i has v alue d T . F rom F i , we construct a flo w F i − 1 for N i − 1 as follo ws. If N i coincides with N i − 1 , then F i − 1 coincides with F i . Supp ose next that N i is constructed from N i − 1 b y remo ving, for a certain angle α of E inciden t to a v ertex v , the no de w β and the arcs inciden t to it, for every angle β = α inciden t to v . Then F i − 1 is obtained from F i b y assigning flow 0 to the arcs that b elong to N i − 1 and not to N i . Supp ose finally that N i is constructed from N i − 1 b y adding a sink t uv f with demand 1 , b y adding t wo arcs ( w α u f , t uv f ) and ( w α v f , t uv f ) , each with capacit y 1 , and b y decreasing b y 1 the demand of a sink t f . Then F i − 1 is obtained from F i b y neglecting the no de t uv f and its incident arcs, and b y assigning flow 1 to the arc ( w α u f , t f ) or ( w α v f , t f ) , dep ending on whic h of ( w α u f , t uv f ) and ( w α v f , t uv f ) is assigned with flow 1 , respectively . In all cases, F i − 1 is feasible and has v alue d T , given that the same is true for F i . This is ob vious for the first t wo cases, while for the third case one needs to observe that: (i) one of the arcs ( w α u f , t uv f ) and ( w α v f , t uv f ) is assigned with flo w 1 , given that t uv f has demand 1 and F i has v alue d T ; (ii) the arcs ( w α u f , t f ) or ( w α v f , t f ) b elong to N i − 1 , as the mo dification only occurs when α u f and α v f are both enlargeable; and (iii) if ( w α u f , t uv f ) is assigned flo w 1 b y F i , then ( w α u f , t f ) is assigned flo w 0 by F i , giv en that s u supplies 1 unit of flo w; similarly , if ( w α v f , t uv f ) is assigned flow 1 b y F i , then ( w α v f , t f ) is assigned flow 0 b y F i . By induction, ( E , λ F i − 1 ) is an upw ard em b edding in whic h the vertices in V i − 1 are 4-modal and the paths in P i − 1 do not cause an imp ossible face. W e ha ve to prov e that the same statemen ts hold true with i in place of i − 1 . Since F i − 1 assigns flow 1 to an arc ( s u , w α ) outgoing from a source s u of N i − 1 if and only if the same arc in N i is assigned flo w 1 b y F i , w e ha v e that λ F i coincides with λ F i − 1 . This implies that λ F i is upw ard-consistent, that eac h vertex u ∈ V i − 1 is 4-mo dal in ( E , λ F i ) , and that eac h path in P i − 1 do es not cause an imp ossible face in ( E , λ F i ) . Th us it only remains to pro v e that the i -th vertex processed by N -modifier is 4-mo dal in ( E , λ F i ) , if i ≤ n , or that the ( i − n ) -th maximal directed path processed b y N -modifier do es not cause an imp ossible face, if n + 1 ≤ i ≤ k . Supp ose first that i ≤ n . Let v b e the i -th v ertex pro cessed b y N -mo difier. W e distinguish t w o cases. If N i coincides with N i − 1 , then either: (i) v is not a switc h in G , and in E , in clo ckwise order around v , we ha ve outgoing left edges, outgoing righ t edges, incoming righ t edges, and incoming left edges (where one of the former t wo sets and/or one of the latter tw o sets might be empty); or (ii) v is a switch in G and all its incident edges are left edges or they all are right edges. In both situations, v is 4-mo dal in ( E , λ F i ) , regardless of the large-angle assignmen t λ F i . 26 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs If N i is differen t from N i − 1 , then v is a switc h; assume it is a source, the case in whic h it is a sink is analogous. Also, v has both outgoing left edges and outgoing right edges, where the former (and thus also the latter) app ear consecutively around v . Let e b e the left edge outgoing from v suc h that the edge e ′ preceding e in clockwise order around v is a righ t edge, let α b e the angle ( e, e ′ ) , and let f b e the face to the left of e . Then N i is obtained by remo ving w β and its incident arcs from N i − 1 , for each angle β = α inciden t to v . Since w α is the only neighbor of s v in N i and since F i has v alue d T , it follows that the angle α is large in ( E , λ F i ) (and all other angles inciden t to v are small), hence v is 4-mo dal. Supp ose next that n + 1 ≤ i ≤ k . Consider the ( i − n ) -th maximal directed path pro cessed b y N -mo difier. Suppose that it is in the boundary of a face f , with f to its right, the case in whic h the path has f to its left b eing analogous. Denote by ℓ f suc h a path. Let u and v b e the extremes of ℓ f , let e u f and e v f b e the edges of ℓ f inciden t to u and v , resp ectively , let α u f b e the angle in f inciden t to u and to the right of e u f , and let α v f b e the angle in f inciden t to v and to the righ t of e v f . W e distinguish three cases. If N i coincides with N i − 1 , then one of the follo wing is true: (i) ℓ f con tains a left edge; (ii) the rest of the boundary of f is a single edge; (iii) exactly one of α u f and α v f is enlargeable, sa y α u f is enlargeable and α v f is not, and for eac h angle β = α u f inciden t to u in E , no de w β is not in N i − 1 ; or (iv) both α u f and α v f are enlargeable, and there is no angle β = α u f inciden t to u in E suc h that w β is in N i − 1 or there is no angle β = α v f inciden t to v in E suc h that w β is in N i − 1 . Cases (i) and (ii) directly imply that ℓ f do es not cause f to be an imp ossible face in ( E , λ F i ) . In Case (iii), since F i has v alue d T and ( s u , w α u f ) is the only edge outgoing from s u in N i , we hav e that F i assigns flow 1 to ( s u , w α u f ) , hence λ F i assigns a large angle to α u f ; it follows that ℓ f do es not cause f to b e an imp ossible face in ( E , λ F i ) . Similarly , in case (iv), since F i has v alue d T and since ( s u , w α u f ) is the only edge outgoing from s u or ( s v , w α v f ) is the only edge outgoing from s v , w e ha ve that F i assigns flow 1 to ( s u , w α u f ) or ( s v , w α v f ) , hence λ F i assigns a large angle to α u f or α v f ; it follo ws that ℓ f do es not cause f to be an impossible face in ( E , λ F i ) . If exactly one of α u f and α v f is enlargeable, say α u f is enlargeable and α v f is not, and if N i − 1 con tains at least one no de w β suc h that β = α u f is an angle incident to u in E , then N i is obtained b y removing, for eac h angle β = α u f in E inciden t to u , no de w β and its inciden t arcs from N i − 1 . As in the previous case, since F i has v alue d T and ( s u , w α u f ) is the only edge outgoing from s u in N i , we ha ve that F i assigns flow 1 to ( s u , w α u f ) , hence λ F i assigns a large angle to α u f ; it follo ws that ℓ f do es not cause f to b e an imp ossible face in ( E , λ F i ) . Finally , supp ose that b oth α u f and α v f are enlargeable, that there exists an angle β = α u f inciden t to u in E suc h that w β is in N i − 1 , and that there exists an angle β = α v f inciden t to v in E suc h that the corresponding no de w β is in N i − 1 . Then N i is obtained by adding to N i − 1 a sink t uv f with demand 1 , as w ell as arcs ( w α u f , t uv f ) and ( w α v f , t uv f ) , each with capacity 1 , and b y decreasing b y 1 the demand of t f . Since F i has v alue d T , one of ( w α u f , t uv f ) and ( w α v f , t uv f ) is assigned flow 1 b y F i , thus one of ( s u , w α u f ) and ( s v , w α v f ) is also assigned flo w 1 , hence λ F i assigns a large angle to α u f or α v f ; it follows that ℓ f do es not cause f to be an impossible face in ( E , λ F i ) . This completes the proof of the second implication and hence of the theorem in case the graph is connected. G. Da Lozzo, F. F rati, and I. Rutter 27 If G is disconnected, we can apply the same technique to test in O ( n log 3 n ) time whether all connected comp onen ts of G admit an upw ard b o ok embedding that resp ects their given planar em b eddings. If the test fails, then G do es not admit an up ward bo ok em b edding. Otherwise, as argued at the end of the pro of of Theorem 3 , an upw ard b o ok embedding exists if and only if for each comp onen t G j that is embedded in an internal face f of a comp onen t G i , w e ha ve that the boundary of f in G i con tains b oth edges from L and R . This can b e tested in total O ( n ) time. ◀ 6 T est fo r Biconnected P a rtitioned Directed P artial 2 -T rees In this section, w e show a cubic-time algorithm to test whether a biconnected partitioned directed partial 2 -tree admits an up ward bo ok embedding in tw o pages. Many of the ideas presen ted in this section build on to ols introduced in [ 28 , 29 ] to test efficiently whether a directed partial 2 -tree admits an upw ard em b edding. Note that, in the absence of a c haracterization suc h as the one in Theorem 3 , it would be prohibitive to lift suc h to ols to w ork for our problem. Let G b e an n -v ertex biconnected partitioned directed partial 2 -tree and let e ∗ b e an edge of G . W e describ e a test that determines, in O ( n 2 ) time, whether G admits a go o d em b edding in which e ∗ lies on the outer face. Rep eating this test for all O ( n ) c hoices of e ∗ yields an O ( n 3 ) -time algorithm to decide whether G admits a goo d em b edding. By Theorem 3 , this is equiv alent to testing whether G admits an up ward bo ok embedding. Let T b e an SPQ-tree of the underlying graph of G , rooted at the Q-no de ρ ∗ corresp onding to e ∗ . Let µ b e a no de of T with p oles u and v ; recall that G µ denotes the p ertinent graph of µ . A uv -external upwar d emb e dding ( E µ , λ µ ) of G µ is an upw ard embedding of G µ in whic h u and v are incident to the outer face. The requirement that e ∗ is incident to the outer face of an y upw ard embedding ( E , λ ) of G implies that, for eac h no de µ of T with poles u and v , the restriction of ( E , λ ) to G µ is a uv -external up w ard embedding ( E µ , λ µ ) of G µ . A uv -external go o d emb e dding is a uv -external upw ard embedding that is a go o d em b edding. Ev ery up w ard embedding ( E µ , λ µ ) of G µ that might be extended to a goo d embedding of G in which e ∗ is incident to the outer face is itself a go o d embedding. Indeed, it is ob vious that the 4-mo dality of ( E µ , λ µ ) and the absence of impossible internal faces are necessary conditions for the extensibility of ( E µ , λ µ ) to a go o d em b edding ( E , λ ) of G in which e ∗ is inciden t to the outer face. The follo wing is less immediate, given that, differently from the in ternal faces, the outer face f µ of E µ is not a face of E . ▶ Lemma 7. L et ( E , λ ) b e a go o d emb e dding of G in which e ∗ is incident to the outer fac e. L et ( E µ , λ µ ) b e the r estriction of ( E , λ ) to the vertic es and e dges of G µ . Then the outer fac e f µ of E µ is not an imp ossible fac e. Pro of. By Theorem 3 , there exists an upw ard bo ok em b edding Γ that respects ( E , λ ) with e ∗ on the outer face. Let Γ µ b e obtained b y remo ving from Γ all vertices and edges that do not b elong to G µ . Then Γ µ is an upw ard b o ok embedding of G µ that resp ects ( E µ , λ µ ) . Therefore, Theorem 3 implies that the outer face f µ of E µ is not imp ossible. ◀ F or a uv -external go o d embedding ( E µ , λ µ ) of G µ , the p ossible “shap es” of the cycle b ounding the outer face f µ of E µ can b e characterized b y the notion of a shap e descriptor . A shap e descriptor is an 8 -tuple ⟨ τ l , τ r , λ u , λ v , ρ u l , ρ u r , ρ v l , ρ v r ⟩ , defined as follows. Let the left outer p ath P l (resp. the right outer p ath P r ) of E µ b e the path obtained by tra versing the b oundary of f µ from u to v in clo c kwise (resp. coun terclo c kwise) direction. The left-turn- numb er τ l of E µ is the sum of the labels assigned by λ µ to the angles at the v ertices of P l 28 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs (excluding u and v ) in f µ ; the right-turn-numb er τ r of E µ is defined analogously for P r . The v alues λ u and λ v are the lab els of the angles at u and v in f µ , respectively . Finally , ρ u l is set to in or out dep ending on whether the edge of P l inciden t to u is incoming or outgoing at u , resp ectiv ely; the v alues ρ u r , ρ v l , and ρ v r are defined analogously . The v alues of a shap e descriptor are not indep endent of each other [ 28 , 29 ]. In fact, the v alues of τ l , λ u , λ v , and ρ u l suffice to determine the other four v alues of the shap e descriptor. W e enrich the information provided b y a shape descriptor with a second tuple that contains information concerning whether ( E µ , λ µ ) might be extended to a goo d em b edding of G . The pb e descriptor (short for partitioned bo ok embedding descriptor) is a 10 -tuple ⟨ p u l , p u r , p v l , p v r , χ l , χ r , α u l , α u r , α v l , α v r ⟩ , whic h is defined as follows. The labels p u l , p u r , p v l , and p v r ha v e v alues L or R , depending on whether the edge incident to u in P l , the edge incident to u in P r , the edge incident to v in P l , and the edge inciden t to v in P r b elong to L or R , resp ectively . The lab el χ l is 1 if P l is a directed path from u to v and all its edges b elong to L or if P l is a directed path from v to u and all its edges b elong to R , it is 0 otherwise. Similarly , χ r is 1 if P r is a directed path from u to v and all its edges b elong to R or if P r is a directed path from v to u and all its edges b elong to L , it is 0 otherwise. The lab el α u l is 1 if P l con tains a directed path P uw l from u to a v ertex w / ∈ { u, v } suc h that all the edges of P uw l b elong to L and λ µ assigns a small angle at w in f µ , or if P l con tains a directed path P wu l from a vertex w / ∈ { u, v } to u suc h that all the edges of P wu l b elong to R and λ µ assigns a small angle at w in f µ ; the label α u l is 0 otherwise. The lab els α u r , α v l , and α v r are defined analogously , with resp ect to P r rather than P l and/or with resp ect to v rather than u . The v alues of the pb e descriptor of a uv -external go o d em b edding ( E µ , λ µ ) of G µ migh t dep end on eac h other and on the v alues of the shap e descriptor of ( E µ , λ µ ) . F or example, if p u l = L and χ l = 1 , then p v l = L , ρ u l = out , and ρ v l = in . W e call descriptor p air of ( E µ , λ µ ) the pair ( σ, ω ) where σ and ω are the shap e and pbe descriptors of ( E µ , λ µ ) , resp ectively . The information in a descriptor pair fully describ es how a uv -external go o d em b edding of G µ in terfaces with the rest of G for the construction of a go o d em b edding of G with e ∗ on the outer face. That is, consider a goo d embedding ( E , λ ) of G in which e ∗ is incident to the outer face, let ( E µ , λ µ ) b e the uv -external go o d embedding of G µ in ( E , λ ) , and let ( σ, ω ) b e the descriptor pair of ( E µ , λ µ ) . Replacing ( E µ , λ µ ) with any other uv -external goo d embedding of G µ with descriptor pair ( σ, ω ) still results in a go o d em b edding of G in which e ∗ is incident to the outer face. Even more, consider a uv -external go o d em b edding ( E µ , λ µ ) of G µ with descriptor pair ( σ, ω ) , let ν b e a child of µ with poles u ′ and v ′ , and let ( σ ′ , ω ′ ) be the descriptor pair of the u ′ v ′ -external goo d embedding ( E ν , λ ν ) of G ν in ( E µ , λ µ ) . Replacing ( E ν , λ ν ) with any other u ′ v ′ -external go o d embedding of G ν with descriptor pair ( σ ′ , ω ′ ) results in a uv -external go o d em bedding of G µ with descriptor p air ( σ, ω ) . This allo ws us, for a no de µ of T , to only keep track of the descriptor pairs ( σ, ω ) that are “realizable” b y G µ , rather than of the actual uv -external go o d em b eddings of G µ . Th us, in the following, we sho w how to compute the fe asible set F µ of µ . This is the set that contains all the descriptor pairs ( σ, ω ) such that G µ admits a uv -external go o d em b edding with descriptor pair ( σ, ω ) . W e ha ve the follo wing lemma. ▶ Lemma 8. The set F µ has size O ( | V ( G µ ) | ) and c an b e stor e d in O ( | V ( G µ ) | ) sp ac e, so that a query on whether a descriptor p air b elongs to F µ c an b e answer e d in O (1) time. Pro of. An analogous lemma w as pro ved in [ 28 , 29 ] for a feasible set containing shap e descriptors, rather than descriptor pairs. How ever, a pbe descriptor can only assume O (1) G. Da Lozzo, F. F rati, and I. Rutter 29 man y distinct v alues, hence the size of F µ , as well as the time and space for storing it, and the query time, only change b y a multiplicativ e constant. ◀ Our algorithm trav erses the SPQ-tree T of G b ottom-up and computes, for each node µ of T , its feasible set F µ , pro vided that the feasible sets of its children ha ve already b een computed. Ev entually , the test concludes that G admits a go o d em b edding with e ∗ on the outer face if and only if the feasible set of the root ρ ∗ of T is non-empt y . W e now describ e ho w the algorithm deals with each node µ of T , based on its type. 6.1 Q-no de Non-ro ot Q-no des hav e a unique upw ard embedding, from which w e can derive the follo wing. ▶ Lemma 9. L et µ b e a non-r o ot Q-no de of T . The fe asible set F µ of µ c an b e c ompute d in O (1) time. Pro of. Since G µ has a unique up ward embedding E µ , it has a unique descriptor pair. Indeed, as noted in [ 28 , 29 ], the shap e descriptor of E µ is either ⟨ 0 , 0 , 1 , 1 , out , out , in , in ⟩ if the edge ( u, v ) of G corresp onding to µ is directed from u to v or ⟨ 0 , 0 , 1 , 1 , in , in , out , out ⟩ otherwise. Also, the pb e descriptor of E µ is either ⟨ L, L, L, L, 1 , 0 , 0 , 0 , 0 , 0 ⟩ if the edge ( u, v ) is directed from u to v and belongs to L , or ⟨ R, R , R, R, 0 , 1 , 0 , 0 , 0 , 0 ⟩ if the edge ( u, v ) is directed from u to v and belongs to R , or ⟨ L, L, L, L, 0 , 1 , 0 , 0 , 0 , 0 ⟩ if the edge ( u, v ) is directed from v to u and b elongs to L , or ⟨ R, R , R, R, 1 , 0 , 0 , 0 , 0 , 0 ⟩ if the edge ( u, v ) is directed from v to u and b elongs to R . ◀ 6.2 S-no de F or S-no des, our algorithm w orks as follows. Let ν 1 and ν 2 b e the children of an S-no de µ in T , let n 1 and n 2 b e the n umber of vertices of G ν 1 and G ν 2 , and let w b e the unique v ertex shared b y G ν 1 and G ν 2 . W e com bine every descriptor pair ( σ 1 , ω 1 ) in F ν 1 with ev ery descriptor pair ( σ 2 , ω 2 ) in F ν 2 ; for ev ery suc h combination, the algorithm assigns the t wo angles at w in the outer face with every possible lab el in {− 1 , 0 , 1 } . Whenev er the com bination and the assignmen t result in a descriptor pair ( σ, ω ) of a go o d em b edding of G µ , the algorithm adds ( σ, ω ) to F µ . In order to test whether the com bination of descriptor pairs, together with the assignment of lab els to the angles at w , results in a descriptor pair ( σ, ω ) of a go o d em b edding of G µ , w e c heck whether the properties of Theorems 1 and 3 are satisfied. This can b e done in O (1) time, as in the following. ▶ Lemma 10. F or every descriptor p air ( σ 1 , ω 1 ) in F ν 1 , every descriptor p air ( σ 2 , ω 2 ) in F ν 2 , and every p air of values β w , γ w in {− 1 , 0 , 1 } , it is p ossible to che ck in O (1) time whether ther e exists a uv -external go o d emb e dding ( E µ , λ µ ) of G µ in which the upwar d emb e dding ( E ν i , λ ν i ) of G ν i has descriptor p air ( σ i , ω i ) , for i = 1 , 2 , and in which the angles at w in the outer fac e of E µ to the left of the left outer p ath of E µ and to the right of the right outer p ath of E µ ar e β w and γ w , r esp e ctively. A lso, in the p ositive c ase, the descriptor p air ( σ, ω ) of ( E µ , λ µ ) c an b e c ompute d in O (1) time. Pro of. Assume that ν 1 is the c hild with poles u and w , while ν 2 is the c hild with poles w and v . W e need to c heck whether the com bination of the descriptor pairs ( σ 1 , ω 1 ) and ( σ 2 , ω 2 ) , to- gether with the assignmen t of lab els β w , γ w to the angles at w results in an em b edding ( E µ , λ µ ) of G µ suc h that: 30 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs 1. ( E µ , λ µ ) is a uv -external up w ard embedding, in particular we need to c heck whether λ µ is an upw ard-consisten t assignmen t, see Prop erties C1–C3 and Theorem 1 ; 2. ( E µ , λ µ ) is 4-mo dal; and 3. ( E µ , λ µ ) do es not contain an y imp ossible face. Since ( σ 1 , ω 1 ) and ( σ 2 , ω 2 ) corresp ond to a uw -external go o d embedding of G ν 1 and to a w v -external go o d embedding of G ν 2 , resp ectively , a fail in the abov e chec ks can only occur in the elemen ts of ( E µ , λ µ ) that are created b y joining ( σ 1 , ω 1 ) and ( σ 2 , ω 2 ) ; th us, we need to c heck whether the angles incident to w satisfy the conditions of an upw ard-consistent assignmen t and whether w is 4-modal, and we need to c hec k whether the outer face of ( E µ , λ µ ) satisfies the conditions of an upw ard-consistent assignmen t and whether it is an imp ossible face or not. These prop erties can b e chec k ed in O (1) time, as will describ ed b elow. Let ( E ν 1 , λ ν 1 ) b e a uw -external go o d embedding of G ν 1 whose descriptor pair is ( σ 1 , ω 1 ) and let ( E ν 2 , λ ν 2 ) b e a w v -external go o d embedding of G ν 2 whose descriptor pair is ( σ 2 , ω 2 ) . Denote b y τ 1 l , τ 1 r , λ u 1 , λ w 1 the first four labels in σ 1 and b y τ 2 l , τ 2 r , λ w 2 , λ v 2 the first four labels in σ 2 . Also, let ( E µ , λ µ ) b e obtained from ( E ν 1 , λ ν 1 ) and ( E ν 2 , λ ν 2 ) as follows. Eac h of G ν 1 and G ν 2 main tains its embedding, E ν 1 and E ν 2 resp ectiv ely , in E µ and is in the outer face of the other. This completely defines E µ ; note that u and v are incident to the outer face of E µ . Ev ery angle, except for the angles inciden t to w in the outer face f µ of E µ , is also an angle in E ν 1 or E ν 2 , and then it maintains the same label it is assigned b y λ ν 1 or λ ν 2 , resp ectively . Finally , the angle at w in f µ to the left of the left outer path of E µ is assigned lab el β w and the angle at w in f µ to the right of the righ t outer path of E µ is assigned lab el γ w . Then the descriptor pair ( σ, ω ) of ( E µ , λ µ ) can b e computed in O (1) time as follows. Concerning the shap e descriptor σ , the left-turn-n um b er τ l of ( E µ , λ µ ) (first lab el in σ ) is equal to τ 1 l + β w + τ 2 l . Similarly , the right-turn-n umber τ r of ( E µ , λ µ ) (second lab el in σ ) is equal to τ 1 r + γ w + τ 2 r . The lab el λ u for the angle at u in f µ (third lab el in σ ) is equal to λ u 1 , while the lab el λ v for the angle at v in f µ (fourth lab el in σ ) is equal to λ 2 v . The lab els ρ u l and ρ u r (fifth and sixth lab els in σ ) ha v e the same v alues as the corresp onding lab els in σ 1 , and the lab els ρ v l and ρ v r (sev en th and eigh th lab els in σ ) ha ve the same v alues as the corresponding lab els in σ 2 . Concerning the pb e descriptor ω , the lab els p u l and p u r (first and second lab els in ω ) hav e the same v alues as the corresp onding lab els in ω 1 , while the lab els p v l and p v r (third and fourth lab els in ω ) hav e the same v alues as the corresp onding lab els in ω 2 . The lab el χ l (fifth lab el in ω ) has v alue 1 if and only if all the follo wing hold true: (i) the corresp onding lab els in ω 1 and ω 2 b oth hav e v alue 1 ; (ii) β w = 0 ; and (ii) the labels p w l in ω 1 and ω 2 b oth ha ve v alue L or b oth ha ve v alue R . The v alue of the lab el χ r (sixth lab el in ω ) is computed similarly . The label α u l (sev en th v alue in ω ) has v alue 1 if and only if at least one of the follo wing holds true: (i) the corresponding lab el in ω 1 has v alue 1 ; (ii) the lab el χ l in ω 1 has v alue 1 and β w = − 1 ; or (iii) the lab el χ l in ω 1 has v alue 1 , β w = 0 , the label α w l in ω 2 has v alue 1 , and the labels p w l in ω 1 and ω 2 b oth ha ve v alue L or both ha v e v alue R . The v alues of the lab els α u r , α v l , and α v r (eigh th, nin th, and tenth lab els in ω ) are computed similarly . W e no w show ho w it can b e tested in O (1) time whether ( σ, ω ) actually corresp onds to a uv -external go o d embedding ( E µ , λ µ ) of G µ . 1. W e first deal with the properties that make ( E µ , λ µ ) an up ward em b edding. W e do not address here the bimodality of ( E µ , λ µ ) , as later w e will sho w how to chec k its 4-mo dality , whic h implies its bimo dality . G. Da Lozzo, F. F rati, and I. Rutter 31 Prop ert y C1 is satisfied by ( E µ , λ µ ) for all angles different from β w and γ w since it is satisfied b y ( E ν 1 , λ ν 1 ) and ( E ν 2 , λ ν 2 ) . Th us, we c heck whether β w = 0 if and only if the lab el ρ w l in σ 1 is equal to in and the lab el ρ w l in σ 2 is equal to out , or vice v ersa, and similar for γ w . Prop ert y C2 is satisfied by ( E µ , λ µ ) for all vertices differen t from w since it is satisfied b y ( E ν 1 , λ ν 1 ) and ( E ν 2 , λ ν 2 ) . Th us, we c heck whether β w + γ w = λ w 1 + λ w 2 − 2 . Indeed, By Prop ert y C2 for ( E ν 1 , λ ν 1 ) , the lab el λ w 1 is equal to 2 − deg 1 ( w ) − P λ ν 1 ( a ) , where deg 1 ( w ) is the degree of w in G ν 1 and the sum is ov er all the angles a at w in internal faces of E ν 1 . A similar equation holds true for ( E ν 2 , λ ν 2 ) , and this gives us that λ w 1 + λ w 2 = 4 − deg ( w ) − P λ µ ( a ) , where deg ( w ) is the degree of w in G µ and the sum is o ver all the angles a at w in in ternal faces of E µ . Also, Property C2 is satisfied by ( E µ , λ µ ) for w if and only if β w + γ w = 2 − deg ( w ) − P λ µ ( a ) . Com bining the last t wo equations, w e get that Prop ert y C2 is satisfied by ( E µ , λ µ ) for w if and only if β w + γ w = λ w 1 + λ w 2 − 2 . Prop ert y C3 do es not require an y further chec k. Indeed, it is satisfied b y ( E µ , λ µ ) for all the in ternal faces of E µ since it is satisfied b y ( E ν 1 , λ ν 1 ) and ( E ν 2 , λ ν 2 ) . By Property C3 for ( E ν 1 , λ ν 1 ) , we hav e τ 1 l + τ 1 r + λ u 1 + λ w 1 = 2 . Analogously , τ 2 l + τ 2 r + λ w 2 + λ v 2 = 2 . Th us, τ 1 l + τ 1 r + λ u 1 + λ w 1 + τ 2 l + τ 2 r + λ w 2 + λ v 2 = 4 . Property C3 is satisfied b y ( E µ , λ µ ) for f µ if and only if τ l + τ r + λ u + λ v = 2 . Since τ l = τ 1 l + τ 2 l + β w , τ r = τ 1 r + τ 2 r + γ w , λ u = λ u 1 , and λ v = λ v 2 , b y the previous equations we get that Property C3 is satisfied b y ( E µ , λ µ ) for f µ if and only if β w + γ w = λ w 1 + λ w 2 − 2 , whic h is the same equation that w as c heck ed for Prop ert y C2. 2. The 4-mo dality of ( E µ , λ µ ) can b e chec ked as follo ws. First, every v ertex of G µ differen t from w is 4-modal in ( E µ , λ µ ) since it is 4-mo dal in ( E ν 1 , λ ν 1 ) or ( E ν 2 , λ ν 2 ) . No w, consider the circular sequence [ LO , RO , RI , LI ] , where L , R , O , and I stand for left, righ t, outgoing, and incoming, resp ectively . The labels ρ w l , ρ w r , and λ w 1 in σ 1 , together with the labels p w l and p w r in ω 1 , define a linear sequence π 1 from the circular sequence [ LO , RO , RI , LI ] that is “used” b y the edges and faces incident to w in ( E ν 1 , λ ν 1 ) . F or example, if ρ w r = in and ρ w l = out in σ 1 , and p w r = R and p w l = L in ω 1 , then the first edge incident to w in E ν 1 , in the clo ckwise order of the edges inciden t to w that starts at the outer face of E ν 1 , is red incoming, while the last edge is left outgoing, thus ( E ν 1 , λ ν 1 ) uses the linear sequence π 1 = [ RI , LI , LO ] . The lab el λ w 1 is used in order to compute π 1 only when ρ w r = ρ w l in σ 1 and p w l = p w r in ω 1 . Sa y , for example, that ρ w r = ρ w l = in and p w l = p w r = L ; then if λ w 1 = 1 in σ 1 w e ha ve π 1 = [ LI ] , while if λ w 1 = − 1 w e ha v e π 1 = [ LI , LO , RO , R I , LI ] . A linear portion π 2 of the circular sequence [ LO , RO , RI , LI ] that is used b y the edges inciden t to w in ( E ν 2 , λ ν 2 ) is defined similarly . W e then need to p erform the follo wing c hec k. If π 1 consists of just one element, w e c heck that suc h an elemen t is not an in ternal elemen t of π 2 . Symmetrically , if π 2 consists of just one elemen t, we c heck that such an elemen t is not an internal element of π 1 . Finally , if both π 1 and π 2 ha v e more than one elemen t, then w e c heck whether the first elemen t of π 1 do es not b elong to π 2 or is the last element of π 2 , and whether the first elemen t of π 2 do es not b elong to π 1 or is the last elemen t of π 1 . Then w is 4-modal in ( E µ , λ µ ) if and only if the chec k is successful. 3. Finally , the absence of imp ossible faces in ( E µ , λ µ ) can b e c heck ed as follo ws. First, ev ery face of E µ differen t from f µ is not imp ossible in ( E µ , λ µ ) since it is not imp ossible in ( E ν 1 , λ ν 1 ) and ( E ν 2 , λ ν 2 ) . In order to t est whether f µ is impossible, we need to c heck whether a directed path on the b oundary of f µ , composed of left edges with f µ to its left or comp osed of right edges with f µ to its right, and with tw o small angles at its end-v ertices, arises b y joining E ν 1 and E ν 2 . Since the outer faces of E ν 1 and E ν 2 are not imp ossible, the directed path t ypically consists of a directed path in the outer face of E ν 1 32 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs and of a directed path in the outer face of E ν 2 , joined at w ; an exception to this situation is the one in which the directed path is en tirely in the outer face of E ν 1 or E ν 2 , and it is the small angle at one of its end-v ertices (in this case, this is necessarily w ) that is created b y joining E ν 1 and E ν 2 . The part of the directed path that is in the outer face of E ν 1 and that starts at w , if an y , might b elong to the left or to the righ t outer path of E ν 1 ; also, the small angle inciden t to such a path migh t o ccur in the left outer path of E ν 1 , in the righ t outer path of E ν 1 , or at u . Similar options are p ossible for the part of the directed path that is in the outer face of E ν 2 . All these prop erties determine whic h lab els hav e to b e chec ked in order to test whether G µ con tains a directed path that causes f µ to b e an imp ossible face. F ormally , we c heck whether: u w v u w v (a) u w v u w v (b) u w v u w v (c) u w v u v w (d) u v u v w w (e) u v u v w w (f ) u w u w v v (g) w v w v u u (h) w w u u v v (i) u u v v w w (j) w w u u v v (k) v v w w u u (l) w v w v u u (m) u w w v v u (n) w w u u v v (o) v v w w u u (p) u w u w v v (q) w w v v u u (r) Figure 11 Configurations that make f µ imp ossible (first part). Blue and red edges represen t directed paths comp osed only of left and right edges, resp ectiv ely . Only the vertices u , v , and w are explicitly shown, while the closed curv es represent the boundaries of E ν 1 (b elo w) and E ν 2 (ab o v e). The lab el α w l in ω 1 is 1 , the lab el α w l in ω 2 is 1 , β w = 0 , and the lab els p w l in ω 1 and ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 11a ). The lab el α w l in ω 1 is 1 and β w = − 1 (see Fig. 11b ). The lab el α w l in ω 2 is 1 and β w = − 1 (see Fig. 11c ). The lab el α w r in ω 1 is 1 , the lab el α w r in ω 2 is 1 , γ w = 0 , and the lab els p w r in ω 1 and ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 11d ). The lab el α w r in ω 1 is 1 and γ w = − 1 (see Fig. 11e ). The lab el α w r in ω 2 is 1 and γ w = − 1 (see Fig. 11f ). The lab el α w l in ω 1 is 1 , β w = 0 , the lab el χ l in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , and the lab els p w l in ω 1 and ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 11g ). The lab el α w l in ω 2 is 1 , β w = 0 , the lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is − 1 , and the lab els p w l in ω 1 and ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 11h ). G. Da Lozzo, F. F rati, and I. Rutter 33 w w v v u u (a) w v w v u u (b) w w u u v v (c) w w u u v v (d) w u u v v w (e) u u v w v w (f ) v w v w u u (g) v w v w u u (h) v v u w w u (i) u w u v v w (j) u w u w v v (k) u w u v v w (l) Figure 12 Configurations that mak e f µ imp ossible (second part). The lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is − 1 , β w = 0 , the lab el χ l in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , and the labels p w l in ω 1 and ω 2 b oth ha ve v alue L or b oth ha ve v alue R (see Fig. 11i ). The lab el α w r in ω 1 is 1 , γ w = 0 , the lab el χ r in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , and the lab els p w r in ω 1 and ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 11j ). The lab el α w r in ω 2 is 1 , γ w = 0 , the lab el χ r in ω 1 is 1 , the lab el λ u in σ 1 is − 1 , and the lab els p w r in ω 1 and ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 11k ). The label χ r in ω 1 is 1 , the label λ u in σ 1 is − 1 , γ w = 0 , the label χ r in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , and the labels p w r in ω 1 and ω 2 b oth ha ve v alue L or b oth ha ve v alue R (see Fig. 11l ). The lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is − 1 , and β w = − 1 (see Fig. 11m ). The lab el χ l in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , and β w = − 1 (see Fig. 11n ). The lab el χ r in ω 1 is 1 , the lab el λ u in σ 1 is − 1 , and γ w = − 1 (see Fig. 11o ). The lab el χ r in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , and γ w = − 1 (see Fig. 11p ). The lab el α w l in ω 1 is 1 , β w = 0 , the label χ l in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v r in ω 2 is 1 , and the lab els p w l in ω 1 and p w l and p v r in ω 2 all ha ve v alue L or all ha v e v alue R (see Fig. 11q ). The lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is − 1 , β w = 0 , the lab el χ l in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v r in ω 2 is 1 , and the labels p w l in ω 1 and p w l and p v r in ω 2 all ha v e v alue L or all ha ve v alue R (see Fig. 11r ). β w = − 1 , the label χ l in ω 2 is 1 , the label λ v in σ 2 is 0 , the label α v r in ω 2 is 1 , and the lab els p w l and p v r in ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 12a ). The lab el α w l in ω 2 is 1 , β w = 0 , the lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the lab el α u r in ω 1 is 1 , and the lab els p w l in ω 2 and p w l and p u r in ω 1 all ha v e v alue L or all ha v e v alue R (see Fig. 12b ). The lab el χ l in ω 2 is 1 , the lab el λ v in σ 2 is − 1 , β w = 0 , the lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the label α u r in ω 1 is 1 , and the lab els p w l in ω 2 and p w l and p u r in ω 1 all ha v e v alue L or all ha ve v alue R (see Fig. 12c ). β w = − 1 , the lab el χ l in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the lab el α u r in ω 1 is 1 , and the lab els p w l and p u r in ω 1 b oth ha v e v alue L or both hav e v alue R (see Fig. 12d ). The lab el χ l in ω 1 is 1 , the label λ u in σ 1 is 0 , the label α u r in ω 1 is 1 , β w = 0 , the lab el χ l in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v r in ω 2 is 1 , and the labels p w l and p u r in ω 1 and p w l and p v r in ω 2 all ha v e v alue L or all ha ve v alue R (see Fig. 12e ). 34 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs The lab el α w r in ω 1 is 1 , γ w = 0 , the lab el χ r in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v l in ω 2 is 1 , and the lab els p w r in ω 1 and p w r and p v l in ω 2 all ha ve v alue L or all ha v e v alue R (see Fig. 12f ). The label χ r in ω 1 is 1 , the label λ u in σ 1 is − 1 , γ w = 0 , the label χ r in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v l in ω 2 is 1 , and the labels p w r in ω 1 and p w r and p v l in ω 2 all ha v e v alue L or all ha ve v alue R (see Fig. 12g ). γ w = − 1 , the lab el χ r in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v l in ω 2 is 1 , and the lab els p w r and p v l in ω 2 b oth ha v e v alue L or both hav e v alue R (see Fig. 12h ). The lab el α w r in ω 2 is 1 , γ w = 0 , the lab el χ r in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the lab el α u l in ω 1 is 1 , and the lab els p w r in ω 2 and p w r and p u l in ω 1 all ha v e v alue L or all ha v e v alue R (see Fig. 12i ). The label χ r in ω 2 is 1 , the label λ v in σ 2 is − 1 , γ w = 0 , the label χ r in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the label α u l in ω 1 is 1 , and the lab els p w r in ω 2 and p w r and p u l in ω 1 all ha v e v alue L or all ha ve v alue R (see Fig. 12j ). γ w = − 1 , the lab el χ r in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the lab el α u l in ω 1 is 1 , and the lab els p w r and p u l in ω 1 b oth ha v e v alue L or both hav e v alue R (see Fig. 12k ). The lab el χ r in ω 1 is 1 , the lab el λ u in σ 1 is 0 , the lab el α u l in ω 1 is 1 , γ w = 0 , the lab el χ r in ω 2 is 1 , the lab el λ v in σ 2 is 0 , the lab el α v l in ω 2 is 1 , and the lab els p w r and p u l in ω 1 and p w r and p v l in ω 2 all ha v e v alue L or all ha ve v alue R (see Fig. 12l ). If all the ab o ve c hecks fail, then f µ is not imp ossible and hence w e conclude that ( σ, ω ) corresp onds to a uv -external go o d embedding ( E µ , λ µ ) . This concludes the pro of of the lemma. ◀ Lemma 10 allo ws us to compute the feasible set F µ of µ in time O ( |F ν 1 | · |F ν 2 | ) . The follo wing lemma, whic h generalizes a similar statemen t app earing in the extended v ersion of [ 29 ], prov es that this sums up to O ( m 2 ) time o ver all S-nodes of T , where m is the n um b er of edges of G , and th us to O ( n 2 ) time. A function f : N + → R ≥ 0 is sup er-additive if f ( P i x i ) ≥ P i f ( x i ) . F or a no de µ of T whose p ertinent graph G µ has n µ v ertices and m µ edges, we ha ve n µ ∈ O ( m µ ) and, by Lemma 8 , we ha v e |F µ | ∈ O ( n µ ) , thus |F µ | ∈ O ( m µ ) . Hence, there exist p ositive constan ts p and q with p ≥ q suc h that, for any node µ of T whose p ertinent graph G µ has m µ edges, w e ha ve |F µ | ≤ f ( m µ ) := p · m µ − q . Note that the function f ( m µ ) := p · m µ − q is indeed super-additive, giv en that q > 0 . Also, w e hav e that f (1) ≥ 0 , giv en that p ≥ q . W e ha ve the follo wing. ▶ Lemma 11. L et f : N + → R ≥ 0 b e a sup er-additive function such that f (1) ≥ 0 . Then P µ ( f ( m ν 1 ) · f ( m ν 2 )) ∈ O ( f ( m )) 2 , wher e the sum is taken over al l S-no des µ of T , and ν 1 and ν 2 ar e the childr en of µ , wher e G ν 1 and G ν 2 have m ν 1 and m ν 2 e dges, r esp e ctively. Pro of. F or a no de τ of T (not necessarily an S-no de), let m τ b e the num b er of edges in G τ , and let S τ := P µ ( f ( m ν 1 ) · f ( m ν 2 )) , where the sum is tak en o ver all S-no des µ in the subtree of T ro oted at τ . W e prov e that S τ ≤ 4 f ( m τ ) 2 . The proof proceeds b ottom-up on T . If τ is a leaf, then S τ = 0 since the subtree of T ro oted at τ con tains no S-node. Also, 4 f ( m τ ) 2 ≥ 0 , giv en that m τ = 1 and f (1) ≥ 0 . Hence, the inequalit y holds. If τ is an S-no de with c hildren τ 1 and τ 2 , where G τ 1 and G τ 2 ha v e m τ 1 and m τ 2 edges, resp ectiv ely , then S τ = f ( m τ 1 ) f ( m τ 2 ) + S τ 1 + S τ 2 ≤ 4 f ( m τ 1 ) 2 + f ( m τ 1 ) f ( m τ 2 ) + 4 f ( m τ 2 ) 2 ≤ 4 f ( m τ 1 ) 2 + 8 f ( m τ 1 ) f ( m τ 2 ) + 4 f ( m τ 2 ) 2 = 4( f ( m τ 1 ) + f ( m τ 2 )) 2 ≤ 4 f ( m τ ) 2 where the last inequalit y exploits the fact that m τ 1 + m τ 2 = m τ and that f is a sup er-additiv e function. G. Da Lozzo, F. F rati, and I. Rutter 35 Finally , if τ is a P-node with k ≥ 2 c hildren τ 1 , τ 2 , . . . τ k , w e hav e that S τ = P k i =1 S τ i ≤ P k i =1 4 f ( m τ i ) 2 ≤ 4 P k i =1 f ( m τ i ) 2 ≤ 4 f ( m τ ) 2 , where the second inequalit y is the Cauc h y-Sch wartz inequalit y , and last inequalit y again exploits the fact that P k i =1 m τ i = m τ and that f is a sup er-additiv e function. The upp er b ound on S τ , applied to the ro ot of T , pro ves the statemen t of the lemma. ◀ W e th us get the follo wing. ▶ Lemma 12. Let µ b e an S-no de of T with childr en ν 1 and ν 2 , and let n 1 and n 2 b e the numb er of no des of G ν 1 and G ν 2 . Given the fe asible sets F ν 1 and F ν 2 of ν 1 and ν 2 , r esp e ctively, the fe asible set F µ of µ c an b e c ompute d in O ( n 1 n 2 ) time. This sums up to O ( n 2 ) time over al l S-no des of T . 6.3 P-no de Supp ose next that µ is a P-no de. Differently from the case of S-no des, w e cannot just com bine the descriptor pairs in the feasible sets of the c hildren ν 1 , . . . , ν k of µ , as k migh t be large, and hence the n umber of combinations might b e super-p olynomial. Also, ev en if a descriptor pair were chosen for eac h c hild of µ , the num b er of p ermutations of the c hildren of µ migh t b e sup er-p olynomial; the choice of the p ermutation affects the descriptor pair of the resulting uv -external go o d em b edding of G µ . Instead, our algorithm considers ev ery p ossible descriptor pair that might describ e a uv -external go o d em b edding of G µ and tests whether it belongs to F µ or not. This is formalized as follows. A set U n of descriptor pairs is n -universal if it satisfies the following properties. First, for every h -v ertex biconnected partitioned directed partial 2 -tree H with h ≤ n , for ev ery tw o vertices u H and v H of H , and for ev ery u H v H -external go o d em b edding ( E H , λ H ) of H , the descriptor pair of ( E H , λ H ) is in U n . Second, for every descriptor pair ( σ, ω ) in U n , there exists a biconnected partitioned directed partial 2 -tree H that con tains tw o v ertices u H and v H , and that admits a u H v H - external go o d embedding ( E H , λ H ) with descriptor pair ( σ, ω ) . Note that the feasible set F µ of µ is a subset of U n . W e observ e the following: ▶ Lemma 13. A n n -universal set U n of descriptor p airs with |U n | ∈ O ( n ) c an b e c onstructe d in O ( n ) time. Pro of. W e describe ho w to construct U n . W e start b y considering eac h 4 -tuple of v alues τ l ∈ [ − n + 2 , n − 2] , λ u , λ v ∈ {− 1 , 0 , 1 } , and ρ u l ∈ { in , out } . F or eac h such 4 -tuple, w e construct a shap e descriptor σ = ⟨ τ l , τ r , λ u , λ v , ρ u l , ρ u r , ρ v l , ρ v r ⟩ , where τ r = 2 − τ l − λ u − λ v , where ρ u r ∈ { in , out } has the same v alue as ρ u l if λ u ∈ {− 1 , 1 } and different v alue if λ u = 0 , where ρ v l ∈ { in , out } has the same v alue as ρ u l if τ l is o dd and different v alue if τ l is ev en, and where ρ v r ∈ { in , out } has the same v alue as ρ v l if λ v ∈ {− 1 , 1 } and different v alue if λ v = 0 . F or each constructed shap e descriptor σ , we consider eac h 10 -tuple ω of v alues p u l , p u r , p v l , p v r ∈ { L, R } , and χ l , χ r , α u l , α u r , α v l , α v r ∈ { 0 , 1 } . Out of the 2 10 p ossible tuples ω , w e discard those whic h satisfy at least one of the following c hecks: 1. χ l = 1 and τ l = 0 (indeed, χ l = 1 requires the left outer path P l to b e a directed path, th us the angles in the outer face at the in ternal vertices of P l all ha ve to b e assigned lab el 0 , whereas τ l = 0 requires at least one of suc h angles to b e assigned a lab el differen t from 0 ), or χ r = 1 and τ r = 0 ; 36 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs 2. χ l = 1 and p u l = p v l (indeed, χ l = 1 requires the left outer path P l to be entirely comp osed of left edges or en tirely comp osed of right edges, whereas p u l = p v l implies that P l con tains a left and a right edge), or χ r = 1 and p u r = p v r ; 3. χ l = 1 and ρ u l = ρ v l (indeed, χ l = 1 requires the left outer path P l to b e a directed path from u to v or from v to u , whereas ρ u l = ρ v l requires the edges of P l inciden t to u and v to be both incoming in to u and v or both outgoing from u and v ), or χ r = 1 and ρ u r = ρ v r ; 4. χ l = 1 , ρ u l = out , and p u l = R (indeed, χ l = 1 and ρ u l = out require the left outer path P l to b e en tirely comp osed of left edges, whereas p u l = R implies that P l con tains a right edge), or χ l = 1 , ρ u l = in , and p u l = L , or χ r = 1 , ρ u r = out , and p u l = L , or χ r = 1 , ρ u r = in , and p u l = R ; 5. χ l = 1 and α u l = 1 (indeed, χ l = 1 requires the internal v ertices of the left outer path P l to b e inciden t to flat angles in the outer face, whereas α u l = 1 requires P l to con tain an in ternal v ertex that is incident to a small angle in the outer face), or χ l = 1 and α v l = 1 , or χ r = 1 and α u r = 1 , or χ r = 1 and α v r = 1 ; v P l P r u (a) u v (b) u v (c) v u (d) u v (e) v u (f ) Figure 13 F orbidden v alues for the pb e descriptor. 6. p u l = R , p u r = L , ρ u l = out , and λ u = 1 (indeed, 4-mo dality , large angle in the outer face, left outer path outgoing with a red edge and righ t outer path outgoing with a blue edge cannot be all achiev ed simultaneously , see Fig. 13a ), p u l = L , p u r = R , ρ u l = in , and λ u = 1 , or p v r = R , p v l = L , ρ v l = out , and λ v = 1 , or p v l = R , p v r = L , ρ v l = in , and λ v = 1 ; 7. χ l = 1 , λ u = − 1 , and λ v = − 1 (indeed, this results in the outer face to b e imp ossible, see Fig. 13b ), or χ r = 1 , λ u = − 1 , and λ v = − 1 ; 8. α u l = 1 and λ u = − 1 (indeed, this results in the outer face to be impossible, see Fig. 13c ), or α v l = 1 and λ v = − 1 , or α u r = 1 and λ u = − 1 , or α v r = 1 and λ v = − 1 ; 9. α u l = 1 , λ u = 0 , α u r = 1 , and p u l = p u r (indeed, this results in the outer face to b e imp ossible, see Fig. 13d ), or α v l = 1 , λ v = 0 , α v r = 1 , and p v l = p v r ; 10. χ l = 1 , λ u = 0 , λ v = − 1 , α u r = 1 , and p u l = p u r (indeed, this results in the outer face to b e imp ossible, see Fig. 13e ), or χ l = 1 , λ v = 0 , λ u = − 1 , α v r = 1 , and p v l = p v r , or χ r = 1 , λ u = 0 , λ v = − 1 , α u l = 1 , and p u l = p u r , or χ r = 1 , λ v = 0 , λ u = − 1 , α v l = 1 , and p v l = p v r ; and 11. χ l = 1 , λ u = 0 , λ v = 0 , α u r = 1 , α v r = 1 , and p u l = p u r = p v r (indeed, this results in the outer face to be imp ossible, see Fig. 13f ), or χ r = 1 , λ u = 0 , λ v = 0 , α u l = 1 , α v l = 1 , and p u r = p u l = p v l . Eac h 10 -tuple that is not discarded is a pb e descriptor ω that together with the shape descriptor σ forms a descriptor pair ( σ, ω ) that we insert in to U n . By construction, w e ha v e |U n | < (2 n − 3) · 2 13 ∈ O ( n ) ; also, U n can clearly b e constructed in O ( n ) time. W e now pro v e that U n is indeed n -univ ersal. First, we pro ve that, for every h -v ertex biconnected partitioned directed partial 2 -tree H with h ≤ n , for ev ery tw o vertices u H and v H of H , and for ev ery u H v H -external goo d G. Da Lozzo, F. F rati, and I. Rutter 37 em b edding ( E H , λ H ) of H , the descriptor pair ( σ, ω ) of ( E H , λ H ) is in U n . By definition, the left-turn-num b er τ l of ( E H , λ H ) is equal to the sum of the labels assigned by λ H to the angles in the outer face of E H at the in ternal v ertices of the left outer path P l of E H . Since H has h v ertices, the n umber of in ternal v ertices of P l is at most h − 2 , hence τ l ∈ [ − h + 2 , h − 2] . As men tioned earlier, the v alues τ l , λ u , λ v , ρ u l determine the other v alues of the lab els in σ . Since w e consider all p ossible v alues for λ u , λ v , and ρ u l , w e indeed generate σ . Finally , w e generate all 10 -tuples ⟨ p u l , p u r , p v l , p v r , χ l , χ r , α u l , α u r , α v l , α v r ⟩ and only discard tuples that violate the fact that each edge of H is uniquely oriented, or that eac h edge of H is uniquely assigned to a part of the edge set of H , or that H is acyclic, or that ( E H , λ H ) is a u H v H -external goo d embedding, hence w e do not discard ω , and the descriptor pair ( σ, ω ) is indeed added to U n . Second, w e prov e that, for every descriptor pair ( σ, ω ) in U n , there exists a biconnected partitioned directed partial 2 -tree H that contains t wo v ertices u and v , and that admits a uv -external go o d embedding ( E H , λ H ) with descriptor pair ( σ, ω ) . The underlying graph of our digraph H is just a cycle, composed of paths P l and P r connecting u and v , where P l and P r are the left and righ t outer path of E H , resp ectiv ely . W e sho w how to construct P l , as the construction of P r is analogous. By “m ulti-path” w e mean a length- 2 directed path comp osed of edges in b oth parts of the edge set of H . Suc h a path is assigned lab el 0 by λ H at the angles incident to its in ternal vertex. Let w u and w v b e the neigh b ors of u and v in P l , resp ectiv ely . W e choose the orien tation and part for the edge betw een u and w u according to ρ u l and p u l , resp ectiv ely , and likewise for the edge b etw een v and w v , b y exploiting ρ v l and p v l . If χ l = 1 , then τ l = 0 , by Chec k 1, and P l is a directed path. W e let w u = w v and we let b oth the angles at w u = w v b e assigned lab el 0 by λ H . Note that, by Chec ks 2, 3, and 4, P l is either a directed path ( u, w u = w v , v ) composed of left edges, or a directed path ( v , w u = w v , u ) comp osed of right edges. By Check 5, we ha ve α u l = α v l = 0 , hence the definition of P l complies with the v alues of such labels. u w u v w ′ u w v w ′ v P r (a) v w ′ v w v w u P r z 3 z 1 w ′ u u z 2 (b) v z 2 z 3 w u z 1 w ′ u w ′ v w v u P r (c) Figure 14 Definition of the left outer path P l of the planar embedding E H of the graph H . (a) Multipaths P u l and P v l . In this example, α u l = 1 and α v l = 0 . (b)-(c) Inserting v ertices z 1 , . . . , z x and length- 2 multi-paths incident to them, with S = − 1 . In (b), we hav e τ l = 2 , hence x = | 2 − ( − 1) | = 3 , while in (c) we hav e τ l = − 4 , hence x = | − 4 − ( − 1) | = 3 . If χ l = 0 , we in tro duce a m ulti-path P u l b et w een a v ertex w ′ u and w u and a m ulti- path P v l b et w een a vertex w ′ v and w v , see Fig. 14a . If α u l = 1 , then P u l is orien ted so that w u is a switc h and the partition of its edges is such that w u is only inciden t to edges in one part; we let λ H assign lab el − 1 to the angle at w u in the outer face of E H and lab el 1 to the angle at w u in the internal face of E H . If α u l = 0 , then P u l is orien ted so that w u is a not a switc h; we let λ H assign label 0 to b oth angles at w u . 38 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs Analogously , if α v l = 1 , then P v l is oriented so that w v is a switch and the partition of its edges is suc h that w v is only inciden t to edges in one part; we let λ H assign lab el − 1 to the angle at w v in the outer face of E H and lab el 1 to the angle at w v in the in ternal face of E H . If α v l = 0 , then P v l is orien ted so that w v is a not a switch; w e let λ H assign lab el 0 to b oth angles at w v . Let S b e the sum of the lab els assigned to the angles at w u and w v in the outer face of E H , note that S ∈ {− 2 , − 1 , 0 } . W e introduce x = | τ l − S | v ertices z 1 , . . . , z x in P l , as in Fig. 14b and Fig. 14c . W e let z 0 := w ′ u and z x +1 := w ′ v . F or i = 0 , . . . , x , w e in tro duce a multi-path b et ween z i and z i +1 . These multi-paths are orien ted so that z 0 and z x +1 are not switches and so that z 1 , . . . , z x are switc hes. This orien tation is indeed p ossible, giv en that τ l is o dd if and only if the edges b etw een u and w u and b et w een v and w v are b oth incoming u and v or b oth outgoing from u and v , by construction. W e let λ H assign lab el 0 to eac h angle at z 0 or z x +1 ; also, for i = 1 , . . . , x , if τ l − S > 0 , w e let λ H assign lab el 1 to the angle at z i in the outer face of E H and lab el − 1 to the angle at z i in the internal face of E H , while if τ l − S < 0 , we let λ H assign lab el − 1 to the angle at z i in the outer face of E H and lab el 1 to the angle at z i in the internal face of E H . Note that, if τ l − S = 0 , then x = 0 , and a single m ulti-path b etw een w ′ u and w ′ v is inserted. W e assign the edges of the introduced multi-paths to the parts of the edge set of H so that b oth edges incident to eac h vertex among z 1 , . . . , z x b elong the same part. W e complete the definition of ( E H , λ H ) by letting λ H assign lab els at u and v according to λ u and λ v , resp ectively: The lab el of the angle at u in the outer face of E H is λ u and the one at u in the internal face of E H is 0 − λ u , and similar for v . W e pro ve that H and ( E H , λ H ) satisfy the required prop erties. First, note that H is an acyclic digraph. F or the con trary , assume that P l is a directed path from u to v and P r is a directed path from v to u . By construction, P l is a directed path from u to v if and only if τ l = 0 , and P r is a directed path from v to u if and only if τ r = 0 . By construction, since the edge of P l inciden t to u is outgoing from u , w e ha v e ρ u l = out ; similarly , w e hav e ρ v l = in , ρ v r = out , and ρ u r = in . F urthermore, b y construction we ha ve ρ u l = ρ u r if and only if λ u = 0 ; similarly , we ha ve λ v = 0 . Ho wev er, this con tradicts the definition of the v alue τ r , whic h requires τ r = 2 − τ l − λ u − λ v . Second, since H is a cycle, then clearly E H is a planar embedding in which u and v are inciden t to the outer face. Third, we pro ve that ( E H , λ H ) is an upw ard embedding. Since E H is a planar embedding, w e need to prov e that λ H is an upw ard-consistent angle assignmen t, hence it satisfies Prop erties C1–C3, see also Theorem 1 . Concerning Properties C1 and C2, note that the degree of every vertex of H is 2 , hence the sum of the lab els assigned to eac h v ertex has to b e 0 . By construction the in ternal v ertices of the m ulti-paths, as well as the vertices w ′ u and w ′ v define tw o flat angles that are b oth assigned lab el 0 b y λ H , while the v ertices z 1 , . . . , z x define t w o switc h angles which are one assigned label − 1 and one assigned 1 b y λ H . V ertex w u (the argument for w v is analogous) either defines tw o flat angles that are b oth assigned label 0 by λ H (if α u l = 0 ), or defines tw o switc h angles whic h are one assigned lab el − 1 and one assigned 1 b y λ H (if α u l = 1 ). Finally , b y construction, vertex u (the argumen t for v is analogous) defines t wo flat angles which are assigned label 0 by λ H if λ u = 0 , and tw o switch angles whic h are one assigned lab el − 1 and one assigned 1 by λ H if λ u = ± 1 . Concerning Property C3, b y construction the left-turn-n umber and right-turn-n umber of ( E H , λ H ) are τ l and τ r , respectively , while the lab el of the angles at u and v in the outer face of E H are G. Da Lozzo, F. F rati, and I. Rutter 39 resp ectiv ely λ u and λ v . The fact that the sum of the lab els assigned to the angles in the outer face of E H is 2 hence follows from τ r = 2 − τ l − λ u − λ v . Since ev ery angle in the inte rnal face of E H is assigned a lab el which sums up to 0 with the lab el assigned to the angle at the same v ertex in the outer face of E H , it follows that the sum of the lab els assigned to the angles in the internal face of E H is − 2 . F ourth, w e prov e that ( E H , λ H ) is 4-mo dal. Consider an y v ertex z of P l , the argumen t for the v ertices of P r is symmetric. If z is in ternal to some multi-path, or if z = w ′ u , or if z = w ′ v , then it has one incoming and one outgoing edge, hence it is 4-mo dal. If z ∈ { z 1 , . . . , z x } , then it is inciden t to t wo edges in the same part of the edge set of H , hence it is 4-mo dal. If z = w u (the argument for the case in which z = w v is analogous), then either it has one incoming and one outgoing edge (if α u l = 0 ), or it is inciden t to t wo edges in the same part of the edge set of H (if α u l = 1 ), hence it is 4-mo dal. Finally , Chec k 6 ensures that u and v are 4-mo dal. Finally , w e prov e that ( E H , λ H ) con tains no impossible face. By definition, a multi-path con tains b oth left and right edges, hence every maximal directed path in H that is en tirely comp osed of left edges or entirely comp osed of righ t edges contains u or con tains v (or con tains b oth). Let f I and f O b e the internal and outer face of E H . ∗ W e pro ve that f I is not imp ossible. Indeed, we sho w that the edge connecting u to its neighbor w u is not part of a maximal directed path causing f I to b e imp ossible, the pro of for the other three edges incident to u or v is analogous. If α u l = 1 , then the angle at w u in f I is lab eled 1 , hence the maximal directed path con taining the edge connecting u to w u do es not ha ve a small angle in f I at its end-v ertex and th us do es not cause f I to b e imp ossible. If α u l = 0 , then the maximal directed path con taining the edge connecting u to w u also con tains the multi-path betw een w u and w ′ u , hence it is not entirely composed of left edges or en tirely comp osed of righ t edges and do es not cause f I to b e imp ossible. ∗ That the edges connecting u and v to its neigh b ors do not b elong to any maximal directed path causing f O to be imp ossible is ensured b y Checks 7–11. Namely , Chec k 7 deals with directed paths that hav e u and v as end-vertices, Chec k 8 deals with directed paths that ha ve one of u and v as an end-v ertex and do not contain the other one, Chec k 9 deals with directed paths that hav e one of u and v as an in ternal vertex and do not con tain the other one, Check 10 deals with directed paths that hav e one of u and v as an internal v ertex and the other one as an end-v ertex, and finally Chec k 11 deals with directed paths that ha ve u and v as internal vertices. This concludes the pro of of the lemma. ◀ Consider a uv -external goo d embedding ( E µ , λ µ ) of G µ with descriptor pair ( σ, ω ) . F or i = 1 , . . . , k , let E ν i b e the uv -external go o d embedding ( E ν i , λ ν i ) of G ν i whic h is the restriction of E µ to G ν i and let ( σ i , ω i ) b e the descriptor pair of ( E ν i , λ ν i ) . Assume, without loss of generalit y up to a c hange of the indices of the no des ν i , that the clockwise order around u in E µ of the p ertinent graphs of the c hildren of µ is G ν 1 , . . . , G ν k , where the left outer path of E ν 1 is also the left outer path of E µ and the right outer path of E ν k is also the right outer path of E µ . The sequence S µ = [( σ 1 , ω 1 ) , . . . , ( σ k , ω k )] is then called the descriptor se quenc e of ( E µ , λ µ ) . The c ontr acte d descriptor se quenc e of ( E µ , λ µ ) is the sequence of descriptor pairs obtained from S µ b y identifying consecutiv e descriptor pairs that are equal; refer to Fig. 15 for an example. Finally , the gener ating set G ( σ, ω ) for the descriptor pair ( σ, ω ) is the set of contracted descriptor sequences that a P-node µ with p oles u and v can ha ve in a uv -external goo d em b edding with descriptor pair ( σ, ω ) . W e hav e the following. 40 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs + + + − − − − G ν 1 G ν 2 G ν 3 G ν 4 G ν 6 G ν 7 v S S S . . . . . . ν 1 ν 2 ν 7 u , v µ P + − G ν 5 + − − + + − + u − − + + Figure 15 A uv -external goo d em b edding ( E µ , λ µ ) of the p ertinent graph G µ of a P-no de µ of the SPQ-tree of a biconnected partitioned directed 2 -tree. T o av oid visual cluttering, only the large and small angles on the left and righ t outer paths of the graphs G ν 1 , G ν 2 , . . . , G ν 7 are sho wn; large and small angles are lab eled with a + and a − sign, resp ectively . The descriptor pair ( σ, ω ) of ( E µ , λ µ ) is such that σ = ⟨ 1 , 2 , 0 , − 1 , out , in , out , out ⟩ and ω = ⟨ L, R, L, L, 0 , 0 , 1 , 0 , 0 , 0 ⟩ . The descriptor sequence of ( E µ , λ µ ) is [( σ 1 , ω 1 ) , ( σ 2 , ω 2 ) , . . . , ( σ 7 , ω 7 )] and these are the descriptor pairs of the uv -external go o d em b eddings of the graphs G ν 1 , G ν 2 , . . . , G ν 7 in ( E µ , λ µ ) , resp ectively . The shape descriptors are σ 1 = ⟨ 1 , − 1 , 1 , 1 , out , out , out , out ⟩ , σ 2 = ⟨ 0 , 0 , 1 , 1 , out , out , in , in ⟩ , σ 3 = σ 4 = ⟨ 0 , 0 , 1 , 1 , out , out , in , in ⟩ , σ 5 = σ 6 = ⟨− 1 , 1 , 1 , 1 , out , out , out , out ⟩ , σ 7 = ⟨− 2 , 2 , 1 , 1 , in , in , out , out ⟩ , and the pb e descriptors are ω 1 = ⟨ L, L, L, L, 0 , 0 , 1 , 0 , 0 , 0 ⟩ , ω 2 = ⟨ L, L, L, L, 1 , 0 , 0 , 0 , 0 , 0 ⟩ , ω 3 = ω 4 = ⟨ R, R, L, L, 0 , 0 , 0 , 0 , 0 , 0 ⟩ , ω 5 = ω 6 = ⟨ R, R, L, L, 0 , 0 , 0 , 0 , 0 , 0 ⟩ , and ω 7 = ⟨ R, R, L, L, 0 , 0 , 1 , 0 , 0 , 0 ⟩ . The contracted descriptor sequence of ( E µ , λ µ ) is [( σ 1 , ω 1 ) , ( σ 2 , ω 2 ) , ( σ 3 , ω 3 ) , ( σ 5 , ω 5 ) , ( σ 7 , ω 7 )] . ▶ Lemma 14. The gener ating set G ( σ, ω ) of a descriptor p air ( σ, ω ) has size O (1) and c an b e c onstructe d in O (1) time. F urther, e ach c ontr acte d descriptor se quenc e in G ( σ, ω ) has length O (1) . Pro of. Consider a uv -external go o d embedding ( E µ , λ µ ) of G µ with descriptor pair ( σ, ω ) . Let σ = ⟨ τ l , τ r , λ u , λ v , ρ u l , ρ u r , ρ v l , ρ v r ⟩ and ω = ⟨ p u l , p u r , p v l , p v r , χ l , χ r , α u l , α u r , α v l , α v r ⟩ . F or i = 1 , . . . , k , let ( E ν i , λ ν i ) b e the uv -external go o d embedding of G ν i in ( E µ , λ µ ) . F or each p ertinen t graph G ν i of a c hild ν i of µ , let ( E ν i , λ ν i ) b e its uv -external go o d em b edding in ( E µ , λ µ ) , let ( σ i , ω i ) b e the descriptor pair of ( E ν i , λ ν i ) , let σ i = ⟨ τ i l , τ i r , λ i,u , λ i,v , ρ i,u l , ρ i,u r , ρ i,v l , ρ i,v r ⟩ and let ω i = ⟨ p i,u l , p i,u r , p i,v l , p i,v r , χ i l , χ i r , α i,u l , α i,u r , α i,v l , α i,v r ⟩ . W e first pro v e that the generating set G ( σ, ω ) of ( σ, ω ) has size O (1) and that eac h con tracted descriptor sequence in G ( σ, ω ) has length O (1) . The key p oint for the pro of is that, in ( E µ , λ µ ) , there are only constantly-man y flat or large angles at u and v , and constan tly-many c hanges b etw een left and right edges in the circular orders of inciden t edges around u and v . The embeddings ( E ν i , λ ν i ) whose descriptor pair is not the same as the one of an em b edding ( E ν j , λ ν j ) next to them in ( E µ , λ µ ) are found where something “notable” happ ens in ( E µ , λ µ ) . W e deem notable the fact that ( E ν i , λ ν i ) is inciden t to the outer face of E µ , or that the angle at u or v in the outer face of ( E ν i , λ ν i ) is not large, or that the edges inciden t to u on the outer face of ( E ν i , λ ν i ) are not in the same part of the edge set of G , or G. Da Lozzo, F. F rati, and I. Rutter 41 that the edges inciden t to v on the outer face of ( E ν i , λ ν i ) are not in the same part of the edge set of G , or that an internal face of E µ that is incident to E ν i has an angle at u or v that is not small or that is delimited b y t w o edges that are not in the same part of the edge set of G . A contracted descriptor sequence migh t contain constan tly-many additional descriptor pairs “close to” where something notable happens. Any suc h additional descriptor pair represen ts arbitrarily man y graphs, all em b edded with that descriptor pair in ( E µ , λ µ ) , that can b e placed next to each other, without modifying the fact that we ov erall ha ve a uv -external go o d embedding with descriptor pair ( σ, ω ) . F ormally , a descriptor pair ( σ i , ω i ) is called r eplic able if it satisfies the following prop erties. First, λ i,u = λ i,u = 1 ; second, ρ i,u l = ρ i,u r , p i,u l = p i,u r ; third, ρ i,v l = ρ i,v r and p i,v l = p i,v r ; and finally , χ i l = χ i r = α i,u l = α i,u r = α i,v l = α i,v r = 0 . A descriptor pair that is not replicable is called sp e cial . First, w e note that a con tracted descriptor sequence contains O (1) special descriptor pairs. This is immediate for special descriptor pairs that violate λ i,u = λ i,u = 1 , or ρ i,u l = ρ i,u r , or p i,u l = p i,u r , or ρ i,v l = ρ i,v r , or p i,v l = p i,v r . If a special descriptor pair ( σ i , ω i ) violates χ i l = α i,u l = α i,v l = 0 , then this forces the face that is inciden t to the left outer path of ( E ν i , λ ν i ) to be either the outer face or to ha v e a non-small angle at u or v , otherwise the face w ould b e imp ossible in ( E µ , λ µ ) ; hence, there are constantly-man y of such special descriptor pairs. An analogous argument for the special descriptor pairs that violate χ i r = α i,u r = α i,v r = 0 sho ws that altogether there are O (1) special descriptor pairs. Now consider tw o replicable descriptor pairs ( σ i , ω i ) and ( σ j , ω j ) that are consecutiv e in the contracted shape sequence of ( E µ , λ µ ) , and let f b e the in ternal face of E µ b ounded b y the corresp onding em b eddings. Supp ose that the angles β u and β v at u and v in f are small, that the edges inciden t to u on f are in the same part of the edge set of G , and that the edges inciden t to v on f are in the same part of the edge set of G , as these conditions can only b e violated constantly- man y times. This implies that λ i,u = λ i,v = λ j,u = λ j,v = 1 , that ρ i,u l = ρ i,u r = ρ j,u l = ρ j,u r , that ρ i,v l = ρ i,v r = ρ j,v l = ρ j,v r , that p i,u l = p i,u r = p j,u l = p j,u r , that p i,v l = p i,v r = p j,v l = p j,v r , and that χ i l = χ i r = α i,u l = α i,u r = α i,v l = α i,v r = χ j l = χ j r = α j,u l = α j,u r = α j,v l = α j,v r = 0 . Also, w e hav e τ j l = τ i l and τ j r = τ i r , where the former comes from τ j l + τ i r + β u + β v = − 2 ⇒ τ j l = − τ i r and from τ i l + τ i r + λ i,u + λ i,v = 2 ⇒ τ i l = − τ i r , and the latter comes from τ j l = − τ i r and from τ j l + τ j r + λ j,u + λ j,v = 2 ⇒ τ j l = − τ j r . Hence, the t w o descriptor pairs ( σ i , ω i ) and ( σ j , ω j ) coincide, and th us they would be contracted in to a single descriptor pair in the contracted descriptor sequence of ( E µ , λ µ ) . This concludes the pro of that each con tracted descriptor sequence in G ( σ, ω ) has length O (1) . In order to prov e that G ( σ, ω ) has size O (1) , note that each elemen t of a descriptor pair can only assume constan tly-many differen t v alues, with the apparent exception of the left- and right-turn-n umbers. Ho wev er, since the left-turn-n umber of ( σ, ω ) is τ l , and hence so is the left-turn-n umber of ( σ i , ω i ) , where ( E ν i , λ ν i ) con tains the left outer path of ( E µ , λ µ ) , then the left-turn-num b er of every descriptor pair ( σ i , ω i ) in the sequence can only be in the in terv al [ τ l − 4 , τ l ] ; this is b ecause, for every other descriptor pair ( σ j , ω j ) in the contracted descriptor sequence, τ j l = τ i l − λ u x − λ v y − 2 , where λ u x , λ v y ∈ {− 1 , 0 , 1 } are the angles at u and v in the internal face of the graph comp osed of the left outer path of ( E ν i , λ ν i ) and of the left outer path of an em b edding ( E ν j , λ ν j ) with descriptor pair ( σ j , ω j ) . Similarly , the righ t-turn-n um b ers of the descriptor pairs in a con tracted descriptor sequence can only assume constantly-man y differen t v alues. Since eac h contracted descriptor sequence has length O (1) , this results in constan tly-many differen t contracted descriptor sequences, and hence G ( σ, ω ) has size O (1) . W e now sho w ho w to construct, in O (1) time, the generating set G ( σ, ω ) . W e start b y in tro ducing some definitions. W e define the e dge-typ e se quenc e π u of u in ( σ, ω ) as follo ws. 42 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs Recall that, in clo c kwise order around u in a go o d embedding of G µ , the edges inciden t to u app ear in the clockwise circular order: left outgoing (LO), right outgoing (RO), righ t incoming (RI), and left incoming (LI). Then π u defines the linear order in which the four t yp es of edges can be encountered around u in ( E µ , λ µ ) , starting at the edge on the left outer path and ending at the edge on the right outer path and mo ving clockwise. Th us, the first element of π u is defined by the lab els ρ u l and p u l and then π u follo ws the elements in the circular sequence [LO, RO, RI, LI] until the edge t yp e corresp onding to the lab els ρ u r and p u r is encountered. This completely defines π u , unless ρ u l = ρ u r and p u l = p u r ; in this case, if λ u = 1 , then π u consists of just one elemen t, while if λ u = − 1 , then π u consists of fiv e elemen ts. The e dge-typ e se quenc e π v of v in ( σ, ω ) is defined analogously , how ever the edge types are considered in coun ter-clo ckwise order, so that the sequence again starts from the left outer path and ends at the right outer path. W e construct the generating set G ( σ, ω ) b y rep eated augmentations. Throughout the pro cess, G ( σ, ω ) con tains initial subsequences of the contracted descriptor sequences that ev en tually form the generating set G ( σ, ω ) . An initial subsequence of the edge-type se- quence π u of u in ( σ, ω ) and an initial subsequence of the edge-type sequence π v of v in ( σ, ω ) are asso ciated to each sequence in G ( σ, ω ) . These represent the edge t yp es that are used b y the curren t subsequence of the contracted descriptor sequence. W e call final a sequence in G ( σ, ω ) that b elongs to the final generating set G ( σ, ω ) . W e initialize G ( σ, ω ) by inserting in to it sev eral sequences, eac h comp osed of a sin- gle descriptor pair ( σ 1 , ω 1 ) ∈ U | V ( G µ ) | , where σ 1 = ⟨ τ 1 l , τ 1 r , λ 1 ,u , λ 1 ,v , ρ 1 ,u l , ρ 1 ,u r , ρ 1 ,v l , ρ 1 ,v r ⟩ and ω 1 = ⟨ p 1 ,u l , p 1 ,u r , p 1 ,v l , p 1 ,v r , χ 1 l , χ 1 r , α 1 ,u l , α 1 ,u r , α 1 ,v l , α 1 ,v r ⟩ . The descriptor pairs ( σ 1 , ω 1 ) that comp ose the sequences to b e initially inserted into G ( σ, ω ) are constructed as follo ws. First, since the left outer path of ( E µ , λ µ ) coincides with the o ne of the “leftmost” pertinent graph of a c hild of µ , the labels τ 1 l , ρ 1 ,u l , ρ 1 ,v l , p 1 ,u l , p 1 ,v l , χ 1 l , α 1 ,u l , and α 1 ,v l are univ o cally determined by ( σ, ω ) , namely τ 1 l = τ l , ρ 1 ,u l = ρ u l , ρ 1 ,v l = ρ v l , p 1 ,u l = p u l , p 1 ,v l = p v l , χ 1 l = χ l , α 1 ,u l = α u l , and α 1 ,v l = α v l . The lab els λ 1 ,u , ρ 1 ,u r , and p 1 ,u r are defined by the choice of an initial subsequence π ′ u (with | π ′ u | ≥ 1 ) of the edge-type sequence π u of u in ( σ, ω ) . Indeed, the last element of π ′ u directly defines ρ 1 ,u r and p 1 ,u r ; also, we ha ve λ 1 ,u = 1 if | π ′ u | ≤ 2 and ρ 1 ,u l = ρ 1 ,u r , we ha v e λ 1 ,u = − 1 if | π ′ u | ≥ 4 and ρ 1 ,u l = ρ 1 ,u r , and we ha ve λ 1 ,u = 0 otherwise; the initial subsequence π ′ u is asso ciated to the sequence. The labels λ 1 ,v , ρ 1 ,v r , and p 1 ,v r are analogously defined b y the choice of an initial subse- quence π ′ v (with | π ′ v | ≥ 1 ) of π v ; also, π ′ v is asso ciated to the sequence. The lab el τ 1 r is set to 2 − τ 1 l − λ 1 ,u − λ 1 ,v . The lab el χ 1 r is set to 0 if τ 1 r = 0 , or if ρ 1 ,u r = ρ 1 ,v r , or if p 1 ,u r = p 1 ,v r , or if ρ 1 ,u r = out and p 1 ,u r = L , or if ρ 1 ,u r = in and p 1 ,u l = R , or if ρ 1 ,v r = in and p 1 ,v r = L , or if ρ 1 ,v r = out and p 1 ,v l = R , as in these cases the righ t outer path of a uv -external go o d em b edding with descriptor pair ( σ 1 , ω 1 ) is not a directed path comp osed of left edges with the outer face to its left or comp osed of right edges with the outer face to its right. Also, the label χ 1 r is set to 0 if λ 1 ,u = λ u , λ 1 ,v = λ v , and χ r = 0 . Indeed, if the graph whose uv -external go o d em b edding has descriptor pair ( σ 1 , ω 1 ) is the rightmost in clo ckwise order around u , this is required by the condition χ r = 0 ; if the graph whose uv -external go o d embedding has descriptor pair ( σ 1 , ω 1 ) has another graph to its righ t, then having χ 1 r = 1 w ould imply that the face b etw een such t wo graphs is impossible, giv en that the equalities λ 1 ,u = λ u and λ 1 ,v = λ v imply that the angles at u and v in suc h a face hav e lab el − 1 . Finally , if none of the previous conditions applies, we set the label χ 1 r in b oth p ossible wa ys. G. Da Lozzo, F. F rati, and I. Rutter 43 The lab el α 1 ,u r is set to 0 if χ 1 r = 1 , or if ρ 1 ,u r = out and p 1 ,u r = L , or if ρ 1 ,u r = in and p 1 ,u l = R , or if λ 1 ,u = λ u and α u r = 0 . If none of the previous conditions applies, we set the lab el α 1 ,u r in b oth p ossible wa ys. The lab el α 1 ,v r is set analogously . This concludes the description of the initialization of G ( σ, ω ) . No w consider any sequence S = [( σ 1 , ω 1 ) , . . . , ( σ i , ω i )] curren tly in G ( σ, ω ) . If the sub- sequence of π u asso ciated to S coincides with π u , if the subsequence of π v asso ciated to S coincides with π v , and if χ i r = χ r , α i,u r = α u r , and α i,v r = α v r , then S is final. If w e also ha ve α u r = α v r = χ r = 0 and ( σ i , ω i ) is not replicable, then w e insert in G ( σ, ω ) also the final sequence S ′ obtained by appending to S a replicable descriptor pair ( σ i +1 , ω i +1 ) with τ i +1 r = τ i r , ρ i +1 ,u l = ρ i,u r , ρ i +1 ,v l = ρ i,v r , p i +1 ,u l = p i,u r , and p i +1 ,v l = p i,v r (the other lab els are forced by the definition of replicable descriptor pair). If S is not final, then we construct sev eral sequences that replace it in G ( σ, ω ) , each obtained by app ending a descriptor pair ( σ i +1 , ω i +1 ) to S , as describ ed in the following. Let π u ( S ) and π v ( S ) b e the initial subsequences of π u and π v asso ciated to S , resp ectiv ely . W e pic k, in all p ossible wa ys according to the rules described b elow, t w o elements in π u that are the edge types of the edges inciden t to u and on the outer face of an em b edding with descriptor pair ( σ i +1 , ω i +1 ) ; the first pic ked elemen t either coincides with the last elemen t of π u ( S ) or follo ws it in π u , while the second pic ked elemen t either coincides with the first pic ked elemen t or follows it in π u . These elemen ts determine the lab els ρ i +1 ,u l , p i +1 ,u l , ρ i +1 ,u r , and p i +1 ,u r , for example if the first pic ked element is LI, then ρ i +1 ,u l = in and p i +1 ,u l = L . The elements also determine λ i +1 ,u , namely λ i +1 ,u = 1 if the length of the subsequence of π u comp osed of the elements b etw een the first and the second pic k ed elemen t is at most 2 and ρ i +1 ,u l = ρ i +1 ,u r , λ i +1 ,u = − 1 if such length is at least 4 and ρ i +1 ,u l = ρ i +1 ,u r , and λ i +1 ,u = 0 otherwise. T wo elemen ts in π v are pic k ed with analogous rules, and this determines the five labels ρ i +1 ,v l , p i +1 ,v l , ρ i +1 ,v r , p i +1 ,u r , and λ i +1 ,v . The lab els τ i +1 l and τ i +1 r are also determined by the choice made. Namely , consider the face f b et w een the em b eddings with descriptor pairs ( σ i , ω i ) and ( σ i +1 , ω i +1 ) . The angle β u at u in f has lab el − 1 if the length of the subsequence of π u comp osed of the elements b et w een the last element in π u ( S ) and the first pic ked elemen t is at most 2 and ρ i,u r = ρ i +1 ,u l , has lab el 1 if suc h length is at least 4 and ρ i,u r = ρ i +1 ,u l , and it has lab el 0 otherwise. The lab el of the angle β v at v in f is computed analogously . Then w e ha ve τ i +1 l = − 2 − τ i r − β u − β v and w e hav e τ i +1 r = 2 − τ i +1 l − λ i +1 ,u − λ i +1 ,v . It remains to deal with the lab els χ i +1 l , α i +1 ,u l , α i +1 ,v l , χ i +1 r , α i +1 ,u r , α i +1 ,v r . F or these labels we perform all p ossible choices, completing the definition of ( σ i +1 , ω i +1 ) in sev eral, constantly-man y , wa ys. W e discard those descriptor pairs ( σ i +1 , ω i +1 ) in whic h one of the follo wing conditions is satisfied, as eac h condition implies a contradiction to the meaning of the lab els, or that f is an imp ossible face: ( χ i +1 l = 1 ∧ ( α i +1 ,u l = 1 ∨ α i +1 ,v l = 1)) ∨ ( χ i +1 r = 1 ∧ ( α i +1 ,u r = 1 ∨ α i +1 ,v r = 1)) ; ( β u = − 1 ∧ ( α i,u r = 1 ∨ α i +1 ,u l = 1)) ∨ ( β v = − 1 ∧ ( α i,v r = 1 ∨ α i +1 ,v l = 1)) ∨ ( β u = − 1 ∧ β v = − 1 ∧ χ i r = 1) ∨ ( β u = − 1 ∧ β v = − 1 ∧ χ i +1 l = 1) ; ( β u = 0 ∧ α i,u r = 1 ∧ α i +1 ,u l = 1 ∧ p i,u r = p i +1 ,u l ) ∨ ( β v = 0 ∧ α i,v r = 1 ∧ α i +1 ,v l = 1 ∧ p i,v r = p i +1 ,v l ) ; ( α i +1 ,u l = 1 ∧ β u = 0 ∧ χ i r = 1 ∧ β v = − 1 ∧ p i,u r = p i +1 ,u l ) ∨ ( α i +1 ,v l = 1 ∧ β v = 0 ∧ χ i r = 1 ∧ β u = − 1 ∧ p i,v r = p i +1 ,v l ) ∨ ( α i,u r = 1 ∧ β u = 0 ∧ χ i +1 l = 1 ∧ β v = − 1 ∧ p i,u r = p i +1 ,u l ) ∨ ( α i,v r = 1 ∧ β v = 0 ∧ χ i +1 l = 1 ∧ β u = − 1 ∧ p i,v r = p i +1 ,u l ) ; ( α i +1 ,u l = 1 ∧ β u = 0 ∧ χ i r = 1 ∧ β v = 0 ∧ α i +1 ,v l = 1 ∧ p i,u r = p i +1 ,u l = p i +1 ,v l ) ∨ ( α i,u r = 1 ∧ β u = 0 ∧ χ i +1 l = 1 ∧ β v = 0 ∧ α i,v r = 1 ∧ p i,u r = p i +1 ,u l = p i,v r ) . 44 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs W e also discard those descriptor pairs ( σ i +1 , ω i +1 ) in whic h one of the follo wing conditions is satisfied, as each condition implies that the sequence [( σ 1 , ω 1 ) , . . . , ( σ i , ω i ) , ( σ i +1 , ω i +1 )] cannot b e completed to a con tracted descriptor sequence of a uv -external go o d em b edding with descriptor pair ( σ, ω ) , as the desired v alues for the lab els α u r , α v r , and χ r cannot b e all ac hiev ed without creating an impossible face: α i +1 ,u r = 1 , α u r = 0 , ρ i +1 ,u r = ρ u r , and the final subsequence of π u starting from the second pic k ed elemen t in π u con tains at most tw o elements; α i +1 ,v r = 1 , α v r = 0 , ρ i +1 ,v r = ρ v r , and the final subsequence of π v starting from the second pic k ed elemen t in π v con tains at most tw o elements; χ i +1 r = 1 , χ r = 0 , ρ i +1 ,u r = ρ u r , ρ i +1 ,v r = ρ v r , the final subsequence of π u starting from the second pic ked elemen t in π u con tains at most t wo elemen ts, and the final subsequence of π v starting from the second pick ed element in π v con tains at most tw o elements. Finally , we discard a descriptor pair ( σ i +1 , ω i +1 ) if it is replicable, if it coincides with ( σ i , ω i ) , if the first pic ked elemen t in π u is the last elemen t of π u ( S ) , and if the first pick ed element in π v is the last element of π v ( S ) . F or every descriptor pair ( σ i +1 , ω i +1 ) whic h was not discarded, w e insert in G ( σ, ω ) the sequence [ ( σ 1 , ω 1 ) , . . . , ( σ i , ω i ) , ( σ i +1 , ω i +1 )] . This concludes the description of the construction of G ( σ, ω ) . Since the length of G ( σ, ω ) is O (1) and since at eac h step of the describ ed construction constan tly-man y c hoices and c hec ks are performed, the construction takes o verall O (1) time. ◀ Our algorithm to compute the feasible set F µ of µ is the following. First, w e generate an n -univ ersal set U n of descriptor pairs. By definition, we hav e F µ ⊆ U n . Second, for eac h descriptor pair ( σ, ω ) in U n , we construct the generating set G ( σ, ω ) of ( σ, ω ) . Third, for eac h con tracted descriptor sequence C in G ( σ, ω ) , w e test whether C is r e alizable b y G µ , i.e., whether there exists a uv -external go o d em b edding of G µ whose contracted descriptor sequence is a subsequence of C con taining the first and the last elemen ts of C ; here “subsequence” means a sequence that can b e obtained from C b y deleting elemen ts. In the positive case, w e add ( σ, ω ) to F µ . The running time of the algorithm is as follows. First, the construction of U n tak es O ( n ) time, by Lemma 13 . Second, U n con tains O ( n ) descriptor pairs, again by Lemma 13 . F or each descriptor pair ( σ, ω ) in U n , the construction of the generating set G ( σ, ω ) takes O (1) time, by Lemma 14 . F or eac h contracted descriptor sequence C in G ( σ, ω ) , the decision on whether C is realizable by G µ tak es O ( k ) time, by the up coming Lemma 16 . Since G ( σ, ω ) contains O (1) contracted descriptor sequences, again by Lemma 14 , we hav e that the construction of F µ tak es O ( nk ) time. Before presen ting Lemma 16 , w e motiv ate our definition of realizable con tracted descriptor sequence. Consider a contracted descriptor sequence C . Deciding whether there exists a uv - external go o d em b edding of G µ whose contracted descriptor sequence is C is not an easy task, from an algorithmic p oint of view. Ho wev er, deciding whether there exists a uv -external go o d em b edding of G µ whose contracted descriptor sequence is a subsequence of C con taining the first and the last elemen ts of C is algorithmically easier, and equiv alent, in order to decide whether ( σ, ω ) b elongs to F µ or not. The last statement is justified b y the following lemma. ▶ Lemma 15. L et C b e a c ontr acte d descriptor se quenc e in G ( σ, ω ) . A ny subse quenc e C ′ of C c ontaining the first and last elements of C also b elongs to G ( σ, ω ) . Pro of. Let ( E µ , λ µ ) be a uv -external goo d embedding of a P-node µ with poles u and v suc h that the contracted descriptor sequence of ( E µ , λ µ ) is C . Let ( E ′ µ ′ , λ ′ µ ′ ) b e the restriction of ( E µ , λ µ ) to the graph H comp osed of the p ertinent graphs G ν i whose uv -external go o d em b edding in ( E µ , λ µ ) has a descriptor pair that b elongs to C ′ . Note that there are at least G. Da Lozzo, F. F rati, and I. Rutter 45 t w o suc h p ertinent graphs G ν i . This is ob vious if C con tains more than one descriptor pair, as in this case the first and last elemen ts of C are distinct and b elong to C ′ , b y assumption. Otherwise, C con tains a single elemen t, whic h is necessarily ( σ, ω ) , th us the em b edding of ev ery pertinent graph G ν i in ( E µ , λ µ ) has descriptor pair ( σ, ω ) . Also, µ has at least tw o c hildren, since it is a P-node. Hence, H is the p ertinen t graph G ′ µ ′ of a P-no de µ ′ of the SPQ-tree of a graph G ′ , and C ′ is indeed a contracted descriptor sequence. Also, C ′ b elongs to G ( σ, ω ) , since the descriptor pair of a uv -external goo d em b edding only dep ends on the first and last elemen ts of its con tracted descriptor sequence and these elements are the same in C and C ′ , hence the descriptor pair of a uv -external go o d em b edding of G ′ µ ′ with C ′ as con tracted descriptor sequence is ( σ, ω ) . ◀ W e no w present the follo wing. ▶ Lemma 16. It is p ossible to test in O ( k ) time whether a c ontr acte d descriptor se quenc e C is r e alizable by G µ . Pro of. Let C = [( σ 1 , ω 1 ) , . . . , ( σ ℓ , ω ℓ )] . By Lemma 14 , w e ha ve ℓ ∈ O (1) . W e create a bipartite graph A C with v ertex set ( { ν 1 , . . . , ν k } , { ( σ 1 , ω 1 ) , . . . , ( σ ℓ , ω ℓ ) } ) and with an edge b et w een a vertex ν i and a vertex ( σ j , ω j ) if ( σ j , ω j ) belongs to F ν i . This construction tak es O ( k ) time. Indeed, for each of the k c hildren ν i of µ , b y Lemma 8 it can be tested in O (1) time whether each of the ℓ ∈ O (1) descriptor pairs ( σ j , ω j ) b elongs to F ν i . W e no w test whether C is realizable b y G µ as follo ws. First, if a vertex ν i has degree 0 in A C , then C is not realizable b y G µ ; indeed, F ν i con tains no descriptor pair among those in C , hence an y uv -external go o d em bedding of G µ do es not yield a con tracted descriptor sequence which is a subsequence of C . Second, if ( σ 1 , ω 1 ) or ( σ ℓ , ω ℓ ) has degree 0 in A C , or if ( σ 1 , ω 1 ) and ( σ ℓ , ω ℓ ) ha ve degree 1 and ha ve the same unique neighbor in A C , then C is not realizable by G µ ; indeed, in b oth cases the children of µ cannot b e ordered and assigned with a descriptor pair in their feasible sets so that the first child in the ordering is assigned with ( σ 1 , ω 1 ) and the last child with ( σ ℓ , ω ℓ ) . If we did not conclude that C is not realizable by G µ , then C is realizable by G µ . Indeed, let ( σ m , ω m ) b e the descriptor pair b etw een ( σ 1 , ω 1 ) and ( σ ℓ , ω ℓ ) that has smaller degree in A C and let ( σ M , ω M ) b e the other descriptor pair, with a p ossible tie broken arbitrarily . W e can assign ( σ m , ω m ) to any neigh b or ν x in A C ; this neigh b or exists since the degree of ( σ 1 , ω 1 ) and ( σ ℓ , ω ℓ ) in A C is at least one. Then we can assign ( σ M , ω M ) to a neighbor ν y = ν x ; this neigh b or ob viously exists if the degree of ( σ M , ω M ) in A C is at least tw o, and it exists even if the degree of ( σ M , ω M ) in A C is one, as in this case the unique neigh b ors of ( σ 1 , ω 1 ) and ( σ ℓ , ω ℓ ) are differen t. W e assign each remaining node ν i with any descriptor pair that is a neighbor of ν i in A C . Finally , w e order the children of µ as dictated by C : First the children that ha ve been assigned with the descriptor pair ( σ 1 , ω 1 ) , then the c hildren that hav e b een assigned with the descriptor pair ( σ 2 , ω 2 ) , and so on. Using a uv -external goo d embedding of G ν i with the assigned descriptor pair, for each c hild ν i of µ , results in a uv -external go o d embedding of G µ whose con tracted descriptor sequence is a subsequence of C con taining ( σ 1 , ω 1 ) and ( σ ℓ , ω ℓ ) . Since the describ e test can b e p erformed in O ( k + ℓ ) ∈ O ( k ) time, the lemma follo ws. ◀ W e th us get the follo wing. ▶ Lemma 17. L et µ b e a P-no de of T with childr en ν 1 , . . . , ν k . Given the fe asible sets F ν 1 , . . . , F ν k of ν 1 , . . . , ν k , r esp e ctively, the fe asible set F µ of µ c an b e c ompute d in O ( nk ) time. This sums up to O ( n 2 ) time over al l P-no des of T . 46 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs 6.4 Ro ot The ro ot ρ ∗ of T corresp onds to the en tire graph G and can be treated as a P-no de with t w o children, whose p ertinen t graphs are the edge e ∗ and the p ertinent graph of the c hild σ ∗ of ρ ∗ in T . By Lemma 17 , the feasible set of the root can hence be computed in O ( n ) time from the feasible sets of σ ∗ and of a node represen ting e ∗ ; the latter can b e computed in O (1) time as in Lemma 9 . Once the feasible set F ρ ∗ of ρ ∗ has b een computed, w e hav e that G admits a go o d embedding with e ∗ on the outer face if and only if F ρ ∗ is non-empt y . By Lemmas 9 , 12 , and 17 , the entire pro cessing of T tak es o verall O ( n 2 ) time. Repeating the test for every possible choice of e ∗ leads to the following. ▶ Theo rem 18. L et G b e an n -vertex bic onne cte d p artitione d dir e cte d p artial 2 -tr e e. It is p ossible to test in O ( n 3 ) time whether G admits an upwar d b o ok emb e dding. 7 Conclusions In this pap er, w e considered the problem of computing upw ard b o ok em b eddings of partitioned digraphs. Our researc h fo cused on the previously unsolved case of tw o pages, one of the “ultimate” algorithmic b o ok embedding problems still open (see T able 1 ), and closed the complexit y gap for the problem. W e also conceived a c haracterization of the up ward em b eddings that supp ort such la y outs, and leveraged suc h a c haracterization in com bination with a n um b er of algorithmic to ols, such as flo w techniques, SPQ-decompositions, and concise em b edding encodings to obtain efficient testing algorithms for digraphs with a prescrib ed planar em b edding and for biconnected directed partial 2 -trees with a v ariable embedding. Our results coud b e enhanced in tw o w ays. First, the multiplicativ e linear ov erhead on the running time of our algorithm for biconnected directed partial 2 -trees caused by rerouting the SPQ-tree at every Q-node might be av oided b y using the techniques designed b y Didimo et al. [ 37 ], see also [ 29 , 43 ]. Second, suc h an algorithm migh t b e generalized to handle arbitrary , simply connected, partial 2 -trees; this app ears to b e a non-trivial task, as it requires handling the p ossible nestings of biconnected comp onents in to one another, as prescrib ed b y the structure of the blo ck-cut-v ertex tree, while keeping cut-vertices 4 -mo dal and a v oiding imp ossible faces. A dditional in teresting researc h directions are the following: studying the complexity of the problem for single-source partitioned digraphs and, more generally , for digraphs with a b ounded num b er of sources; determining whether the problem is NP -complete for instances of b ounded treewidth; and devising FPT algorithms with resp ect to parameters that are more restrictiv e than the treewidth. A ckno wledgements. This researc h started at the Summer W orkshop on Graph Dra wing 2024 (SW GD 2024). The authors thank the other participants for useful discussions. References 1 Hugo A. Akita y a, Erik D. Demaine, A dam Hesterb erg, and Quanquan C. Liu. Upw ard partitioned bo ok em b eddings. In F abrizio F rati and Kw an-Liu Ma, editors, 25th International Symp osium on Gr aph Dr awing and Network V isualization (GD’17) , v olume 10692 of LNCS , pages 210–223. Springer, 2017. doi:10.1007/978- 3- 319- 73915- 1\_18 . 2 Md. Jaw aherul Alam, F ranz J. Brandenburg, and Stephen G. K ob ourov. On the bo ok thickness of 1-planar graphs. CoRR , abs/1510.05891, 2015. . G. Da Lozzo, F. F rati, and I. Rutter 47 3 Mohammad Alzohairi and Iv an Riv al. Series-paralle l planar ordered sets ha ve pagenum b er t wo. In Stephen C. North, editor, Gr aph Dr awing, Symp osium on Gr aph Dr awing, GD ’96, Berkeley, California, USA, Septemb er 18-20, Pr o c e e dings , v olume 1190 of LNCS , pages 11–24. Springer, 1996. doi:10.1007/3- 540- 62495- 3\_34 . 4 P atrizio Angelini, Giordano Da Lozzo, Giusepp e Di Battista, and F abrizio F rati. Strip planarit y testing for embedded planar graphs. Algorithmic a , 77(4):1022–1059, 2017. doi: 10.1007/S00453- 016- 0128- 9 . 5 P atrizio Angelini, Giordano Da Lozzo, and Daniel Neu wirth. A dv ancemen ts on SEFE and partitioned b o ok embedding problems. The or. Comput. Sci. , 575:71–89, 2015. doi:10.1016/ j.tcs.2014.11.016 . 6 P atrizio Angelini, Marco Di Bartolomeo, and Giusepp e Di Battista. Implemen ting a partitioned 2-page b o ok embedding testing algorithm. In W alter Didimo and Maurizio Patrignani, editors, 20th International Symp osium on Gr aph Dr awing (GD’12) , volume 7704 of LNCS , pages 79–89. Springer, 2012. doi:10.1007/978- 3- 642- 36763- 2\_8 . 7 Gail H. Atneosen. One-dimensional n -lea ved contin ua. F und. Math. , 74(1):43–45, 1972. doi:10.4064/fm- 74- 1- 43- 45 . 8 P atricia Bachmann, Ignaz Rutter, and P eter Stumpf. On 3-coloring circle graphs. In Mic hael A. Bek os and Markus Chimani, editors, 31st International Symp osium on Gr aph Dr awing and Network Visualization, (GD’23) , v olume 14465 of LNCS , pages 152–160. Springer, 2023. doi:10.1007/978- 3- 031- 49272- 3\_11 . 9 P atricia Bachmann, Ignaz R utter, and Peter Stumpf. On 3-coloring circle graphs. J. Gr aph Algorithms Appl. , 28(1):389–402, 2024. doi:10.7155/jgaa.v28i1.2991 . 10 Mic hael A. Bekos, Till Bruckdorfer, Michael Kaufmann, and Chrysanthi N. Raftopoulou. The b o ok thic kness of 1-planar graphs is constant. Algorithmic a , 79(2):444–465, 2017. doi: 10.1007/s00453- 016- 0203- 2 . 11 Mic hael A. Bekos, Giordano Da Lozzo, F abrizio F rati, Martin Gronemann, T amara Mc hedlidze, and Chrysan thi N. Raftop oulou. Recognizing D AGs with page-n um b er 2 is NP-complete. The or. Comput. Sci. , 946:113689, 2023. doi:10.1016/J.TCS.2023.113689 . 12 Mic hael A. Bekos, Giordano Da Lozzo, Sv enja M. Griesbach, Martin Gronemann, F abrizio Mon tecc hiani, and Chrysanthi Raftop oulou. Book em b eddings of k-framed graphs and k-map graphs. Discr ete Mathematics , 347(1):113690, 2024. doi:10.1016/j.disc.2023.113690 . 13 Mic hael A. Bek os, Martin Gronemann, and Chrysanthi N. Raftopoulou. T wo-page b ook em b eddings of 4-planar graphs. Algorithmic a , 75(1):158–185, 2016. doi:10.1007/ s00453- 015- 0016- 8 . 14 F rank Bernhart and P aul C Kainen. The b o ok thic kness of a graph. Journal of Combinatorial The ory, Series B , 27(3):320–331, 1979. doi:10.1016/0095- 8956(79)90021- 2 . 15 P aola Bertolazzi, Giuseppe Di Battista, Giusepp e Liotta, and Carlo Mannino. Upw ard drawings of triconnected digraphs. Algorithmic a , 12(6):476–497, 1994. doi:10.1007/BF01188716 . 16 P aola Bertolazzi, Giusepp e Di Battista, Carlo Mannino, and Rob erto T amassia. Optimal up ward planarit y testing of single-source digraphs. SIAM J. Comput. , 27(1):132–169, 1998. doi:10.1137/S0097539794279626 . 17 P aola Bertolazzi, Rob ert F. Cohen, Giuseppe Di Battista, Roberto T amassia, and Ioannis G. T ollis. How to dra w a series-parallel digraph. Int. J. Comput. Ge om. A ppl. , 4(4):385–402, 1994. doi:10.1142/S0218195994000215 . 18 Sandeep N. Bhatt, F an R.K. Chung, F.Thomas Leigh ton, and Arnold L. Rosenberg. Sc heduling tree-dags using FIFO queues: A control–memory trade-off. Journal of Par al lel and Distributed Computing , 33(1):55–68, 1996. doi:10.1006/jpdc.1996.0024 . 19 Sujo y Bhore, Giordano Da Lozzo, F abrizio Montecc hiani, and Martin Nöllen burg. On the up ward b o ok thickness problem: Combinatorial and complexity results. Eur. J. Comb. , 110:103662, 2023. doi:10.1016/j.ejc.2022.103662 . 48 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs 20 Sujo y Bhore, Rob ert Ganian, F abrizio Mon tecchiani, and Martin Nöllenburg. P arameterized algorithms for bo ok em b edding problems. J. Gr aph Algorithms A ppl. , 24(4):603–620, 2020. doi:10.7155/jgaa.00526 . 21 T. Biedl, T. Shermer, S. Whitesides, and S. Wismath. Bounds for orthogonal 3-D graph dra wing. Journal of Gr aph Algorithms and Applic ations , 3(4):63–79, Jan. 1999. doi:10.7155/ jgaa.00018 . 22 Therese Biedl. Small drawings of outerplanar graphs, series-parallel graphs, and other planar graphs. Discr et. Comput. Ge om. , 45(1):141–160, 2011. doi:10.1007/S00454- 010- 9310- Z . 23 Carla Binucci, Giordano Da Lozzo, Emilio Di Giacomo, W alter Didimo, T amara Mc hedlidze, and Maurizio Patrignani. Upw ard bo ok em b eddings of st-graphs. In Gill Barequet and Y usu W ang, editors, 35th International Symp osium on Computational Ge ometry (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 . 24 Carla Binucci, Giordano Da Lozzo, Emilio Di Giacomo, W alter Didimo, T amara Mc hedlidze, and Maurizio Patrignani. Up ward b o ok embeddability of st-graphs: Complexity and algorithms. Algorithmic a , 85(12):3521–3571, 2023. doi:10.1007/s00453- 023- 01142- y . 25 Robin L. Blank enship. Bo ok Emb e ddings of Gr aphs . PhD thesis, Louisiana State Univ ersity , 2003. 26 Glencora Borradaile, Philip N. Klein, Shay Mozes, Y ahav Nussbaum, and Christian W ulff- Nilsen. Multiple-source m ultiple-sink maxim um flo w in directed planar graphs in near-linear time. SIAM J. Comput. , 46(4):1280–1303, 2017. doi:10.1137/15M1042929 . 27 Jonathan F. Buss and Peter W. Shor. On the pagen umber of planar graphs. In Ric hard A. DeMillo, editor, Pr oc e e dings of the 16th A nnual A CM Symp osium on The ory of Computing, April 30 - May 2, 1984, W ashington, DC, USA , pages 98–100. A CM, 1984. doi:10.1145/ 800057.808670 . 28 Stev en Chaplick, Emilio Di Giacomo, F abrizio F rati, Rob ert Ganian, Chrysanthi N. Raftop oulou, and Kirill Simonov. P arameterized algorithms for up w ard planarity . In Xavier Goao c and Michael Kerb er, editors, 38th International Symp osium on Computational Ge ometry (SOCG’22) , v olume 224 of LIPIcs , pages 26:1–26:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPICS.SOCG.2022.26 . 29 Stev en Chaplick, Emilio Di Giacomo, F abrizio F rati, Rob ert Ganian, Chrysanthi N. Raftop oulou, and Kirill Simono v. T esting upw ard planarity of partial 2-trees. In P atrizio Angelini and Reinhard von Hanxleden, editors, 30th International Symp osium on Gr aph Dr awing and Network Visualization (GD’22) , v olume 13764 of LNCS , pages 175–187. Springer, 2022. doi:10.1007/978- 3- 031- 22203- 0\_13 . 30 F an R. K. Chung, F rank Thomson Leigh ton, and Arnold L. Rosen b erg. Em b edding graphs in bo oks: A la yout problem with applications to VLSI design. SIAM Journal on Algebr aic Discr ete Metho ds , 8(1):33–58, 1987. doi:10.1137/0608002 . 31 Gérard Corn uéjols, Denis Naddef, and William R. Pulleyblank. Halin graphs and the tra velling salesman problem. Math. Pr o gr am. , 26(3):287–294, 1983. doi:10.1007/BF02591867 . 32 Hub ert de F ra ysseix, P atrice Ossona de Mendez, and János P ac h. A left-first searc h algorithm for planar graphs. Discr ete & Computational Ge ometry , 13:459–468, 1995. doi:10.1007/ BF02574056 . 33 Giusepp e Di Battista and Rob erto T amassia. Algorithms for plane represen tations of acyclic digraphs. The or. Comput. Sci. , 61:175–198, 1988. doi:10.1016/0304- 3975(88)90123- 5 . 34 Giusepp e Di Battista and R oberto T amassia. On-line planarity testing. SIAM J. Comput. , 25(5):956–997, 1996. doi:10.1137/S0097539794280736 . 35 Emilio Di Giacomo, W alter Didimo, Giuseppe Liotta, and Stephen K. Wismath. Book em b eddabilit y of series-parallel digraphs. Algorithmic a , 45(4):531–547, 2006. doi:10.1007/ s00453- 005- 1185- 7 . 36 W alter Didimo, F rancesco Giordano, and Giusepp e Liotta. Up ward spiralit y and up ward planarit y testing. SIAM J. Discr et. Math. , 23(4):1842–1899, 2009. doi:10.1137/070696854 . G. Da Lozzo, F. F rati, and I. Rutter 49 37 W alter Didimo, Giusepp e Liotta, Giacomo Ortali, and Maurizio Patrignani. Optimal orthogonal dra wings of planar 3-graphs in linear time. In Shuc hi Chawla, editor, 31st A CM-SIAM Symp osium on Discr ete Algorithms (SODA ’20) , pages 806–825. SIAM, 2020. doi:10.1137/1. 9781611975994.49 . 38 Vida Dujmović and David R. W o o d. Graph treewidth and geometric thic kness parameters. Discr et. Comput. Ge om. , 37(4):641–670, 2007. doi:10.1007/s00454- 007- 1318- 7 . 39 Vida Dujmo vić and Da vid R. W o o d. On linear la youts of graphs. Discr et. Math. The or. Comput. Sci. , 6(2):339–358, 2004. doi:10.46298/dmtcs.317 . 40 Hazel Everett, Sylv ain Lazard, Giusepp e Liotta, and Stephen Wismath. Universal sets of n p oin ts for one-b end drawings of planar graphs with n v ertices. Discr et. Comput. Ge om. , 43(2):272–288, 2010. doi:10.1007/s00454- 009- 9149- 3 . 41 Gün ter Ewald. Hamiltonian circuits in simplicial complexes. Ge ometriae De dic ata , 2(1):115– 125, 1973. doi:10.1007/BF00149287 . 42 F abrizio F rati. Low er b ounds on the area requiremen ts of series-parallel graphs. Discret. Math. The or. Comput. Sci. , 12(5):139–174, 2010. doi:10.46298/DMTCS.500 . 43 F abrizio F rati. Planar rectilinear drawings of outerplanar graphs in linear time. Comput. Ge om. , 103:101854, 2022. doi:10.1016/J.COMGEO.2021.101854 . 44 F abrizio F rati, Joachim Gudm undsson, and Emo W elzl. On the num b er of upw ard planar orien tations of maximal planar graphs. The or. Comput. Sci. , 544:32–59, 2014. doi:10.1016/ J.TCS.2014.04.024 . 45 Rob ert Ganian, Haik o Müller, Sebastian Ordyniak, Giacomo P aesani, and Mateusz Ryc hlicki. A tigh t sub exp onential-time algorithm for tw o-page bo ok embedding. In Karl Bringmann, Martin Grohe, Gabriele Puppis, and Ola Svensson, editors, 51st International Col lo quium on A utomata, L anguages, and Pr o gr amming (ICALP’24) , v olume 297 of LIPIcs , pages 68:1–68:18. Sc hloss Dagstuhl - Leibniz-Zen trum für Informatik, 2024. doi:10.4230/LIPIcs.ICALP.2024.68 . 46 Joseph L. Ganley and Len woo d S. Heath. The pagen umber of k -trees is O ( k ) . Discr et. Appl. Math. , 109(3):215–221, 2001. doi:10.1016/S0166- 218X(00)00178- 5 . 47 Ashim Garg and Rob erto T amassia. On the computational complexity of upw ard and rectilinear planarit y testing. SIAM J. Comput. , 31(2):601–625, 2001. doi:10.1137/S0097539794277123 . 48 F. Giordano, G. Liotta, T. Mc hedlidze, A. Sym vonis, and S.H. Whitesides. Computing upw ard top ological bo ok embeddings of up ward planar digraphs. Journal of Discr ete Algorithms , 30:45–69, 2015. doi:10.1016/j.jda.2014.11.006 . 49 Xiaxia Guan and W eih ua Y ang. Embedding 5-planar graphs in three pages. CoRR , 1801.07097, 2018. 50 Carsten Gutw enger and Petra Mutzel. A linear time implemen tation of SPQR-trees. In Joe Marks, editor, 8th International Symp osium on Gr aph Dr awing (GD’00) , volume 1984 of LNCS , pages 77–90. Springer, 2000. doi:10.1007/3- 540- 44541- 2_8 . 51 Len woo d S. Heath. Embedding planar graphs in seven pages. In 25th A nnual Symp osium on F oundations of Computer Scienc e, W est Palm Be ach, Florida, USA, 24-26 Octob er 1984 , pages 74–83. IEEE Computer So ciet y , 1984. doi:10.1109/SFCS.1984.715903 . 52 Len woo d S. Heath and Sriram V. P emmara ju. Stac k and queue la youts of directed acyclic graphs: P art I I. SIAM J. Comput. , 28(5):1588–1626, 1999. doi:10.1137/S0097539795291550 . 53 Len woo d S Heath, Sriram V P emmara ju, and Calvin J Ribbens. Sp arse matrix-ve ctor multiplic ation on a smal l line ar arr ay . Universit y of Iow a, Departmen t of Computer Science, 1993. 54 Len woo d S. Heath, Sriram V. Pemmaraju, and Ann N. T renk. Stac k and queue lay outs of directed acyclic graphs: Part I. SIAM J. Comput. , 28(4):1510–1539, 1999. doi:10.1137/ S0097539795280287 . 55 Mic hael Hoffmann and Boris Klemz. T riconnected planar graphs of maximum degree five are subhamiltonian. In Michael A. Bender, Ola Svensson, and Grzegorz Herman, editors, ESA , v olume 144 of LIPIcs , pages 58:1–58:14. Sc hloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ESA.2019.58 . 50 Up wa rd Bo ok Emb eddings of Pa rtitioned Digraphs 56 Seok-Hee Hong and Hiroshi Nagamo chi. T wo-page bo ok embedding and clustered graph planarit y . T echnical rep ort, Dept. of Applied Mathematics and Physics, Univ ersit y of Ky oto, Japan, 2009. 57 Seok-Hee Hong and Hiroshi Nagamochi. Simpler algorithms for testing tw o-page bo ok em b ed- ding of partitioned graphs. The or. Comput. Sci. , 725:79–98, 2018. doi:10.1016/J.TCS.2015. 12.039 . 58 Sorin Istrail. An algorithm for embedding planar graphs in six pages. Iasi University A nnals, Mathematics-Computer Scienc e , 34(4):329–341, 1988. 59 G. Jacobson. Space-efficient static trees and graphs. In 30th A nnual Symp osium on F oundations of Computer Scienc e (FOCS ’89) , pages 549–554. IEEE Computer So ciety , 1989. doi:10. 1109/SFCS.1989.63533 . 60 Bart M. P . Jansen, Liana Khazaliya, Philipp Kindermann, Giusepp e Liotta, F abrizio Montec- c hiani, and Kirill Simono v. Up ward and orthogonal planarity are W[1]-hard parameterized by treewidth. In Mic hael A. Bekos and Markus Chimani, editors, 31st International Symp osium on Gr aph Dr awing and Network Visualization (GD’23) , volume 14466 of LNCS , pages 203–217. Springer, 2023. doi:10.1007/978- 3- 031- 49275- 4\_14 . 61 P aul Jungeblut, Laura Merker, and T orsten Ueck erdt. Directed acyclic outerplanar graphs ha v e constan t stac k n umber. In 64th IEEE A nnual Symp osium on F oundations of Computer Scienc e, FOCS 2023, Santa Cruz, CA, USA, Novemb er 6-9, 2023 , pages 1937–1952. IEEE, 2023. doi:10.1109/FOCS57990.2023.00118 . 62 P aul Jungeblut, Laura Merker, and T orsten Uec kerdt. A sublinear bound on the page n umber of up ward planar graphs. SIAM J. Discr et. Math. , 37(4):2312–2331, 2023. doi: 10.1137/22m1522450 . 63 P aul C. Kainen and Shannon Overba y . Extension of a theorem of whitney . A ppl. Math. Lett. , 20(7):835–837, 2007. doi:10.1016/j.aml.2006.08.019 . 64 Mic hael Kaufmann, Michael Bek os, F abian Klute, Sergey Pupyrev, Chrysanthi Raftop oulou, and T orsten Uec kerdt. F our pages are indeed necessary for planar graphs. Journal of Computational Geometry , 11(1):332–353, Aug. 2020. URL: https://jocg.org/index.php/ jocg/article/view/3102 , doi:10.20382/jocg.v11i1a12 . 65 Y unlong Liu, Jie Chen, Jingui Huang, and Jianxin W ang. On parameterized algorithms for fixed-order bo ok thic kness with resp ect to the pathwidth of the v ertex ordering. The or. Comput. Sci. , 873:16–24, 2021. doi:10.1016/j.tcs.2021.04.021 . 66 Y unlong Liu, Yixuan Li, and Jingui Huang. V ertex-bipartition: A unified approac h for k ernelization of graph linear la yout problems parameterized b y v ertex co ver. Int. J. F ound. Comput. Sci. , 35(6):609–629, 2024. doi:10.1142/S0129054123410022 . 67 Seth M. Malitz. Genus g graphs ha ve pagenum b er O ( √ q ) . J. Algorithms , 17(1):85–109, 1994. doi:10.1006/jagm.1994.1028 . 68 Seth M. Malitz. Graphs with E edges hav e pagen umber O ( √ E ) . J. Algorithms , 17(1):71–84, 1994. doi:10.1006/jagm.1994.1027 . 69 T amara Mchedlidze and Antonios Symv onis. Crossing-free acyclic Hamiltonian path completion for planar st -digraphs. In Yingfei Dong, Ding-Zh u Du, and Oscar H. Ibarra, editors, 20th International Symp osium on Algorithms and Computation (ISAA C’09) , volume 5878 of LNCS , pages 882–891. Springer, 2009. doi:10.1007/978- 3- 642- 10631- 6\_89 . 70 T amara Mc hedlidze and An tonios Symv onis. Crossing-optimal acyclic HP-completion for outerplanar st -digraphs. J. Gr aph Algorithms Appl. , 15(3):373–415, 2011. doi:10.7155/jgaa. 00231 . 71 Kurt Mehlhorn. Data Structur es and Algorithms: Multi-dimensional Se ar ching and Computa- tional Ge ometry , v olume 3 of EA TCS Mono gr aphs on The or etic al Computer Scienc e . Springer, 1984. doi:10.1007/978- 3- 642- 69900- 9 . 72 T. D. Morgan. Map folding . PhD thesis, Massach usetts Institute of T echnology , 2012. Ph.D. thesis. URL: https://hdl.handle.net/1721.1/77030 . G. Da Lozzo, F. F rati, and I. Rutter 51 73 J. Ian Munro and V enkatesh Raman. Succinct represen tation of balanced parentheses and static trees. SIAM J. Comput. , 31(3):762–776, 2001. doi:10.1137/S0097539799364092 . 74 Martin Nöllenburg and Sergey Pupyrev. On families of planar dags with constant stac k num b er. In Mic hael A. Bekos and Markus Chimani, editors, Gr aph Dr awing and Network Visualization - 31st International Symposium, GD 2023, Isola del le F emmine, Palermo, Italy, Septemb er 20-22, 2023, R evise d Sele cte d Pap ers, Part I , v olume 14465 of LNCS , pages 135–151. Springer, 2023. doi:10.1007/978- 3- 031- 49272- 3\_10 . 75 Ric hard Now ako wski and Andrew Park er. Ordered sets, pagenum b ers and planarity . Order , 6(3):209–218, 1989. doi:10.1007/BF00563521 . 76 T. Ollmann. On the b o ok thic knesses of v arious graphs. In F. Hoffman, R.B. Levo w, and R.S.D. Thomas, editors, Southe astern Confer enc e on Combinatorics, Gr aph The ory and Computing , v olume VI I I of Congr essus Numer antium , page 459, 1973. 77 C. A. P ersinger. Subsets of n -b ooks in E 3 . Pacific J. Math. , 18:169–173, 1966. URL: http://projecteuclid.org/euclid.pjm/1102994417 . 78 V aughan R. Pratt. Computing permutations with double-ended queues, parallel stac ks and parallel queues. In 5th Symp osium on The ory of Computing (STOC’73) , page 268–277. ACM, 1973. doi:10.1145/800125.804058 . 79 S. Rengara jan and C. E. V eni Madha v an. Stack and queue num b er of 2-trees. In Ding-Zh u Du and Ming Li, editors, Computing and Combinatorics, First A nnual International Conferenc e, COCOON ’95, Xi’an, China, A ugust 24-26, 1995, Pr o c ee dings , v olume 959 of LNCS , pages 203–212. Springer, 1995. doi:10.1007/BFb0030834 . 80 Arnold L. Rosen b erg. The diogenes approach to testable fault-toleran t arra ys of pro cessors. IEEE T r ans. Computers , 32(10):902–910, 1983. doi:10.1109/TC.1983.1676134 . 81 Aja ykrishnan E S, Robert Ganian, Daniel Lokshtano v, and V aishali Surianara y anan. A quasi- p olynomial time algorithm for 3-coloring circle graphs. In Sep ehr Assadi and Ev a Roten b erg, editors, 9th Symp osium on Simplicity in Algorithms (SOSA’26) , pages 65–80. SIAM, 2026. doi:10.1137/1.9781611978964.6 . 82 Rob ert T arjan. Sorting using netw orks of queues and stacks. J. A CM , 19(2):341–346, apr 1972. doi:10.1145/321694.321704 . 83 W. T. T utte. A theorem on planar graphs. T r ansactions of the A merican Mathematic al Society , 82(1):99–116, 1956. URL: http://www.jstor.org/stable/1992980 . 84 W alter Unger. On the k-colouring of circle-graphs. In Robert Cori and Martin Wirsing, editors, 5th A nnual Symp osium on The or etic al A sp e cts of Computer Scienc e (ST A CS ’88) , v olume 294 of LNCS , pages 61–72. Springer, 1988. doi:10.1007/BFb0035832 . 85 Manfred Wiegers. Recognizing outerplanar graphs in linear time. In Gottfried Tinhofer and Gunther Schmidt, editors, 13th International W orkshop on Gr aph-The or etic Conc epts in Computer Scienc e (W G’87) , pages 165–176. Springer, 1987. doi:10.1007/3- 540- 17218- 1\_57 . 86 A vi Wigderson. The complexity of the Hamiltonian circuit problem for maximal planar graphs. T echnical Rep ort TR-298, EECS Department, Princeton Univ ersity , 1982. URL: https://www.math.ias.edu/avi/node/820 . 87 Mihalis Y annakakis. F our pages are necessary and sufficien t for planar graphs (extended abstract). In Juris Hartmanis, editor, Pr o ce e dings of the 18th A nnual A CM Symp osium on The ory of Computing, May 28-30, 1986, Berkeley, California, USA , pages 104–108. A CM, 1986. doi:10.1145/12130.12141 . 88 Mihalis Y annakakis. Embedding planar graphs in four pages. J. Comput. Syst. Sci. , 38(1):36–67, 1989. doi:10.1016/0022- 0000(89)90032- 9 . 89 Mihalis Y annakakis. Planar graphs that need four pages. Journal of Combinatorial The ory, Series B , 145:241–263, 2020. URL: https://www.sciencedirect.com/science/article/pii/ S0095895620300526 , doi:10.1016/j.jctb.2020.05.008 .
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment