Radial Level Planarity with Fixed Embedding

We study level planarity testing of graphs with a fixed combinatorial embedding for three different notions of combinatorial embeddings, namely the level embedding, the upward embedding and the planar embedding. These notions allow for increasing degrees of freedom in their corresponding drawings. For the fixed level embedding there are known and easy to test level planarity criteria. We use these criteria to prove an “untangling” lemma that plays a key role in a simple level planarity test for the case where only the upward embedding is fixed. This test is then adapted to the case where only the planar embedding is fixed. Further, we characterize radial upward planar embeddings, which lets us extend our results to radial level planarity. No algorithms were previously known for these problems.


Introduction
Level planarity and upward planarity are two natural planarity notions for directed graphs that enrich the notion of planarity of ordinary graphs by imposing additional requirements based on the directions of the edges. Informally, a drawing of a directed graph is upward when all edges are drawn as y-monotone curves. In the level planar setting the y-coordinates of the vertices are fixed. We refer to Section 2 for formal definitions. Both exist also in a radial form.
There is a natural definition of topological equivalence for such drawings. Namely, two planar drawings Γ 1 , Γ 2 of a graph G are equivalent if they can be continuously transformed into each other without causing crossings. Formally, there is an (ambient) isotopy F : R 2 ×[0, 1] → R 2 that takes Γ 1 to Γ 2 . That is, F is continuous and, for each t ∈ [0, 1], the map F t (x) = F (x, t) is a homeomorphism of the plane, where F 0 is the identity map and F 1 maps Γ 1 to Γ 2 . Note that the property of F t being a homeomorphism ensures that also each intermediate image is planar. In particular, there exists a family of drawings F t (Γ 1 ) for t ∈ [0, 1]. For upward planar drawings it is natural to require that the intermediate drawings are also upward, and for level-planar drawings it is natural to require that the intermediate drawings are level planar. We consider connected graphs. Then, equivalence classes of such drawings can be combinatorially described by so-called embeddings,which give the circular order of edges around each vertex, upward embeddings, which give the linear orders of incoming and outgoing edges around each vertex, and level embeddings, which speficy for each level the order of its vertices and the edges that cross it. These notions equally make sense in the radial setting, except that there level embeddings specify circular orderings rather than linear ones.
With this definition, not every embedding (upward embedding, level embedding) must correspond to a planar drawing (upward planar drawing, level planar drawing). If such a drawing exists, we call it planar embedding (upward planar embedding, level planar embedding). Yet a level-planar drawing is also upward-planar (forget about the levels), and an upward planar drawing is planar (forget about the edge directions). Thus, a level planar embedding uniquely fixes an upward planar embedding, which in turn uniquely fixes a planar embedding.
Given a fixed combinatorial embedding of one of the above types, it therefore makes sense to ask for which planarity notions there exists a planar drawing that induces the given embedding. In this way, each combination of planarity variant and combinatorial embedding type gives an instantiation of the planarity testing with fixed embedding problem.
Contribution and Outline. After introducing some preliminaries in Section 2, we present a characterization of radial upward planar embeddings in Section 3. Based on this characterization, we can test whether a given planar embedding is radial level planar in O(n log 3 n) time; we are not aware of any previous polynomial-time algorithm for this problem. We consider the level planar setting in Section 4, finding that in this setting we can "untangle" drawings to insert additional edges. This lets us devise linear-time algorithms for (radial) level planarity testing with fixed embedding. We note that for the non-radial level planar case there already exists a quadratic-time algorithm [1] and a paper that claims a linear-time algorithm [9], although that paper does not contain all proofs and there exists no full version. We are not aware of previous algorithms for the radial case. We close with some concluding remarks in Section 5. Let G = (V, E) be a graph. A drawing of G maps each vertex to a point in the plane and each edge to a finite polygonal chain between its two endpoints. A drawing is planar if no two edges intersect, except in common endpoints. An embedding of G consists of counter-clockwise cyclic orders of the edges incident to each vertex. A planar drawing of G induces an embedding of G.
A planar embedding is an embedding that is induced by a planar drawing. A planar embedding defines faces bounded by facial walks } in the counter-clockwise cyclic order of edges incident to v i . Note that our facial walks traverse the boundary in clockwise direction for inner faces and counterclockwise for the outer face.
A drawing is upward planar if it is both upward and planar. An upward embedding of G consists of left-to-right linear orders of incoming edges and outgoing edges incident to each vertex. An upward planar drawing induces an upward embedding. An upward planar embedding is an upward embedding that is induced by an upward planar drawing.
if all edges incident to v have v as their endpoint. A source/sink assignment ψ of G assigns to each source or sink v of G an ordered pair (e, e ) of edges where e immediately precedes e in the counter-clockwise order of edges incident to v. There exists a unique face f on whose facial walk e immediately precedes e , we also say that ψ assigns v to f . Note however that, if v is a cutvertex, then the face f to which v is assigned may not uniquely determine the ordered pair (e, e ) of edges on the boundary of f to which v is assigned.
An upward planar embedding induces a source/sink assignment by assigning each source v to (e, e ), where e and e are the leftmost and rightmost outgoing edge incident to v, respectively, and by assigning each sink v to (e, e ), where e and e are the rightmost and leftmost outgoing edge incident to v, respectively. Conversely, a planar embedding together with a source/sink assignment induces an upward embedding. We therefore use these concepts interchangeably. See Figure 1 (a) for an example.
Let f be a face and let v 1 , v 2 , . . . , v n , v n+1 = v 1 denote the facial walk that bounds f .
Observe that when traversing the boundary of a face, a face source must be eventually be followed by a face sink and vice versa. Therefore, for each face f the number of face sources of f equals the number of face sinks of f . Note further that cutvertices of G may occur multiple times in a single facial walk and that the above description counts such occurrences separately. Therefore a single cutvertex may contribute more than one face source or face sink to the same face. For each face f let n f denote the number of face sources of f . Bertolazzi et al. [5] show the following characterization of upward planar embeddings of biconnected graphs. Our definition of source/sink assignments follows the generalization of that characterization to non-biconnected graphs [7, Lemma 1].  to test whether a source/sink assignment subject to the conditions stated in Lemma 1 exists and if so, compute one. The quadratic running time comes from trying each face as the outer face. We can avoid this and improve the running time to O(n 3/2 ) as follows.
Theorem 1 Let G be a directed acyclic graph with a planar embedding E. It can be tested in O(n 3/2 ) time whether G admits an upward planar embedding with planar embedding E.
Proof: An upward planar source/sink assignment corresponds to a capacitated matching in the assignment network N , which is defined as follows; see Figure 1  as v being assigned to f . The edge {f s , f t } of N guarantees that either n f −1 or n f +1 sources/sinks are assigned to f . Such an edge set M can be found in O(n 3/2 ) running time using an algorithm due to Gabow [11]. Since the sum of capacities is 2 + f ∈E (n f − 1), there must be exactly one face h, to which n h + 1 sources/sinks are assigned. This face h then becomes the outer face. The correctness of the approach follows from Lemma 1.
A level graph is a directed graph G = (V, E) together with a level assignment : V → N. A level drawing is an upward drawing of G where each vertex v has y-coordinate (v). A level-planar drawing is a level drawing that is planar. A level planar drawing induces on each level a left-to-right linear order of vertices that lie on that level and edges that cross that level. A level embedding of G defines for each level a left-to-right linear order of vertices that lie on that level and edges that cross that level. A radial drawing of G maps each vertex to a point on the standing cylinder and each edge to a finite polygonal chain between its two endpoints. The definitions of planar, upward and level drawings extend to the radial case, as do the notions of planar and upward embeddings. A radial level embedding of G consists of counter-clockwise cyclic orders of vertices and edges for each level. Every level graph G admits a proper form in which for each edge (u, v) ∈ E it is (u) + 1 = (v) and whose level embeddings correspond bijectively to the level embeddings of G. Such a proper form can be obtained by subdividing each edge (u, v) ∈ E with (v) − (u) > 1. A level graph G also admits a star form in which every level hosts exactly one vertex and whose upward planar embeddings correspond bijectively to the upward planar embeddings of G [10,8]; see Figure 2 for an example. The following characterization of radial level planarity is common knowledge.
Lemma 2 A radial level embedding of a level graph G in proper form is radial level planar if for all choices of three independent edges (u, u ), where u, v, w appear in that cyclic order the vertices u , v , w appear in that cyclic order.
Radial level planarity generalizes level planarity: To test a graph G for level planarity one can test G together with two vertices s, t such that s lies below all vertices of G and t lies above all vertices of G connected by the edge (s, t) for radial level planarity. Using Lemma 2 it can easily be tested in cubic time whether a (radial) level embedding is (radial) level planar. In Section 4, we improve this to linear time, see Lemma 4.

