Fast and Compact Exact Distance Oracle for Planar Graphs

# Fast and Compact Exact Distance Oracle for Planar Graphs

[vincent.v,soerend,koolooz]@di.ku.dk
Søren Dahlgaard Research partly supported by Mikkel Thorup’s Advanced Grant DFF-0602-02499B from the Danish Council for Independent Research under the Sapere Aude research career programme. University of Copenhagen
[vincent.v,soerend,koolooz]@di.ku.dk
Christian Wulff-Nilsen University of Copenhagen
[vincent.v,soerend,koolooz]@di.ku.dk
###### Abstract

For a given a graph, a distance oracle is a data structure that answers distance queries between pairs of vertices. We introduce an -space distance oracle which answers exact distance queries in time for -vertex planar edge-weighted digraphs. All previous distance oracles for planar graphs with truly subquadratic space (i.e., space for some constant ) either required query time polynomial in or could only answer approximate distance queries.

Furthermore, we show how to trade-off time and space: for any , we show how to obtain an -space distance oracle that answers queries in time . This is a polynomial improvement over the previous planar distance oracles with query time.

## 1 Introduction

Efficiently storing distances between the pairs of vertices of a graph is a fundamental problem that has receive a lot of attention over the years. Many graph algorithms and real-world problems require that the distances between pairs of vertices of a graph can be accessed efficiently. Given an edge-weighted digraph with vertices, a distance oracle is a data structure that can efficiently answer distance queries between pairs of vertices .

A naive approach consists in storing an distance matrix, giving a distance query time of by a simple table lookup. The obvious downside is the huge space requirement which is in many cases impractical. For example, several popular routing heuristics (e.g.: for the travelling salesman problem) require fast access to distances between pairs of vertices. Unfortunately the inputs are usually too big to allow to store an distance matrix (see e.g.: [1])111In these cases, the inputs are then embedded into the 2-dimensional plane so that the distances can be computed in time at the expense of working with incorrect distances..

Fast and compact data structures for distances are also critical in many routing problems. One important challenge in these applications is to process a large number of online queries while keeping the space usage low, which is important for systems with limited memory or memory hierarchies. Therefore, the alternative naive approach consisting in simply storing the graph and answering a query by running a shortest path algorithm on the entire graph is also prohibitive for many applications.

Since road networks and planar graphs share many properties, planar graphs are often used for modeling various transportation networks (see e.g.: [26]). Therefore obtaining good space/query-time trade-offs for planar distance oracles has been studied thoroughly over the past decades [10, 3, 8, 12, 30, 4, 26].

If represents the space usage and represents the query time, the trivial solutions described above would suggest a trade-off of 222Using the shortest path algorithm for planar graphs of Henzinger et al. [16].. Up to logarithmic factors, this trade-off is achieved by the oracles of Djidjev [10] and Arikati, et al. [3]. The oracle of Djidjev further improves on this trade-off obtaining an oracle with for the range suggesting that this trade-off might instead be the correct one. Extending this trade-off to the full range of was the subject of several subsequent papers by Chen and Xu [8], Cabello [4], Fakcharoenphol and Rao [12], and finally Mozes and Sommer [26] (see also the result of Nussbaum [27]) obtaining a query time of for the entire range of (again ignoring constant and logarithmic factors).

It is worth noting that the above mentioned trade-off between space usage and query time is no better than the trivial solution of simply storing the distance matrix when constant (or even polylogarithmic) query time is needed. In fact the best known result in this case due to Wulff-Nilsen [30] who manages to obtain very slightly subquadratic space of and constant query time. It has been a major open question whether an exact oracle with truly subquadratic (that is, for any constant ) space usage and constant or even polylogarithmic query time exists. Furthermore, the trade-offs obtained in the literature suggest that this might not be the case.

In this paper we break this quadratic barrier:

###### Theorem 1.

Let be a weighted planar digraph with vertices. Then there exists a data structure with preprocessing time and space and a data structure with space and expected preprocessing time. Given any two query vertices , both oracles report the shortest path distance from to in in time.

