Dynamic Planar Embeddings of Dynamic Graphs

We present an algorithm to support the dynamic embedding in the plane of a dynamic graph. An edge can be inserted across a face between two vertices on the face boundary (we call such a vertex pair linkable), and edges can be deleted. The planar embedding can also be changed locally by flipping components that are connected to the rest of the graph by at most two vertices. Given vertices u,v, linkable(u,v) decides whether u and v are linkable in the current embedding, and if so, returns a list of suggestions for the placement of (u,v) in the embedding. For non-linkable vertices u,v, we define a new query, one-flip- linkable(u,v) providing a suggestion for a flip that will make them linkable if one exists. We support all updates and queries in O ( log 2 n ) $\mathcal {O}(\log ^{2} n)$ time. Our time bounds match those of Italiano et al. for a static (flipless) embedding of a dynamic graph. Our new algorithm is simpler, exploiting that the complement of a spanning tree of a connected plane graph is a spanning tree of the dual graph. The primal and dual trees are interpreted as having the same Euler tour, and a main idea of the new algorithm is an elegant interaction between top trees over the two trees via their common Euler tour.


Introduction
We present a data structure for supporting and maintaining a dynamic planar embedding of a dynamic graph. In this article, a dynamic graph is a graph where edges can be removed or inserted, and vertices can be cut or joined, but where an edge (u, v) can only be added if it does not violate planarity. More precisely, the edges around each vertex are ordered cyclically by the embedding, similar to the edge-list representation of the graph. A corner (of a face) is the gap between consecutive edges incident to some vertex. Given two corners c u and c v of the same face f , incident to the vertices u and v respectively, the operation insert(c u , c v ) inserts an edge between u and v in the dynamic graph, and embeds it across f via the specified corners. We provide an operation linkable(u, v) that returns such a pair of corners c u and c v if they exist. If there are more options, we can list them in constant time per option after the first. A vertex may be cut through two corners, and linkable vertices may be joined by corners incident to the same face, if they are connected, or incident to any face otherwise. That is, joining vertices corresponds to linking them across a face with some edge e, and then contracting e. It may often be relevant to change the embedding, e.g. in order to be able to insert an edge. In a dynamic embedding, the user is allowed to change the embedding by what we call flips, that is, to turn part of the graph upside down in the embedding. Of course, the relevance of this depends on what we want to describe with a dynamic plane graph. If the application is to describe roads on the ground, flipping orientation would not make much sense. But if we have the application of graph drawing or chip design in mind, flips are indeed relevant. In the case of chip design, a layer of a chip is a planar embedded circuit, which can be thought of as a planar embedded graph. An operation similar to flip is also supported by most drawing software.
Given two vertices u, v, we may ask whether they can be linked after modifying the embedding with only one flip. We introduce a new operation, the one-flip-linkable(u, v) query, which answers that question, and returns the vertices and corners describing the flip if it exists.
Our data structure is an extension to a well-known duality-based dynamic representation of a planar embedded graph known as a tree-cotree decomposition [4]. We maintain toptrees [1] both for the primary and dual spanning trees. We use the fact that they share a common (extended) Euler tour -in a new way -to coordinate the updates and enable queries that either tree could not answer by itself. All updates and queries in the combined structure are supported in O(log 2 n), plus, in case of linkable (u, v), the length of the returned list.

Dynamic Decision Support Systems
An interesting and related problem is that of dynamic planarity testing of graphs. That is, we have a planar graph, we insert some edge, is the graph still planar, that is, does there still exist an embedding of it in the plane?
The problem of dynamic planarity testing appears technically harder than our problem, and in its basic form it is only relevant when the user is completely indifferent to the actual embedding of the graph. What we provide here falls more in the category of a decision support system for the common situation where the desired solution is not completely captured by the simple mathematical objective, in this case planarity. We are supporting the user in finding a good embedding, e.g., telling what are the options for inserting an edge (the linkable query), but leave the actual choice to the user. We also support the users in changing their mind about the embedding, e.g. by flipping components, so as to make edge insertions possible. Using the one-flip-linkable query we can even suggest a flip that would make a desired edge insertion possible if one exists.