Radial Upward Planarity
In this section we generalize the criterion for upward planarity due to Bertolazzi et al. as stated in Lemma 1 to radial upward planarity.
Lemma 3 Let G be a connected directed acyclic graph. An upward embedding of G is radial upward planar if and only if there exist two faces g, h such that the source/sink assignment ψ assigns to each face f exactly n f − 1 sources/sinks, plus one source if f = g, and plus one sink if f = h.
Proof: For the forward direction, consider a radial upward planar drawing Γ of G. First consider the case where Γ is (non-radially) upward planar. Then by Lemma 1, there exists a source/sink assignment ψ that assigns to one face h exactly n h + 1 sources/sinks, and to each other face f exactly n f −1 sources/sinks. Let g = h. There are exactly n g = n h face sources and face sinks each on the facial walk that bounds g = h. So, at least one source of G is assigned to g, at least one sink of G is assigned to h and n h − 1 = n g − 1 further sources/sinks are assigned to g = h. These are exactly the claimed properties of ψ. Second, consider the case where Γ is not (non-radially) upward planar. Let g denote the lower unbounded face and let h = g denote the upper unbounded face. Let s denote the vertex with smallest y-coordinate in Γ (we may assume without loss of generality that this vertex is unique); see Figure 3 (a). Extend G and Γ to a new graph G together with a radial upward planar drawing Γ of G as follows; see Figure 3  connected, there exists in G a simple path p from s to t. Then in G there exists a simple path p from s to t that extends p. Cutting Γ along p makes it possible to unwrap Γ from the cylinder and embed it into the plane; see Figure 3 (c). Every inner face of Γ (in particular, g 1 and h 1 ) is then drawn as an inner non-radial upward planar face. Bertolazzi et al. showed that then n f − 1 sources/sinks are assigned to such a face f . Now go back from Γ to Γ. For each inner face f of Γ nothing changes, i.e., n f − 1 sources/sinks are assigned to f . Assign s and every source/sink previously assigned to g 1 to g. Observe n g = n g1 , so n g − 1 sources/sinks are assigned to g, plus the source s. Likewise, assign t and every source/sink previously assigned to h 1 to h. Then n h − 1 sources/sinks are assigned to h, plus the sink t. These are exactly the claimed properties of the source/sink assignment.
For the reverse direction, consider a source/sink assignment ψ with the stated properties. If the extra source and sink are assigned to the same face of E, then by Lemma 1 there exists an upward planar drawing of G. Otherwise, let g denote the face to which an extra source s is assigned, and let h = g denote the face to which an extra sink t is assigned. Extend G and E to a new graph G with a planar embedding E , respectively, as follows. Create new vertices including s , t and edges as described for the forward direction. In particular, insert the edges (x, s), (s , s) around s between the two edges to which s is assigned by ψ. Recall that this splits face g into one bounded face g 1 and one unbounded face g 2 . Assign s to g 2 , then n g − 1 = n g1 − 1 sources/sinks are assigned to g 1 . Similarly, face h can be split into one bounded face h 1 and one unbounded face h 2 . Assign t to h 2 , then n h − 1 = n h1 − 1 sources/sinks are assigned to h 1 . Observe that each bounded face f of G is assigned exactly n f − 1 sources/sinks. Using the result of Bertolazzi et al., an incoming (outgoing) edge can be added to each source (sink) assigned to f and embedded within f (see the if-part of the proof of Theorem 3 in [5]). After this, G is a directed acyclic graph whose single source is s and whose single sink is t together with a planar embedding E . Hashemi shows that G is then upward planar with planar embedding E on the sphere [13, Theorem 1]. Auer et al. show that upward planarity on the sphere coincides with upward planarity on the standing cylinder [3, Theorem 1]. Hence, G is radial upward planar with planar embedding E , and, as a direct consequence, G is radial upward planar with planar embedding E.
In particular, the face to which the extra source (sink) is assigned is the lower (upper) unbounded face. The (non-radial) upward planarity criterion due to Bertolazzi et al. states the special case that g = h. A given upward embedding of G can easily be tested for radial upward planarity in linear time using the criterion provided by Lemma 3. Also observe that in a given radial upward planar embedding, the extra source/sink can be reassigned to any incident face while maintaining radial upward planarity. In the non-radial setting, the extra source and sink can only be reassigned to faces that are incident to both of these vertices while maintaining upward planarity.
Theorem 2 Let G be a directed graph together with a planar embedding E. It can be tested in O(n log 3 n) time whether G admits a radial upward planar embedding with planar embedding E. Note that testing a graph for radial upward planarity with a given planar embedding is faster compared to testing a graph for (non-radial) upward planarity with a given planar embedding due to the independent treatment of the extra source and extra sink.