In addition to Theorem 1 we also obtain a distance oracle with a trade-off between space and query time.

###### Theorem 2.

Let be a weighted planar digraph with vertices. Let denote the space, denote the preprocessing time, and denote the query time. Then there exists planar distance oracles with the following properties:

• , , and .

• , , and .

In particular, this result improves on the current state-of-the-art [26] trade-off between space and query time for . The main idea is to use two -divisions, where we apply our structure from Theorem 1 to one and do a brute-force search over the boundary nodes of the other.

#### Recent developments

We note that the main focus of this paper is on space usage and query time, and the the preprocessing time follows directly from our proofs (and by applying the result of [5] for subquadratic time).

After posting a preliminary version of this paper on arXiv [9], the algorithm of Cabello [5] was improved by Gawrychowski et al. [15] to run in deterministically. As noted in [15] this also improves the preprocessing time of our Theorem 1 to while keeping the space usage at . It is also possible to use Gawrychowski et al. to speed-up the pre-processing time of our distance oracle described in Theorem 2. This yields a distance oracle (in the notation of Theorem 2) with , , and , thus eliminating entirely the need of the second bullet point of Theorem 2.

### Techniques

We derive structural results on Voronoi diagrams for planar graphs when the centers of the Voronoi cells lie on the same face. The key ingredients in our algorithm are a novel and technical separator decomposition and point location structure for the regions in an -division allowing us to perform binary search to find a boundary vertex lying on a shortest-path between a query pair . These structures are applied on top of weighted Voronoi diagrams, and our point location structure relies heavily on partitioning each region into small “easy-to-handle” wedges which are shared by many such Voronoi diagrams. More high-level ideas are given in Section 3.

Our approach bears some similarities with the recent breakthrough of Cabello [5]. Cabello showed that abstract Voronoi diagrams [24, 25] studied in computational geometry combined with planar -division can be used to obtain fast planar graphs algorithms for computing the diameter and wiener index. We start from Cabello’s approach of using abstract Voronoi diagrams. While Cabello focuses on developing fast algorithms for computing abstract Voronoi diagrams of a planar graph, we introduce a decomposition theorem for abstract Voronoi diagrams of planar graphs and a new data structure for point location in planar graphs.

### 1.1 Related work

In this paper, we focus on distance oracles that report shortest path distances exactly. A closely related area is approximate distance oracles. In this case, one can obtain near-linear space and constant or near-constant query time at the cost of a small -approximation factor in the distances reported [28, 21, 19, 20, 32].

One can also study the problem in a dynamic setting, where the graph undergoes edge insertions and deletions. Here the goal is to obtain the best trade-off between update and query time. Fakcharoenphol and Rao [12] showed how to obtain for both updates and queries and a trade-off of and in general. Several follow up works have improved this result to negative edges and shaving further logarithmic factors [22, 17, 18, 14]. Furthermore, Abboud and Dahlgaard [2] have showed that improving this bound to for any constant would imply a truly subcubic algorithm for the All Pairs Shortest Paths (APSP) problem in general graphs.

In the seminal paper of Thorup and Zwick [29], a -approximate distance oracle is presented for undirected edge-weighted -vertex general graphs using space and query time for any integer . Both query time and space has subsequently been improved to space and query time while keeping an approximation factor of  [31, 6, 7]. This is near-optimal, assuming the widely believed and partially proven girth conjecture of Erdős [11].

## 2 Preliminaries and Notations

Throughout this paper we denote the input graph by and we assume that it is a directed planar graph with a fixed embedding. We assume that is connected (when ignoring edge orientations) as otherwise each connected component can be treated separately.

Section 4 will make use of the geometry of the plane and associate Jordan curves to cycle separators. Let be a planar embedded edge-weighted digraph. We use to denote the set of vertices of and we denote by the dual of (with parallel edges and loops) and view it as an undirected graph. We assume a natural embedding of i.e., each dual vertex is in the interior of its corresponding primal face and each dual edge crosses its corresponding primal edge of exactly once and intersects no other edges of . We let denote the shortest path distance from vertex to vertex in .