Previous work
Dynamic graphs have been studied for several decades. Usually, a fully dynamic graph is a graph that may be updated by the deletion or insertion of an edge, while decremental or incremental refers to graphs where edges may only be deleted or inserted, respectively. A dynamic graph can also be one where vertices may be deleted along with all their incident edges, or some combination of edge-and vertex updates [14].
Hopcroft and Tarjan [9] were the first to solve planarity testing of static graphs in linear time. Incremental planarity testing was solved by La Poutre [12], who improved on work by Di Battista, Tamassia, and Westbrook [2,3,15], to obtain a total running time of O(α(q, n)) where q is the number of operations, and where α is the inverse-Ackermann function. Galil, Italiano, and Sarnak [8] made a data structure for fully dynamic planarity testing with O(n 2/3 ) worst case time per update, which was improved to O(n 1/2 ) by Eppstein et al. [5]. For maintaining embeddings of planar graphs, Italiano, La Poutré, and Rauch [10] present a data structure for maintaining a planar embedding of a dynamic graph, with time O(log 2 n) for update and for linkable-query, where insert only works when compatible with the embedding. The dynamic tree-cotree decomposition was first introduced by Eppstein et al. [6] who used it to maintain the MST of a planar embedded dynamic graph subject to a sequence of S TA C S 2 0 1 5 change-weight(e, ∆x) operations in O(log n) time per update. Eppstein [4] presents a data structure for maintaining the MST of a dynamic graph, which handles updates in O(log n) if the graph remains plane. More precisely the user specifies a combinatorial embedding in terms a cyclic ordering of the edges around each vertex. Planarity of the user specified embedding is checked using Euler's formula. Like our algorithm, Eppstein's supports flips. The fundamental difference is that Eppstein does not offer any support for keeping the embedding planar, e.g., to answer linkable(u, v), the user would in principle have to try all n 2 possible corner pairs c u and c v incident to u and v, and ask if insert(c u , c v ) violates planarity.
As far as we know, the one-flip-linkable query has not been studied before. Technically it is the most challenging operation supported in this paper.
The highest lower bound for the problem of planarity testing is Pǎtraşcu's Ω(log n) lower bound for fully dynamic planarity testing [13]. From the reduction it is clear that this lower bound holds as well for maintaining an embedding of a planar graph as we do in this article.

Maintaining a dynamic embedding
In this section we present a high-level overview of a data structure to maintain a dynamic embedding of a planar graph. In the following, unless otherwise stated, we will assume G = (V, E) is a planar graph with a given combinatorial embedding and that G * = (F, E * ) is its dual. Our primary goal is to be able to answer linkable(u, v), where u and v are vertices: Determine if an edge between u and v can be added to G without violating planarity and without changing the embedding. If it can be inserted, return the list of pairs of corners (see Definition 3 below). Each corner-pair, (c u , c v ), describes a unique place where such an edge may be inserted. If no such pair exists, return the empty list.
The data structure must allow efficient updates such as insert, remove, cut, join, and flip. We defer the exact definitions of these operations to Section 2.4.
As in most other dynamic graph algorithms we will be using a spanning tree as the main data structure, and note: * induces a spanning tree T * in G * called the co-tree of T .

Observation 2.
If u and v are vertices, T is spanning tree, and e is any edge on the T -path between u and v, then any face containing both u and v lies on the cycle induced by e * in the co-tree T * .
Thus the main idea is to search a path in the co-tree. This is complicated by the fact (see Figure 1) that the set of faces that are adjacent to u and/or to v need not be contiguous in T * , so it is possible for the cycle to change arbitrarily between faces that are adjacent to any combination of neither, one, or both of u, v.
Our linkable query will consist of two phases. A marking phase, in which we "activate" (mark) all corners incident to each of the two vertices we want to link (see Section 2.2), and a searching phase, in which we search for faces incident to "active" (marked) corners at both vertices (see Section 2.3). But first, we define corners.