Level Planarity with Fixed Embedding
In this section, we investigate (radial) level planarity testing with fixed embedding. We begin with the most restricted embedding notion, which is that of (radial) level embeddings. In particular, we show that the problem of deciding whether a given radial level embedding is radial level planar can be solved in linear time using the characterization provided by Lemma 2. Recall from Section 2 that this generalizes the treatment of non-radial level embeddings.
Lemma 4 It can be tested in linear time whether a (radial) level embedding of a level graph in proper form is (radial) level planar.
Proof: Let G be a level graph with maximum level k and let E be a radial level embedding of G. To check whether E is level planar, it suffices to check for each 1 ≤ i < k whether the edges between levels i and i + 1 induce no crossings. To this end, proceed as follows. First, remove all vertices on level i (on level i + 1) that have no neighbor on level i + 1 (on level i). If at most one vertex remains on level i or i + 1, then there are no crossings between levels i and i + 1. Otherwise, let u denote a vertex on level i. If the neighbors of u on level i + 1 do not appear consecutively in the counter-clockwise cyclic order of vertices on level i + 1, then E is not radial level planar. This can be checked in linear time for each vertex u on level i. If this check passes, the counter-clockwise cyclic order induces a left-to-right linear order of the neighbors u 1 , u 2 , . . . , u n of u on level i + 1. If any u j for 1 < j < n has a neighbor other than u, then E is not radial level planar. Next, contract all neighbors of u into a single vertex u on level i + 1. Iteratively perform this step for each vertex on level i, and, symmetrically, for each vertex on level i + 1. The result is that each vertex has exactly one neighbor on the other level, i.e., we are left with a set of independent edges and counter-clockwise cyclic orders of their endpoints on each level i, i+1. Then the edges between levels i and i + 1 are non-crossing if and only if these cyclic orders can be translated into each other by renaming each vertex to its unique neighbor on the other level. If the level passes the check, then the edges between levels i, i + 1 are crossing-free. The embedding is level-planar if and only if it passes the test for each pair i, i + 1 of levels. Since each vertex is relevant for at most two levels, and each edge is relevant for only one level, the checks of all levels run in total O(n) time.
Next, we consider the slightly more relaxed version where we seek to decide whether a given radial upward planar embedding is radial level planar. To this end, we provide the following lemma, which explains how to "untangle" radial level planar drawings without changing the underlying radial upward embedding. This property is partially known [2, Lemma 3.4], [1, Claim 2], but only for non-radial level planar drawings.
Lemma 5 Let G = (V, E) be a level graph, let Γ be a (radial) level planar drawing of G with (radial) upward embedding E. Let a, b ∈ V with (a) < (b) be incident to a face f such that insering (a, b) inside f yields a (radial) upward embedding E of G + (a, b). If there exists a curve γ inside the face f of Γ that connects a and b and does not intersect the levels (a) and (b), there exists a (radial) level planar drawing Γ of G + (a, b) with (radial) upward embedding E .
Proof: Let γ be such a curve. Insert between any pair of consecutive levels so-called half-levels, and subdivide γ such that it becomes a path that crosses all levels and half-levels at vertices. A vertex of γ is a turn if its two neighbors lie on the same level. Since γ leaves a in upward direction and arrives to b in upward direction, γ has an even number of turns; see Fig. 4. We now push all turns to half levels; turns between levels are moved to the closest half-level. Turns on a level are pushed to the half-level above or below that level, depending on whether their neighbors lie above or below them. Note that since no vertices of G lie on half-levels, this cannot introduce crossings between γ and edges of G. If the perturbation causes crossings of γ with itself, we can shortcut γ to obtain a curve with fewer turns. Eventually, we thus obtain a curve γ, where all turns lie on half-levels.
If γ has no turns, it corresponds to an upward drawing of (a, b) and we can choose Γ as Γ . Assume that γ has at least one turn. Consider two consecutive turns x, y, (x) > (y) that minimize (x) − (y). We modify the drawing to eliminate these two turns. Let s be the last vertex before x with (s) = (y) and let t be the first vertex after y with (t) = (x) on γ; see Figure 4  segment from s to y, then following γ in reverse from y to x and then inserting a straight-line segment from x to t; see Figure 4 (b).
We show that Γ is radial level planar using Lemma 2. Crossings could only be introduced by edges that cross level (s) = (y) or level (x) = (t). The order O 3 . Therefore Γ is radial level planar. Similarly, the linear order of the outgoing edges at some vertex v can change only if these edges cross level (s) in a different order in Γ and Γ . However the order of vertices and edge on level (s) is unchanged, and therefore the order of the outgoing edges is unchanged at all vertices. A symmetric argument holds for incoming edges around vertices, which would have to cross level (t). Therefore the upward embeddings of Γ and Γ are the same. Moreover γ has fewer turns than γ. Therefore the proof follows by induction.
We can use Lemma 5 to insert edges into a graph while maintaining (radial) upward planarity such that all faces end up having size at most 4.