#### r-division

We will rely on the notion of -division introduced by Frederickson [13] and further developed by Klein et al. [23]. For a subgraph of , a vertex of is a boundary vertex if contains an edge not in that is incident to . We let denote the set of boundary vertices of . Vertices of are called internal vertices of . A hole of a subgraph of is a face of that is not a face of .

Let and be constants. For a number , an -division with few holes of (connected) graph (with respect to ) is a collection of subgraphs of , called regions, with the following properties.

1. Each edge of is in exactly one region.

2. The number of regions is at most .

3. Each region contains at most vertices.

4. Each region has at most boundary vertices.

5. Each region contains only holes.

We make the simplifying assumption that each hole of each region is a simple cycle and that all its vertices belong to . We can always reduce to this case as follows. First, turn into a simple cycle by duplicating vertices that are visited more than once in a walk of the hole. Then for each pair of consecutive boundary vertices in this walk, add a bidirected edge between them unless they are already connected by an edge of ; the new edges are embedded such that they respect the given embedding of . We refer to the new simple cycle obtained as a hole and it replaces the old hole .

We also make the simplifying assumption that each face of a region is either a hole or a triangle and that each edge of is bidirected. This can always be achieved by adding suitable infinite-weight edges that respect the current embedding of .

#### Non-negative weights and unique shortest paths

As mentioned earlier, we may assume w.l.o.g. that has non-negative edge weights. Furthermore, we assume uniqueness of shortest paths i.e., for any two vertices of a graph , there is a unique path from to that minimizes the sum of the weights of its edges. This can be achieved either with random perturbations of edge weights or deterministically with a slight overhead as described in [5]; we need the shortest paths uniqueness assumption only for the preprocessing step and thus the overhead only affects the preprocessing time and not the query time of our distance oracle.

#### Voronoi diagrams

We now define the key notion of Voronoi diagrams. Let be a graph and . Consider an -division with few holes of and a region and let be a hole of . Let be a vertex of not in .

Let be the graph obtained from by adding inside each hole of , a new vertex in its interior and infinite-weight bidirected edges between this vertex and the vertices of (which by the above simplifying assumption all belong to ), embedding the edges such that they are pairwise non-crossing and contained in .

Some of the following definitions are illustrated in Figure 1. Consider the shortest path tree in rooted at . For any vertex , define to be the subtree of rooted at . For each vertex we define the Voronoi cell of (w.r.t. , , and ) as the set of vertices of that belong to the subtree and not to any subtree for . The weighted Voronoi diagram of w.r.t.  and is the collection of all the Voronoi cells of the vertices in . For each vertex we say that its weight is the shortest path distance from to in . Note that since we assume unique shortest paths and bidirectional edges, the weighted Voronoi diagram of w.r.t.  and is a partition of the vertices of . Furthermore, each Voronoi cell contains exactly one vertex of . For any Voronoi cell , we define its boundary edges to be the edges of that have exactly one endpoint in . Let be the subgraph of consisting of the (dual) boundary edges over all Voronoi cells w.r.t.  and ; we ignore edge orientations and weights so that is an unweighted undirected graph. We define to be the multigraph obtained from by replacing each maximal path whose interior vertices have degree two by a single edge whose embedding coincides with the path it replaces. When is clear from context, we simply write .

## 3 High-level description

We now give a high-level description of our distance oracle where we omit the details needed to get our preprocessing time bounds. Our data structure is constructed on top of an -division of the graph. For each region of the -division we store a look-up table of the distance in between each ordered pair of vertices . We also store a look-up table of distances in from each vertex to the boundary vertices of . In total this part requires space.