Corners and the extended Euler tour
The concept of a corner in an embedded graph turns out to be very important for our data structure. Intuitively it is simply a place in the edge list of a vertex where you might insert a new edge, but as we shall see it has many other uses.
u v Figure 1 The co-tree path may switch arbitrarily between faces that are adjacent to any combination of neither, one, or both of u, v.  Note that faces and vertices appear symmetrically in the definition. Thus, there is a oneto-one correspondence between the corners of G and the corners of G * . This is important because it lets us work with corners in G and G * interchangeably. Even more interesting is: Observation 4. Given a spanning tree T of G, there is a natural extension of the concept of an Euler tour of T into an extended Euler tour EET(T ) as a cyclic arrangement that contains each edge in G exactly twice and each corner in G exactly once (see Figure 2). Furthermore, the corresponding tour EET(T * ) in G * defines exactly the opposite cyclical arrangement of the corresponding edges and corners in G * .
Thus, segments of the extended Euler tour translate directly between T and T * . By segment, we mean any contiguous sub-list of the cycle. The high level algorithm (to be explained in detail later) is now to build a structure consisting of an arbitrary spanning tree T and its co-tree T * such that we can

1.
Find an edge e on the T -path between u and v. This is easy.

2.
Mark all corners incident to u and v in T . This is complicated by the existence of vertices of high degree, so a lazy marking scheme is needed. However, it is easier than marking them in T * directly, since each vertex has a unique place in T and no place in T * .

3.
Transfer those marks from T to T * using Observation 4. We can do this as long as the lazy marking scheme works in terms of segments of the extended Euler tour. 4. Search the cycle induced by e * in T * for faces that are incident to a marked corner on both sides of the path.

Marking scheme
We need to be able to mark all corners incident to the two query vertices u and v, and we need to do it in a way that operates on segments of the extended Euler tour. To this end Figure 3 The vertex w is a boundary vertex of the green clusters, but not of their blue parent clusters.
w w we will maintain a top tree over T (see [1]). Given a tree T , a top tree for T is a binary tree. At the lowest level, its leaves are the edges of T . Its internal nodes, called clusters, are sub-trees of T with at most two boundary vertices. At the highest level its root is a single cluster containing all of T . A non-boundary vertex of the subset S ⊂ V may not be adjacent to a vertex of V \ S. A cluster with two boundary vertices is called a path cluster, and other clusters are called leaf clusters. Any internal node is formed by the merged union of its (at most two) children. All operations on the top tree are implemented by first breaking down part of the old tree from the top with O(log n) calls to a split operation, end then building the new tree with O(log n) calls to a merge operation.

Observation 5.
We can maintain a top tree over T such that each cluster consists of edges from at most two segments of EET(T ), using O(log n) calls to merge and split per update. Path clusters will have edges from two segments, and leaf clusters, one segment.
The operation expose on the top tree takes one or two vertices and make them boundary of the level root cluster. Modifying this only slightly, one may even expose corners, giving complete control over which EET(T ) segment is available for information or modification. We may even expose any constant number of vertices or corners, but then at the highest level of the top tree, in stead of only T , we may have some constant number of clusters. Figure 3), all corners incident to w are contained in one or two EET(T ) segments. These segments will be sub-segments of the (one or two) segments corresponding to the parent cluster C (blue in Figure 3), and will not contain any corners incident to the (one or two) boundary vertices of C. Now suppose we associate a (lazy) deactivation count with each corner that is 0 before we start building the top tree. Define the merge operation on the top tree such that whenever a merge discards a boundary vertex we deactivate all corners on the at most two segments of EET(T ) mentioned in Observation 6 by increasing that count (and define the split operation on the top tree to reactivate them as necessary). When the top tree is complete, the corners that are still active (have deactivation count 0) are exactly those incident to the boundary vertices of the root of the top tree. These boundary vertices are controlled by the expose operation on the top tree and changing the boundary vertices require only O(log n) merges and splits, so we have now argued the following