Lemma 6
Let G = (V, E) be a level graph together with a (radial) upward planar embedding E. We can compute in linear time a level graph G with (radial) upward planar embedding E whose faces have size at most 4 and whose faces of size 4 have two face sources and two face sinks so that G has a (radial) level planar drawing with embedding E if and only if G has a (radial) level planar drawing with embedding E .
Proof: Let G be a level graph together with an upward planar embedding E. Recall from Section 2 that we may assume without loss of generality that G is in star form, i.e., every vertex lies on its own level. Insert edges into G and E until all faces have size at most 4 while maintaining (radial) level planarity as follows. Let f be a face of E with at least four vertices incident to f . Suppose that there exist successive edges (u, v), (v, w) or (v, w), (u, v) on the facial walk that bounds f . If G is level planar with upward planar embedding E, then by Lemma 5 the edge (u, w) can be inserted into G and E while maintaining level planarity (other instances of the edge (u, w) may already exist in G, but this is not a problem). In particular, the curve γ can be constructed by closely following (u, v), (v, w) or (v, w), (u, v) within f . If no such successive edges exist, then each vertex incident to f is a face source or a face sink of f . Assume now that f is still incident to at least five vertices. Let (w, v) be an edge incident to f that minimizes (v) − (w). Because v is a face sink and w is a face source, there is an edge (u, v) and an edge (w, x) precede and succeed (w, v) on the facial walk of f , respectively. Because (w, v) minimizes (v) − (w) and because G is in star form, it is (u) ≤ (w) < (v) ≤ (x). See Figure 5. First, suppose that u = w and v = x. Then, because G is in star form, both inequalities are strict, i.e., (u) < (w) < (v) < (x). There is a curve γ from u to x that does not intersect levels (u), (x) except in u and x. By Lemma 5 (u, x) can be inserted into G and E while maintaining level planarity. In particular, (u, x) is inserted just after (u, v) in the left-to-right order of outgoing edges incident to u and just after (w, x) in the leftto-right order of incoming edges incident to x. See Figure 5 (a-c). Now consider the case u = w, i.e., w is a cutvertex that separates v from the rest of G. Again, there is a curve from u to x that does not intersect levels (u), (x) except in u and x. By Lemma 5 (u, x) could be inserted into G and E while maintaining level planarity (though we do not actually insert this edge). Then the edge (v, x) can also be inserted into G and E while maintaining level planarity. Insert (v, x) just after (w, x) in the left-to-right order of incoming edges incident to x. See Figure 5 (d, e). The case v = x is symmetric, in this case we insert the edge (u, w). Finally, observe that it is u = w or v = x because at least five vertices are incident to f .  Figure 5: Inserting the edge (u, x) by defining the red curve γ (a) and using Lemma 5 to move the blue obstruction to the side (b). The upward embedding may be different (c), which requires moving a different obstruction. If w is a cutvertex that separates v from the rest of G, insert the edge (v, x) instead (d); the rerouting works as before (e).  Figure 6: Illustration of the processing algorithm in clockwise direction. The edges on the stack S are thin. The edge following the top edge on S is bold. The illustration assumes that w is a source.
, then the red edge (u, x) is inserted. In the depicted case, the following iteration inserts the dashed blue edge. If v = x (c), the edges (u, x) and (u, w) are inserted.
To reach the claimed running time, we proceed slightly differently. Process the graph one face at a time. For each face f of size at least 4, we first shortcut successive edges (u, v), (v, w) or (v, w), (u, v). This can be done in time linear in the size of f . Afterwards, every vertex incident to a face f of size at least 4 is a face source or a face sink. If f has size more than 4, consider a sequence u, v, w of vertices that are consecutive on the facial walk that bounds f such that u = w. Because G is in star form, all vertices have distinct levels, it is (u) = (w). If v is a face sink and (u) < (w) or if v is a face source and (u) > (w), we process the face clockwise, otherwise, we go counterclockwise.
We describe the clockwise case, the counterclockwise case is symmetric. Create a stack S. If v is a face sink, push the edges (u, v) and (w, v) onto S, if v is a face source, push the edges (v, u) and (v, w) onto S. We will maintain the invariant that the stack contains a part of the facial walk of the current face such that, if edge (a, b) lies above edge (c, d) on S, then (a) ≥ (c) and (b) ≤ (d), and one of the inequalities is strict; see Figure 6. If the number of elements on S drops below two, we clear the stack and start the construction with a new sequence u, v, w of consecutive vertices.
While there are at least two elements on the stack, we proceed as follows. Let u, v, w denote the endpoints of the two edges on top of the stack in the order in which they occur along the clockwise facial walk. Let x denote the successor of w. We assume that w is a source. The case where w is a sink is symmetric. Note that by the invariant (w) > (u). If (x) < (v), we push (w, x) onto the stack, which maintains the invariant; see Figure 6 (a). If (x) > (v), then v = x and Lemma 5 allows us to insert (u, x) into the face; see Figure 6 (b). If (x) = (v), then v = x, and we insert (u, x) using Lemma 5 and afterwards (u, w) into the face; see Figure 6 (c). In the last two cases, we afterwards pop two edges from S. Then, we continue with the next iteration. Figure 7: Inserting the red augmentation edges into inner faces (a-d), and the level planarity criterion for the outer face (e, f).
Note that the subface of f to which the popped edges are incident have size 4 with two face sources and two face sinks in the former case and size 3 in the latter case. This means that every edge incident to f is pushed onto S at most once. Moreover, since the edges on S become shorter and shorter, the algorithm terminates. It follows that the face can be augmented in time that is linear in its size.
Note that we may insert edges that already existed in G, turning the initially simple graph into a multigraph. To apply the upward planarity criterion due to Bertolazzi et al., which is only formulated for simple graphs, we can subdivide edges that occur multiple times. The subdivision vertices are neither (face) sources nor (face) sinks, so the upward planar embeddings of this subdivided graph correspond bijectively to the upward planar embeddings of our multigraph.
Theorem 3 Let G = (V, E) be a level graph together with a (radial) upward planar embedding E. It can be tested in linear time whether G admits a (radial) level planar embedding with (radial) upward planar embedding E.
Proof: Lemma 6 lets us assume that each face has size at most 4, and moreover faces of size 4 have two face sources. No source/sink is assigned to inner faces of size at most 3. If the outer face h has size 3, then the lowest vertex u and the highest vertex x must be assigned to it.
Let f be an inner face of size 4. Let u, v, w, x denote the facial walk that bounds f and without loss of generality let u, w be face sources and let v, x be face sinks. See Figure 7 (a-d).
Exactly one of u, v, w, x is assigned to f . Bertolazzi et al. [5] show that if u is assigned to f , then the edge (w, u) can be inserted into f in any upward planar drawing. For level planarity, this additionally requires (w) < (u); see Figure 7 (a). Thus, if (w) ≥ (u), then G is not (radial) level planar with (radial) upward embedding E. The cases when v, w or x are assigned to f are symmetric; see Figure 7 (b-d). If the outer face h has size 4 and two face sources u, w and two face sinks v, x, then either two sources and one sink is assigned to h, or one source and two sinks are assigned to h. Level planarity requires that the lowest vertex u and the highest vertex x are assigned to the outer face. This leaves two cases; see Figure 7 (e, f). If v is assigned to h, then it must be (u) < (w) and we can insert the edge (v, x) in h, otherwise w is assigned to h, then it must be (v) < (x) and we can insert the edge (u, w) in h. If any of the necessary conditions fails, the given embedding is not level planar. Otherwise, inserting all of these edges gives a level graph G with a single source u and a single sink x together with an embedding E . As in the proof of Lemma 3, this means that G is (radial) upward planar with upward embedding E . Because G has a single source and a single sink, this means that G is also (radial) level planar with upward embedding E . To see this, consider a (radial) upward planar drawing Γ of G with upward planar embedding E . Assume without loss of generality that the y-coordinate of u in Γ is (u). Scale up Γ so that for each vertex v = u its y-coordinate is at least (v). Next, process each vertex v of G in topological order. If the y-coordinate of v is greater than (v), move v down 364 Guido Brückner, Ignaz Rutter Radial Level Planarity with Fixed Embedding along its leftmost incoming edge until its y-coordinate is (v) while maintaing (radial) upward planarity. Once all vertices are processed Γ is a (radial) level planar drawing of G with upward embedding E . Since G is a subgraph of G and E is the restriction of E to G this means that G is (radial) level planar with upward embedding E. Reducing the faces to size 4 takes linear time (Lemma 6); the remaining steps take O(1) time per face.
Finally, consider the least restricted version of level planarity testing with fixed embedding. Namely, suppose that only a planar embedding E of G is fixed. We translate Lemma 6 to this setting as follows.
Lemma 7 Let G be a level graph with a planar embedding E. We can compute in linear time a level graph G with planar embedding E whose faces have size at most 4 so that G has a (radial) level planar drawing with embedding E if and only if G has a (radial) level planar drawing with embedding E .
Proof: The only difference to the proof of Lemma 6 is that we do not insert the edges into the upward embedding, i.e., into the linear lists of outgoing or incoming edges, but rather into the embedding, i.e., the cyclic order of edges.
To test a planar embedding for (radial) level planarity in linear time, we need one last ingredient. Recall that (radial) level planarity requires (radial) upward planarity, which can be tested using the assignment network. We show that for a certain kind of assignment network, testing (radial) upward planarity is feasible in linear time.
Lemma 8 Let G = (A ∪ B, E) be a bipartite graph with n vertices and m edges such that every vertex in A has degree at most 2. It can be decided O(n + m) time whether G admits a perfect matching and, if so, one can be computed within the same running time.
Proof: We proceed similar to the algorithm of Karp and Sipser [17]. We first preprocess the graph G in linear time by iteratively matching a degree-1 vertex u ∈ A to its unique neighbor v ∈ B and then removing both u and v from the graph. The resulting graph G = (A ∪ B , E ) has a perfect matching if and only if G has one.
Next, we construct an auxiliary graph H = (B , E ) such that E contains an edge v, w if there exists a u ∈ A that is incident to both v, w ∈ B . A perfect matching of G corresponds to an orientation of H such that each vertex has in-degree exactly 1. For example, interpret the orientation (v, w) as {u, v} ∈ E being matched and interpret the orientation (w, v) as {u, w} ∈ E being matched. Such an orientation of H exists if and only if each connected component of G is a pseudo-tree, that is, it is a tree plus one edge. This can be tested in linear time.
This lets us prove the following.
Theorem 4 Let G be a level graph together with a planar embedding E. It can be tested in linear time whether G admits a (radial) level planar embedding with planar embedding E.
Proof: Lemma 7 lets us assume that each face has size at most 4. We check whether there exists an upward planar embedding with planar embedding E that is level planar by computing an assignment of vertices to faces similar to Bertolazzi et al. [5]. Recall that no sources/sinks are assigned to faces of size 3, and exactly one source/sink is assigned to each inner face of size 4. From the assignment of a source or sink to an inner face f , we know which edge must be inserted in the augmentation procedure of Bertolazzi et al., and we can test beforehand, whether this augmentation respects the given level assignment. If it does not, then we remove the possibility to assign the corresponding source/sink to face f by removing the corresponding edge from the assignment network. Observe that, for a pair of opposite sources/sinks around f , the leveling rules out at least one of the assignments, and therefore every face f of size 4 keeps at most two candidate sources/sinks that can be assigned to it.
If the remaining network does not allow to assign all sources and sinks to the faces of the graph, then there is no level-planar embedding with the given embedding. Otherwise, adding the augmentation edges yields a level st-graph that is planar, and therefore level-planar. Note that in this case the assignment network is bipartite because it connects face nodes with vertex nodes and each face node has degree at most. Lemma 8 shows that in such a network, an assignment can be computed in linear time.

Conclusion
In this paper, we have studied the (radial) upward and (radial) level planarity testing problems with fixed embedding for three notions of fixed embeddings, namely embeddings, upward embeddings and level embeddings. We provided a new combinatorial characterization of radial upward planarity with fixed embedding, which can be tested in O(n log 3 n) time. Somewhat curiously, testing for radial upward planarity is faster than testing for (non-radial) upward planarity, which takes O(n 3/2 ) time. It would be interesting to see whether these running times can be improved, possibly down to linear time. For the level planar setting, we have shown that a well-known characterization of radial level planar embeddings can be tested in linear time. For a fixed (upward) planar embedding, we have shown how to insert edges into the graph while maintaining (upward) planarity such that all faces have size at most 4. This lets us test a level graph with a fixed ((radial) upward) planar embedding for (radial) level planarity in linear time.