The difficult case is when two vertices and from different regions are queried. To do this we will use weighted Voronoi diagrams. More specifically, for every vertex , every region , and every hole of , we construct a recursive separator decomposition of the weighted Voronoi diagram of w.r.t.  and . The goal is to determine the boundary vertex such that is contained in the Voronoi cell of . If we can do this, we know that for one of the holes of . To determine this we use a carefully selected recursive decomposition. This decomposition is stored in a compact way and we show how it enables binary search to find in time.

In order to store all of the above mentioned parts efficiently we will employ the compact representation of the abstract Voronoi diagram (namely as defined in the previous section). This requires only space for each choice of , , and for a total of space. This also dominates the space for storing the recursive decompositions.

Finally, we store for each graph and each possible separator of the set of vertices on one side of the separator, since this is needed to perform the binary search. This is done in a compact way requiring only space per region. Thus, the total space requirement of our distance oracle is . Picking gives the desired space bound.

## 4 Recursive Decomposition of Regions

In this section, we consider a region in an -division of a planar embedded graph , a vertex , and a hole of which we may assume is the outer face of . To simplify notation, we identify with and let denote the boundary vertices of belonging to , i.e., (by our simplifying assumption regarding holes in the preliminaries). The dual vertex corresponding to is denoted or just .

We assume that contains at least three boundary vertices. Recall that each face of other than the outer face is a triangle and so, each vertex of other than has degree . Moreover, every cell of contains exactly one boundary vertex, therefore the boundary of each cell of contains exactly one occurrence of and contains at least one other vertex. Also note that the cyclic ordering of cells of around is the same as the cyclic ordering of boundary vertices of .

Construct a plane multigraph from as follows. First, for every Voronoi cell , add an edge from to each vertex of other than itself; these edges are embedded such that they are fully contained in and such that they are pairwise non-crossing. For each such edge , denote by the cell it is embedded in. To complete the construction of , remove every edge incident to belonging to . The construction of is illustrated in Figure 2.

#### Recursive decomposition using a Voronoi diagram

In this section, we show how to obtain a recursive decomposition of into subgraphs called pieces. A piece is decomposed into two smaller pieces by a cycle separator of size containing . Each of the two subgraphs of is obtained by replacing the faces of on one side of by a single face bounded by . The separator is balanced w.r.t. the number of faces of on each side of . The recursion stops when a piece with at most six faces is obtained. It will be clear from our construction below that the collection of cycle separators over all recursive calls form a laminar family, i.e., they are pairwise non-crossing.

We assume a linked list representation of each piece where edges are ordered clockwise around each vertex.

Lemma 2 below shows how to find the cycle separators needed to obtain the recursive decomposition into pieces. Before we can prove it, we need the following result.

###### Lemma 1.

Let be one of the pieces obtained in the above recursive decomposition. Then for every vertex of other than ,

1. has at least two edges incident to ,

2. for each edge of where , the edge preceding and the edge following in the clockwise ordering around are both incident to , and

3. for every pair of edges and where immediately follows in the clockwise ordering around , if both edges are directed from to then the subset of the plane to the right of and to the left of is a single face of .

###### Proof.

The proof is by induction on the depth in the recursion tree of the node corresponding to piece . Assume that and let be given. The first and third part of the lemma follow immediately from the construction of and the assumption that . To show the second part, it suffices by symmetry to consider the edge following in the cyclic ordering of edges around in . Since and belong to the same face of and since each face of contains and at most three edges, the second part follows.

Now assume that and that the claim holds for smaller values. Let be given. Consider the parent piece of in the recursive decomposition tree and let be the cycle separator that was used to decompose . Then contains and one additional vertex . To show the inductive step, we claim that we only need to consider the case when . This is clear for the first and second part since if then has the same set of incident edges in and in . It is also clear for the third part since is a subgraph of .

It remains to show the induction step when . The first part follows since the two edges of are incident to and to and belong to . The second part follows by observing that the clockwise ordering of edges around in is obtained from the clockwise ordering around in by removing an interval of consecutive edges in this ordering; furthermore, the first and last edge in the remaining interval are both incident to . Applying the induction hypothesis shows the second part.