Lemma 7. We can mark/unmark all corners incident to vertices u and v by increasing and decreasing the deactivation counts on O(log n) segments of the extended Euler tour.
What we really want is to be able to search for the marked corners in T * , so instead of storing the counts (even lazily) in the top tree over T , we will store them in a top tree over T * . Again, each cluster in this top tree covers one or two segments of the extended Euler tour. For each segment S we keep track of the minimum deactivation count c min (S), and a δ(S) that needs to be applied to all corners in the segment.

Linkable query
Unfortunately, the c min and δ values discussed in Section 2.2 are not quite enough to let us find the corners we are looking for. We can use it to ask what marked corners a given face is incident to, but we do not have enough to find pairs of marked corners on opposite sides of the same face on the co-tree path.
As noted in Observation 2 all candidates to a common face for two given vertices u and v, must lie on some path in the dual tree. And a path which is easily found! Since the dual of a primal tree edge induces a cycle that separates u and v, we may use the path between the dual endpoints f, g of any edge on the primal tree path between u and v. Furthermore, once we expose the path (f, g) in the dual tree, if f = g, it will have two EET-segments: the minimum deactivation count of one EET-segment is 0 iff any non-endpoint faces are incident to v, the other iff any are incident to u. Checking the endpoint faces can be done (cf. Observation 9), but to find non-endpoint faces we need more structure.
To just output one common face, our solution is for each path cluster in the top tree over the co-tree to keep track of a single internal face f min on the cluster path that is incident to minimally deactivated corners on either side of the cluster path if such a face exists. Proof. For each leaf cluster and for each side of each path cluster we can maintain the list of minimally deactivated corners adjacent to each boundary vertex. Then, instead of maintaining a single face f min for each path cluster, we can maintain a linked list of all relevant faces in the same time. And for each side of each face in the list we can point to a list of minimally deactivated corners that are adjacent to that side. For leaf-clusters, we point to a linked list of minimally deactivated corners incident to the boundary vertex. Upon the merge of clusters, face-lists and corner-lists may be linked together, and the point of concatenation is stored in the resulting merged cluster in case of a future split. Note that each face occurs in exactly one face-list.

S TA C S 2 0 1 5
As before, to perform linkable(u, v), expose u, v in the primal tree. Let e 0 be an edge on the tree-path between u and v, and expose the endpoints of e * 0 in the dual top tree. Now, the maintained face-list in the root of the dual top tree contains all faces incident to u, v, except maybe the endpoints of e * 0 , which can be handled separately, as before. The total time is therefore O(log 2 n) for the necessary expose operations, and then O(1) for each reply.
Observation 13. If we separately maintain a version of this data structure for the dual graph, then for faces f, g, linkable(f, g) in that structure lets us find vertices that are incident to both f and g.

Updates
In addition to the query, our data structure supports the following set of When calling remove(e) on a non-bridge tree-edge e, we need to search for a replacement edge. Luckily, e * induces a cycle in the dual tree, and any other edge on that cycle is a candidate for a replacement edge. If we like, we can augment the dual top tree so we can find the minimal-weight replacement edge, simply let each path cluster remember the cheapest edge on the tree-path, and expose the endpoints of e * . If we want to keep T as a minimum spanning tree, we also need to check at each insert and join that we remove the maximum-weight edge on the induced cycle from the spanning tree.
In general, when we need to update both the top trees over T and T * we must be careful that we first do the splits needed in the top tree over T to make each unchanged sub-tree into a (partial) top tree by itself, then update the top tree over T * and finally do the remaining splits and merges to rebuild the top tree over T . This is necessary because the merge and split we use for T depend on T and T * having related extended Euler tours. Any change to the graph, especially to the spanning tree, implies a change to the extended Euler Tour. Furthermore, any deletion or insertion of an edge implies a merge or split in the dual tree. E.g. if an edge is inserted across a face, that face is split in two. As a more complex example, if the nonbridge tree-edge e = (u, v) is deleted, the replacement edge is removed from the dual tree, and the endpoints of e * are merged. Finally, for flip to work we have to use a version of top trees that is not tied to a specific clockwise orientation of the vertices. The version in [1] that is based on a reduction to Frederickson's topology trees [7] works fine for this purpose.