For the third part, if immediately follows in the clockwise ordering around in then the induction hypothesis gives the desired. Otherwise, and must be the two edges of and is obtained from by removing the faces to the right of and to the left of and replacing them by a single face bounded by . ∎

In the following, let be a piece with more than six faces. The following lemma shows that has a balanced cycle separator of size which can be found in time.

###### Lemma 2.

as defined above contains a -cycle containing such that the number of faces of on each side of is a fraction between and of the total number of faces of . Furthermore, can be found in time.

###### Proof.

We construct iteratively. In the first iteration, pick an arbitrary vertex of and let consist of two distinct arbitrary edges, both incident to and . This is possible by the first part of Lemma 1.

Now, consider the th iteration for and let and be the two vertices of the -cycle obtained in the previous iteration. If satisfies the condition of the lemma, we let and the iterative procedure terminates.

Otherwise, one side of contains more than of the faces of . Denote this set of faces by and let be the set of edges of incident to , contained in faces of , and not belonging to . We must have ; otherwise, it follows from the third part of Lemma 1 that contains only a single face of (bounded by ), contradicting our assumption that contains more than six faces and that contains more than of the faces of .

If contains an edge incident to , pick an arbitrary such edge . This edge partitions into two non-empty subsets; let be the larger subset. We let and let be the -cycle consisting of and the edge of such that one side of contains exactly the faces of .

Now, assume that none of the edges of are incident to . Then by the second part of Lemma 1, contains exactly one edge . We let be the other endpoint of and we let consist of the two edges incident to which belong to the two faces of incident to .

To show the first part of the lemma, it suffices to prove that the above iterative procedure terminates. Consider two consecutive iterations and and assume that the procedure does not terminate in either of these. We claim that then . If we can show this, it follows that which implies termination.

If contains an edge incident to then contains more than of the faces of . Since the procedure does not terminate in iteration , must in fact contain more than of the faces so , as desired.

Now, assume that none of the edges of are incident to . Then one side of contains exactly the faces of excluding two. Since we assumed that contains more than six faces, this side of contains more than of these faces. Hence, , again showing the desired.

For the second part of the lemma, note that counting the number of faces of contained in one side of a -cycle containing can be done in the same amount of time as counting the number of edges incident to from one edge of the cycle to the other in either clockwise or counter-clockwise order around . This holds since every face of contains . It now follows easily from our linked list representation of with clockwise orderings of edges around vertices that the th iteration can be executed in time for each . This shows the second part of the lemma. ∎

###### Corollary 1.

Given and , its recursive decomposition can be computed in time.

###### Proof.

has complexity and can be found in time linear in this complexity. Since the recursive decomposition of has levels and since the total size of pieces on any single level is , the corollary follows from Lemma 2. ∎

###### Lemma 3.

The recursive decomposition of can be stored using space.

###### Proof.

Observe that the number of nodes of the tree decomposition is and each separator consists of two edges and so takes space. ∎

#### Embedding of RΔ(u):

We now provide a more precise definition of the embedding of . Let be the face of corresponding to in , i.e., is the hole . Consider the graph that consists of plus a vertex located in and an edge between each vertex of and . The rest of is embedded consistently with respect to the embedding of .

Now, consider the following embedding of . First, embed to . We now specify the embedding of each edge adjacent to . Recall that each edge that is adjacent to lies in a single cell of . For each such edge going from to a vertex of , we embed it so that it follows the edge from to the boundary vertex of , then the shortest path in from to the vertex of on the face corresponding to in . Note that by definition of such a vertex exists. We also remark that since the edges follow shortest paths and because of the uniqueness of the shortest paths they may intersect but not cross (and hence do not contradict the definition of ).

It follows that there exists a 1-to-1 correspondence between 2-cycle separators going through of and cycle separators of consisting of an edge , the shortest paths between and a boundary vertex and and a boundary vertex and and . We call the set the representation of this separator. This is illustrated in Figure 3. Thus, for any 2-cycle separator going through , we say that the set of vertices of that is in the interior (resp. exterior) of is the set of vertices of that lie in the bounded region of the place defined by the Jordan curve corresponding to the cycle separator in that is in 1-1 correspondence with .

We can now state the main lemma of this section.

###### Lemma 4.

Let be a vertex of . Assume there exists a data structure that takes as input a the representation of a 2-cycle separator of going through and answers in time queries of the following form: Is in the bounded closed subset of the plane with boundary ? Then there exists an algorithm running in time that returns a set of at most Voronoi cells of such that one of them contains .

###### Proof.

The algorithm uses the recursive decomposition of described in this section. Note that the decomposition consists of 2-cycle separators going through . Thus, using the above embedding, each of the 2-cycle of the decomposition corresponds to a separator consisting of an edge and the shortest paths and where are boundary vertices of . Additionally, belongs to the Voronoi cell of in and belongs to the Voronoi cell of in . Therefore, and are vertex disjoint and so the data structure can be used to decide on which side of such a separator is.

The algorithm is the following: proceed recursively along the recursive decomposition of and for each -cycle separator of the decomposition use the data structure to decide in time in which side of the 2-cycle is located and then recurse on this side. If belongs to both sides, i.e., if is on the -cycle separator, recurse on an arbitrary side. The algorithm stops when there are at most faces of and then it returns the Voronoi cells of intersecting those faces.

Observe that the separators do not cross. Thus, when the algorithm obtains at a given recursive call that is in the interior (resp. exterior) of a 2-cycle and in the exterior (resp. interior) of the 2-cycle separator corresponding to the next recursive call, we can deduce that lies in the intersection of the interior of and the exterior of and hence deduce that it belongs to a Voronoi cell that lies in this area of the plane.

Note that by Lemma 2 the number of faces of in a piece decreases by a constant factor at each step. Thus, since the number of boundary vertices is , the procedure takes at most time.

Finally, observe that each face of that is adjacent to lies in a single Voronoi cell of . Thus, since at the end of the recursion there are at most faces in the piece, they correspond to at most different Voronoi cells of . Hence the algorithm returns at most different Voronoi cells of .

## 5 Preprocessing a Region

Given a query separator in a graph and given a query vertex in , our data structure needs to determine in time the side of that belongs to. In this section, we describe the preprocessing needed for this.

In the following, fix as well as an ordered pair of vertices of such that either or is an edge of . The preprocessing described in the following is done over all such choices of and (and all holes ).

The vertices of are on a simple cycle and we identify with this cycle which we orient clockwise (ignoring the edge orientations of ). We let denote this clockwise ordering where . It will be convenient to calculate indices modulo so that, e.g., .

Given vertices and in , let denote the shortest path in from to . Given two vertices , we let denote the subpath of cycle consisting of the vertices from to in clockwise order, where is the single vertex if and if . We let denote the subgraph of contained in the closed and bounded region of the plane with boundary defined by , , and . We refer to as a wedge and call it a basic wedge if and are consecutive in the clockwise order, i.e., if . We need the following lemma.

###### Lemma 5.

Let be a given vertex of . Then there is a data structure with preprocessing time and size which answers in time queries of the following form: given a vertex and two distinct vertices , does belong to ?

###### Proof.

Below we present a data structure with the bounds in the lemma which only answers restricted queries of the form “does belong to ?” for query vertices and . In a completely symmetric manner, we obtain a data structure for restricted queries of the form “does belong to ?” for query vertices and . We claim that this suffices to show the lemma. For consider a query consisting of and . If then and otherwise, . Hence, answering a general query can be done using two restricted queries and checking if can be done in constant time by comparing indices of the query vertices.

It remains to present the data structure for restricted queries of the form “does belong to ?”. In the preprocessing step, each is assigned the smallest index for which . Clearly, this requires only space and below we show how to compute these indices in time.