Definition 14 (Articulation flip).
Having vertex split and vertex join functions, we may perform an articulation-flip -a flip in an articulation point: Given a vertex α incident to the face f 1 in two corners, c and c , we may cut through c, c , obtaining two graphs G 1 , G 2 , having split α in vertices α 1 ∈ G 1 , α 2 ∈ G 2 , and having introduced new corners c 1 , c 2 where we cut. Now, given a corner α p incident to α 1 and incident to some face f 2 , we may join α 1 with α 2 by the corners α 2 , α p , with or without having flipped the orientation of G 2 .

Definition 15 (Separation flip).
Similarly, given a separation pair α, β, incident to the faces f, g with corners c 1 , . . . c 4 , we may split through those corners, obtaining two graphs. We may then flip the orientation of one of them, and rejoin. We call this a separation-flip.

One-flip linkable query
Given vertices u, v, we have already presented a data structure to find a common face for u, v. Given they do not share a common face, we will determine if an articulation flip exists such that an edge between them can be inserted, and given no such articulation-flip exists, we will determine if a separation-flip that makes the edge insertion (u, v) possible exists. Let

Finding one face
Let u and v be given vertices, and assume there exists faces f u and The co-tree path from uL to uR goes through fu. The proof uses that the tree-path from u to v goes through some s ∈ S on the boundary of u's flipcomponent.
Let u L , u R be the left and right faces adjacent to the first edge on the path from u to v. Similarly let v L , v R be the left and right faces adjacent to the first edge on the path from v to u.
Proof. For symmetry reasons, we need only be concerned with the case f u . The perimeter of a flipcomponent consists of edges incident to f u and edges incident to f v (see Observation 17). Furthermore, in order for u, v to be linkable via a flip, u needs to lie on the perimeter of its flip-component. We also know that the tree-path from v to u must go through a point s in S which lies on the boundary of u's flip-component. Thus, there must exist a path p in G from π ∈ S to u, consisting only of edges incident to f u . Note that u / ∈ S since u, v were not already linkable. If the first edge e u on the tree path from u to v is not already incident to f u , then the union of p and the tree must contain an induced cycle containing e u , separating u L from u R , induced by an edge e i incident to f u . (See Figure 7.) But then, the co-tree path from u L to u R goes through e * i , which means it goes through f u .

Lemma 19. If there exists an induced cycle
the face that is on the same side of C as u. Here, meet(a, b, c) denotes a's projection to the path b · · · c.
Proof. By Lemma 18 f u is on the path u L · · · u R . And since C ∪ E[f u ] separates f from u L and u R it is on the paths u L · · · f and u R · · · f by Observation 16.

Lemma 20. If there exists an induced cycle
Proof. Let e be the edge in C \ T , and let e u , e v be the faces adjacent to e that are on the same side of C as f u and f v respectively. Then e is on all 4 paths in T * with u L or u R at one end and v L or v R at the other. At least one of u, v is in a different flip-component from e, so we can assume without loss of generality that u is. By Lemma 18 f u is on the path u L · · · u R . And since C ∪f u separates u L and u R from e u , f u is on both the paths u L · · · e u and u R · · · e u by Observation 16. Thus