Consider a restricted query specified by a vertex of and a boundary vertex where . Since iff , this query can clearly be answered in time.

It remains to show how the indices can be computed in a total of time. Let be with all its edge directions reversed. In time, a SSSP tree from in is computed. Let be the tree in obtained from by reversing all its edge directions; note that all edges of are directed towards and for each , the path from to in is a shortest path from to in .

Next, is computed and for each vertex , set . The rest of the preprocessing algorithm consists of iterations where iteration assigns each vertex the index . This correctly computes indices for all vertices of . In the following, we describe how iteration is implemented.

First, the path is traversed in until a vertex is encountered which previously received an index. In other words, is the first vertex on belonging to . Note that is well-defined since . Vertices that are in or in a subtree of rooted in a vertex of and extending to the right of this path are assigned the index value . Furthermore, vertices belonging to a subtree of rooted in a vertex of and extending to the left of this path are assigned the index value , except those on (as they belong to ).

Since is connected, it follows that the vertices assigned an index of are exactly those belonging to and that the running time for making these assignments is . Over all , total running time is ; this follows by a telescoping sums argument and by observing that vertex sets are pairwise disjoint. ∎

Given distinct vertices , if and do not cross (but may touch and then split), let denote the subgraph of contained in the closed and bounded region of the plane with boundary defined by , , , and an edge of between vertex pair . In order to simplify notation, we shall omit and and simply write .

It follows from planarity that there is at most one such that belongs to when ignoring edge orientations. If exists, we refer to it as ; otherwise denotes some dummy vertex not belonging to .

The goal in this section is to determine whether a given query vertex belongs to a given query subgraph . The following lemma allows us to decompose this subgraph into three simpler parts as illustrated in Figure 4. We will show how to answer containment queries for each of these simple parts.

###### Lemma 6.

Let and be distinct vertices of and assume that and are vertex-disjoint. Then where if and otherwise.

###### Proof.

Figure 5 gives an illustration of the proof. We first show the following result: given a vertex such that , is contained in for each . The proof is by induction on the number of edges in . The base case is trivial since then so assume that and that the claim holds for . If is the last edge on , the induction step follows from uniqueness of shortest paths. Otherwise, neither nor belong to (since ). By the induction hypothesis, is contained in and since cannot cross , cannot cross . Also, cannot cross since then either or would belong to . Since , it follows that is contained in which completes the proof by induction.

Next, assume that so that . Note that . Picking above implies that is contained in and hence .

Now consider the other case of the lemma where . Picking above, it follows that is contained in . It suffices to show that is contained in since this will imply that is well-defined and that is contained in and hence that .

Assume for contradiction that is not contained in .

By uniqueness of shortest paths, does not cross . Since , we have that when ignoring edge orientations, belongs to . Hence is not contained in so it crosses . Let be a vertex on such that the successor of on is not contained in . By our assumption above that is not contained in , there is a first vertex on such that its successor does not belong to . By uniqueness of shortest paths, cannot belong to so it must belong to . This also implies that since and and are vertex-disjoint. Since is a subpath of and , shortest path uniqueness implies that and are vertex-disjoint.

Since is contained in , belongs to the subgraph of contained in the closed region of the plane bounded by , , and . Since does not intersect , thus intersects either or . However, it cannot intersect since then would be non-simple. By uniqueness of shortest paths, also cannot intersect since is a subpath of and . This gives the desired contradiction, concluding the proof. ∎

Let be a collection of subpaths such that for each path in , and . We may choose the paths such that and such that all edges of except (if it exists) belongs to a path of . It is easy to see that this is possible by considering a greedy algorithm which in each step picks a maximum-length path which is edge-disjoint from previously picked paths and which satisfies the two stated requirements.

The next lemma allows us to obtain a compact data structure to answer queries of the form “does face belong to ” for given query face and query index .

###### Lemma 7.

Let be given. Then

1. an index exists with such that is undefined for and well-defined for ,

2. for each face of , there is at most one index with such that and