Lemma 21. If an induced cycle
Proof. Let e be the edge in C \ T , and let e u , e v be the faces adjacent to e that are on the same side of C as f u and f v respectively. Then e is on all 4 paths in T * with u L or v R at one end and v L or u R at the other. Assume that u L and v R are on the side of C containing f u and u R and v L are on the side of C containing f v . At least one of u, v is in a different flipcomponent from e, so assume that v is. By lemma 18 f u is on the path u L · · · e u ⊂ u L · · · u R . And since C ∪ f u separates u L and e u from v R it is on both the paths u L · · · v R and e u · · · v R by Observation 16. Thus The remaining cases are symmetric.
Proof. If they exist there is at least one induced cycle C separating them. This cycle must have the properties of at least one of Lemmas 19, 20, or 21.
By computing the at most two different meet values and checking which ones (if any) contain u or v we therefore get at most two candidates and are guaranteed that at least one of them is in {f u , f v } if they exist.
Lemma 23. Given a top tree over a tree T , with vertices a, b, c ∈ T , we can find meet(a, b, c) in logarithmic time.
Proof. Split all clusters containing a, b, or c as a non-boundary vertex. There are only O(log n) of those. After these split-operations, we have a tree with O(log n) vertices. Use this tree to find meet(a, b, c) in linear time.

Finding the other face
Lemma 24. Let u, v, and f u be given. Then the first edge e L on f u · · · v L or the first edge e R on f u · · · v R induces a cycle C(e R ) or C(e L ) in T that separates f u from f v .

Proof.
By lemma 18, f v is on v L · · · v R in T * , so the first edge on f u · · · f v is also the first edge on either f u · · · v L or f u · · · v R .
Thus given the correct f u we can find at most two candidates for an edge e that induces a cycle C(e) in T that separates f u from f v , and be guaranteed that one of them is correct.
Observation 25. For each vertex, v, we may consider the projection π(v) of v onto the cycle C. For each flip-component, X, we may consider the projection π(X) = {π(v) | v ∈ X}. If X is an articulation-flip component, the projection π(X) is a single point in . If X is a separation-flip component, its projection is a segment of the cycle, π 1 · · · π 2 , between the separation pair (π 1 , π 2 ) ⊂ C(e) where π 1 , π 2 ∈ S.

Finding an articulation-flip
Let (x, y) be any edge inducing a cycle C in T ∪ {(x, y)} that separates f u from f v , let π(u) = meet T (u, x, y) be the projection of u on C.
Now the articulation-flip cases are not necessarily symmetrical. First we present how to detect an articulation-flip, given u, v, and f u , if f v plays the role of f 2 (see Definition 14).
If the flip-component containing v is an articulation-flip component, then π(v) is an articulation point incident to both f u and f v , but the opposite is not necessarily the case. Assume π(v) is incident to both f u and f v and let c u denote a corner between π(v) and f u .
Note that if π(v) is an articulation point with corners c 1 , c 2 both incident to f v , then f v is an articulation point in the dual graph with corners c 1 , c 2 both incident to π(v). Removing Figure 8 If fv is an articulation point, so is π(v). But then the co-tree path from uL to vL must go through fv. Left: Primal graph. Right: Dual graph.
f v from the dual graph would split its component into several components, and clearly, aside from f v , only faces in one of these components may contain faces incident to v. Any path in the co-tree starting and ending in different components w.r.t the split will have the property that the first face incident to v on that path is f v . (See Figure 8.) Now, in the case f u = f 1 and f v = f 2 , to find the corner of π(v) incident to f u , we can simply use query(π(v), u) from before, which will return a corner of f u incident to π(v). To find the two corners of f v : With the dual structure (see Observation 13) we may mark the face f v , and expose the vertices u, v. Now, π(v) has a unique place in the face-list of some cluster -if and only of that place is in the root cluster, and c min = 0 for both segments of that cluster, f v plays the role of f 2 . That is, iff π(v) has a corner incident to f v to one side, and a corner incident to f v to the other side. In affirmative case, π(v) appears with at least one corner to either vertex list; those corners can now be used as cutting-corners for the articulation-flip.
If instead f v played the role of f 1 , a similar procedure is done with π(u).

Finding a separation-flip
Assume v, u are not linkable via an articulation-flip, determine if they are linkable via a separation-flip. Proof. This follows from Observation 25: If π(u) is an endpoint of an arc f 1 · · · f 2 , then only one of the edges is in the same flip-component. If the projection is not an endpoint, then both of the edges are in the same flip-component.

Lemma 28.
Let C be any induced cycle separating f u from f v , let e u be an edge on C in the same flip-component as u, let f 1 be the face adjacent to e u that is separated from f u by C, and let f 2 ∈ {v L , v R } be a face on the same side of C as f 1 . Then f v is the first face on f 1 · · · f 2 that contains v.
separates f 1 and f 2 , so by Observation 16 f v is on the f 1 · · · f 2 path. It must be the first face on that path that contains v because for any face f after that, C ∪V [f ] does not separate f 1 and f 2 , since it can only touch the part of C between u = meet(u, x, y) and v = meet(v, x, y) where (x, y) is the edge inducing C.

Finding the separation pair and corners
Assume u, v are not linkable and not linkable via an articulation-flip.
Lemma 29. Given u, v, f u , and f v , let (x, y) * be any edge on f u · · · f v inducing a separating cycle C. If π(u) = π(v) = α, then α is one of the separation points if it is adjacent to both f u and f v , and otherwise no separation pair for u, v exists. The other separation point, β, is then the first vertex = α adjacent to both f u and f v on either α · · · x or α · · · y. If instead π(u) = π(v), then α, β are amongst the first two vertices adjacent to both f u and f v either on π(u) · · · x and v · · · x, or on u · · · y and v · · · y.
Proof. If the projection of u equals the projection of v, but u and v are in different flipcomponents, then the next point incident to both f u and f v along the cycle to either side will be the one we are looking for. However, (x, y) may be internal in the flip component containing u or that containing v, and thus one of the searches may return the empty list. But then the other will return the desired pair of vertices. If the projections are different, and do not themselves form the desired pair (α, β), then we may assume without loss of generality that π(v) does not belong to the flip-component containing u. Let X v , X u denote the flip-components containing u and v, respectively. If (x, y) is in X v , such that no edge on π(v) · · · x is incident to both f u and f v , then the first vertex on π(v) · · · y incident to f u and f v is α. Recall (Observation 25) that π(X u ) is an arc π 1 · · · π 2 ⊂ C, and suppose without loss of generality π 1 is on the path u · · · v. If π(u) = π 1 , β is the second vertex on the path u to y incident to both f u and f v , as π(u) itself is the first. Otherwise, the first such vertex on the path is β. If, on the other hand, (x, y) did not belong to X v , let x be the vertex of x, y with the property that the path u · · · x goes through π(u). Then the first vertices on the paths to x which are incident to f u and f v both, will be the desired separation pair.
Lemma 30. In the scenario above, we may find the first two vertices on the path incident to both faces in time O(log 2 n).
Proof. We use the dual structure (see Observation 13) to search for vertices incident to f u and f v . Now since the path π(u) · · · x is a sub-path of the cycle C induced by (x, y) which separates f u from f v , all corners incident to f v will be on one side, and all corners incident to f u will be on the other side of the path, or at the endpoints. Thus, we expose f u and f v in the dual structure, which takes time O(log 2 n). Now expose π(u), x in the primal tree. Since this path is part of the separating cycle, if c min = 0 for both segments, then the maintained vertex-list will contain exactly those vertices incident to both faces, and a corner list for each of them. We now deal separately with the endpoints exactly as with linkable, by exposing the endpoint faces one by one in the dual structure, and noting whether c min = 0 and in that case, the corner list, for each endpoint.
We conclude with the following theorem.