The geodesic 2-center problem in a simple polygonThis work was supported by the NRF grant 2011-0030044 (SRC-GAIA) funded by the government of Korea.

# The geodesic 2-center problem in a simple polygon††thanks: This work was supported by the NRF grant 2011-0030044 (SRC-GAIA) funded by the government of Korea.

Eunjin Oh Pohang University of Science and Technology, Korea. Email: {jin9082, heekap}@postech.ac.kr    Jean-Lou De Carufel University of Ottawa, Canada. Email: jdecaruf@uottawa.ca    Hee-Kap Ahn22footnotemark: 2  Corresponding author.
###### Abstract

The geodesic -center problem in a simple polygon with vertices consists in the following. Find a set of points in the polygon that minimizes the maximum geodesic distance from any point of the polygon to its closest point in . In this paper, we focus on the case where and present an exact algorithm that returns a geodesic -center in time.

## 1 Introduction

The geodesic -center problem in a simple polygon with vertices consists in the following. Find a set of points in that minimizes {linenomath}

 maxp∈Pmins∈Sd(s,p),

where is the length of the shortest path between and lying in (also called geodesic distance). The set is called a -center of . Geometrically, this is equivalent to find smallest-radius geodesic disks with the same radius whose union contains .

The -dimensional Euclidean -center problem is similar to the geodesic -center problem in a simple polygon . The only difference is that in the Euclidean -center problem, the distance between two points and is their Euclidean distance, denoted by . That is, given a set of points in the plane, find a set of points in that minimizes {linenomath}

 maxp∈Pmins∈S∥p−s∥.

Computing a -center of points is a typical problem in clustering. Clustering is the task of partitioning a given set into subsets subject to various objective functions, which have applications in pattern-analysis, decision-making and machine-learning situations including data mining, document retrieval, and pattern classification . The Euclidean -center problem has been studied extensively. The -center of coincides with the center of the minimum enclosing circle of , which can be computed in linear time . Chan showed that the -center problem can be solved in deterministic time . The -center problem can be solved in time . It is NP-hard to approximate the Euclidean -center problem within an approximation factor smaller than 1.822 . Kim and Shin presented an -time algorithm for computing two congruent disks whose union contains a convex -gon .

The -center problem has also been studied under the geodesic metric inside a simple polygon. Asano and Toussaint presented the first algorithm for computing the geodesic -center of a simple polygon with vertices in time . In 1989, the running time was improved to time by Pollack et al. . Their technique can be described as follows. They first triangulate the polygon and find the triangle that contains the center in time. Then they subdivide further and find a region containing the center such that the combinatorial structures of the geodesic paths from each vertex of to all points in that region are the same. Finally, the problem is reduced to find the lowest point of the upper envelope of a family of distance functions in the region, which can be done in linear time using a technique by Megiddo . Recently, the running time for computing the geodesic -center was improved to linear by Ahn et al. [1, 2], which is optimal. In their paper, instead of triangulating the polygon, they construct a set of chords. Then they recursively subdivide the polygon into cells by a constant number of chords and find the cell containing the center. Finally, they obtain a triangle containing the center. In this triangle, they find the lowest point of the upper envelope of a family of functions, which is the geodesic 1-center of the polygon, using an algorithm similar to the one of Megiddo .

Surprisingly, there has been no result for the geodesic -center problem for , except the one by Vigan . They gave an exact algorithm for computing a geodesic -center in a simple polygon with vertices, which runs in time. The algorithm follows the framework of Kim and Shin . However, the algorithm does not seem to work as it is because of the following reasons. They claim that the decision version of the geodesic -center problem in a simple polygon can be solved using a technique similar to the one by Kim and Shin  without providing any detailed argument. They apply parametric search using their decision algorithm, but they do not describe how their parallel algorithm works. The parallel algorithm by Kim and Shin does not seem to extend for this problem.

### 1.1 Our results

In this paper, we present an -time algorithm that solves the geodesic -center problem in a simple polygon with vertices. The main steps of our algorithm can be described as follows. We first observe that a simple polygon can always be partitioned into two regions by a geodesic path such that

• and are two points on the boundary of , and

• the set consisting of the geodesic 1-centers of the two regions of defined by is a geodesic 2-center of .

Then we consider candidate pairs of edges of , one of which, namely , satisfies and . We explain how to find these candidate pairs of edges in time. Finally, we present an algorithm that computes a -center restricted to such a pair of edges in time using parametric search  with a decision algorithm and a parallel algorithm.

## 2 Preliminary

A polygon is said to be simple if it is bounded by a closed path, and every vertices are distinct and edges intersect only at common endpoints. The polygon is weakly simple if, for any , there is a simple polygon such that the Fréchet distance between and is at most  . The algorithms we use in this paper are designed for simple polygons, but they also work for weakly simple polygons.

The vertices of a simple polygon with vertices are labeled in clockwise order along the boundary of . We set for all . An edge whose endpoints are and is denoted by . For ease of presentation, we make the following general position assumption: no vertex of is equidistant from two distinct vertices of , which was also assumed in . This assumption can be removed by applying perturbation to the degenerate vertices .

For any two points and lying inside a (weakly) simple polygon , the geodesic path between and , denoted by , is the shortest path inside between and . The length of is called the geodesic distance between and , denoted by . The geodesic path between any two points in is unique. The geodesic distance and the geodesic path between and can be computed in and time, respectively, after an -time preprocessing, where is the number of vertices on the geodesic path . The vertices of excluding and are reflex vertices of and they are called the anchors of . If is a line segment, it has no anchor. In this paper, “distance” refers to geodesic distance unless specified otherwise.

Given a set of points in (for instance a polygon or a disk), we use to denote the boundary of . A set is geodesically convex if for any two points and in . For any two points and on , let be the part of in clockwise order from to . For , let be the vertex . The subpolygon of bounded by and is denoted by . Note that may not be simple, but it is always weakly simple. Indeed, consider the set of Euclidean disks centered at points on with radius . There exists a simple polygonal curve connecting and that lies in the union of these disks and that does not intersect except at and . The region bounded by that simple curve and is a simple polygon whose Fréchet distance from is at most .

The radius of , denoted by , is defined as , where is the geodesic -center of . Given two points , we set . Notice that is monotonically increasing as moves clockwise from along . Similarly, is monotonically decreasing as moves clockwise from along .

The geodesic disk centered at a point with radius , denoted by , is the set of points whose geodesic distances from are at most . The boundary of a geodesic disk inside consists of disjoint polygonal chains of and circular arcs . Given a center and a radius , can be computed in time as follows. We first compute the shortest path map of in linear time . Each cell in the shortest path map of is a triangle and every point in the same cell has the same combinatorial structure of . Thus, a cell in the shortest path map of intersects at most two circular arcs of . Moreover, a circular arc intersecting a cell is a part of the boundary of the Euclidean disk centered at with radius , where is the (common) anchor of closest to for a point , if it exists, or itself, otherwise. With this fact, we can compute by traversing the cells from a cell to its neighboring cell and computing the circular arcs of in time linear in the number of cells and circular arcs, which is .

We call a set of two points a -set. For instance, a geodesic -center of is a -set. We slightly abuse notation and write (instead of the usual notation for a set) to designate the -set defined by and . The radius of a -set in , denoted by , is defined as {linenomath}

 rP(c1,c2)=maxp∈Pmin{d(c1,p),d(c2,p)}.

A geodesic -center of is a -set with minimum radius. Note that given any -set and , it holds that .

For any two points , the bisector of and is defined as the set of points in equidistant from and . The bisector of two points may contain a two-dimensional region if there is a vertex of equidistant from and . If we remove all two-dimensional regions from the bisector, we are left with curves each of which is contained in with two endpoints on . Among such curves, we call the one crossing the bisecting curve of and , denoted by . See Figure 1(a). Figure 1: (a) The bisector of p and q contains two 2-dimensional regions (two dashed triangles). We have two line segments x1x2 and x3x4 after removing two 2-dimensional regions. Here, b(p,q)=x3x4. (b) For any point z in C[α,β], we have d(z,c1)≤r for any radius r for the geodesic disks containing P centered at c1 and c2, where α and β are the endpoints of b(c1,c2).

## 3 The partition by a 2-center

Although there may exist more than one geodesic -center of , the radius of any geodesic -center is the same. Let be a geodesic -center and . For any two points and on , let . We say that two geodesic disks cover if the union of the two geodesic disks coincides with .

###### Lemma 1

[19, Lemma 1] Let and be points in . As varies along , is a convex function of , and .

###### Lemma 2

If is covered by two geodesic disks centered at points in with radius , then there are two points with .

Proof.  Let and be the centers of the two geodesic disks with radius covering . Let and be the two endpoints of the bisecting curve . We will argue that .

Without loss of generality, assume that lies in the subpolygon of bounded by and . Let be any point on . See Figure 1(b). Since coincides with , we have . Also, since and lie in the same side of , we have . Therefore, .

Moreover, for any point , it holds that by Lemma 1. Then, since and are the endpoints of , we find , from which . Therefore, the boundary of is contained in and so is by the geodesic convexity of .

Similarly, we can show that is contained in . Consequently, .

For any -set in and any radius , we call a pair of points on a point-partition of with respect to if and for all points and . Note that a point-partition with respect to does not exist if . A pair of edges is called an edge-partition with respect to if there is a point-partition with respect to for and . A point-partition and an edge-partition with respect to are said to be optimal. By Lemma 2, there always exist an optimal point-partition and an optimal edge-partition in a simple polygon. Note that a point-partition and an edge-partition with respect to are not necessarily unique if , where and are the two endpoints of . If an optimal point-partition of is given, we can compute a -center in linear time using the algorithm in [1, 2].

Our general strategy is to first compute a set of pairs of edges, which we call candidate edge pairs, containing at least one optimal edge-partition. For each candidate edge pair , we compute a -center restricted to . That is, a -set such that and are the -centers of and , respectively, where is the pair realizing .

### 3.1 Computing a set of candidate edge pairs

In this section, we define candidate edge pairs and describe how to find the set of all candidate edge pairs in time. Let be the function which maps each vertex of to the set of vertices of that minimize . It is possible that there are more than one vertex that minimizes . Moreover, such vertices appear on the boundary of consecutively. This is because the function is non-decreasing and is non-increasing as moves clockwise from along .

We use to denote the set of all vertices on that come after and before any vertex in in clockwise order. Similarly, we use to denote the set of all vertices on that come after and before any vertex in in counterclockwise order. Refer to Figure 2. The three sets , and are pairwise disjoint by the fact that and by the monotonicity of and .

Given two points , recall that we set .

###### Lemma 3

Given a vertex of , it holds that for any vertex and for any vertex .

Proof.  Let us focus on the first inequality. Assume to the contrary that for some vertex . Let be a vertex in . Since and , we have . Thus , which contradicts the fact that .

We can prove the second inequality in a similar way.

###### Lemma 4

Let be a vertex of . For a vertex , it holds that , where is the last vertex of from in clockwise order.

Proof.  Let be the last vertex of from in clockwise order. We show that , which implies the lemma.

Assume to the contrary that . By Lemma 3 and the monotonicity of the functions and , we have . Similarly, we get . Thus, by the monotonicity of . This contradicts the fact that is the last vertex of from in clockwise order. Figure 3: According to the relative positions for vcw(i+1) and vccw(i), the candidate edges of ei are defined. (a) Four candidate edges of type (1) and one candidate edge of type (2). (b) Four candidate edges of type (1).

Given an edge , an edge is called a candidate edge of if it belongs one of the following two types. For a vertex , let be the last vertex of from in clockwise order and be the first vertex of from in counterclockwise order. Refer to Figure 3.

1. (or ) is or .

2. has both endpoints in the interior of and comes before from in clockwise order along . The edge marked with thick line segment in Figure 3(a) satisfies this condition.

A pair of edges is called a candidate edge pair if is a candidate edge of .

###### Lemma 5

There is an optimal edge-partition in the set of all candidate edge pairs.

Proof.  By Lemma 2, there exists an optimal point-partition. Among all optimal point-partitions, let be one such that is not an optimal point-partition for any . Let be an optimal edge-partition with and . If is a vertex, let be an edge such that (so that in all cases, the counterclockwise neighbor of is ). Our goal is to show that if there is no candidate edge pair of type (1), then is a candidate edge pair of type (2). Thus, we need to locate with respect to and .

Assume that is not a candidate edge pair of type (1). We claim the followings.

Suppose these two claims are true. Then, appears after as we move clockwise from along since we assume that is not a candidate edge pair of type (1). Moreover, has both endpoints in the interior of . Therefore, is a candidate edge pair of type (2).

It remains to prove the two claims. We start with the first one. The strategy is to show that if the first claim is not true, there is another optimal edge-partition belonging to type (1). Let be the last clockwise point from which minimizes . By the definitions of and , we have

 rmax(vi,x′i) =r(vi,x′i) =r(x′i,vi), rmax(α,β) =r(α,β) =r(β,α).

Since is an optimal point-partition, we have

 r(x′i,vi)=rmax(vi,x′i)≥rmax(α,β)=r(β,α). (1)

If our first claim is not true, then comes after in clockwise order from . This implies that comes after in clockwise order from . We show that . If not, we would have , from which, by the monotonicity of the functions and ,

 r(x′i,vi)>r(β,α)≥r(β,vi)≥r(x′i,vi),

which is a contradiction. Therefore, , which means that is an optimal point-partition since we now have .

Let us redefine as and as . We also redefine as an optimal edge-partition such that and (if is a vertex, we choose such that ). In this way, remains the same. Thus is the counterclockwise neighbor of . Therefore, is a candidate pair of type (1).

We now prove the second claim. The second claim can be proved in a similar way. Assume to the contrary that . Then comes before from in clockwise order. Let be the first clockwise point from that minimizes . Thus, comes before from in clockwise order. Then the following holds:

 rmax(vi+1,x′i+1)=r(vi+1,x′i+1)≤r(vi+1,β)≤r(α,β)=rmax(α,β).

This implies that is also an optimal point-partition. We redefine as and as . We also redefine and accordingly. This pair is a candidate edge pair of type (1).

Therefore, we have an optimal edge-partition in the set of all candidate edge pairs. Figure 4: Two candidate edge pairs (ei,ek) and (ej,ek) of type (2). ei comes before ej from ek.
###### Lemma 6

There are candidate edge pairs.

Proof.  Since and are uniquely defined for any vertex of , the total number of candidate edge pairs of type (1) is at most .

Now we consider the candidate edge pairs which have not been counted yet. Assume that for an edge there are two distinct candidate edge pairs, say and , of type (2). Without loss of generality, we assume that comes before than in clockwise order from . Since they are candidate edge pairs of type (2), is contained in the intersection of and .

We now argue that lies on . Suppose that for the sake of a contradiction. Then, since is contained in , the vertex lies in the interior of . This contradicts the fact that comes before than in clockwise order from . Therefore, lies on , which means that . Refer to Figure 4.

Consequently, by Lemma 4, lies in . Since is contained in , lies in . This implies that is not contained in , which is a contradiction.

Therefore, for an edge , there exists at most one edge such that is a candidate edge pair of type (2). Thus the number of candidate edge pairs of type (2) is .

Now we present a procedure for finding the set of all candidate edge pairs. For each index , we compute and in time. To find , we apply binary search on the vertices of using Lemma 3 and a linear-time algorithm [1, 2] that computes the center of a simple polygon. We can find in a similar way. This takes time in total.

Then, we compute the set of all candidate edge pairs based on the information we just computed. For each edge , we consider the edges lying between and if comes before from in clockwise order. Otherwise, we consider the four edges incident to and . In total, this takes time linear to the number of candidate edge pairs, which is by Lemma 6.

###### Lemma 7

The set of all candidate edge pairs can be computed in time.

## 4 A decision algorithm for a candidate edge pair

We say that a point-partition is restricted to if and . We say that a triplet consisting of a -set and a radius is restricted to if some point-partitions with respect to are restricted to . We consider as a function whose variables are and . Since the function is continuous and the domain is bounded, there exist two points, and , that minimize the function. We call a -center restricted to if and are the -centers of and , respectively. By Lemma 5, there is a -center restricted to a candidate edge pair which is a -center (without any restriction).

In this section, we present a decision algorithm for a candidate edge pair . Let be the radius of a -center restricted to . Let be an input of the algorithm. The decision algorithm in this section returns “yes” if . Additionally, it returns a -center restricted to with radius . It returns “no”, otherwise.

Throughout this section, we assume that and because the other cases can be handled easily: if or , we return “no”. For the remaining cases, we return “yes”.

The decision algorithm first assumes that and constructs a -center restricted to with radius . The -center produced by the algorithm is valid if and only if . Therefore, the algorithm can then decide whether by checking whether the -center is valid. Thus, from now on, we assume that . Let be a triplet consisting of a -set and radius which is restricted to , and be a point-partition with respect to which is restricted to . Without loss of generality, we assume that contains and contains .

### 4.1 Computing the intersection of geodesic disks

The first step of the decision algorithm is to compute the intersection of the geodesic disks of radius centered at and the intersection of the geodesic disks of radius centered at , that is, and . Clearly, and .

We compute and by constructing the farthest-point geodesic Voronoi diagrams, denoted by and , of the vertices in and the vertices in , respectively. For the case that the sites are on the vertices of , the diagram can be computed in time .

A cell in associated with a site consists of the points such that is the site farthest from among all sites. A refined cell in associated with site is obtained by further subdividing the cell associated with site such that all points in the same refined cell have the same combinatorial structure of the shortest paths from their common farthest site. While constructing and , the algorithm  computes all refined cells. For each refined cell, we can store the information of the common farthest site of the refined cell and the anchor of closest to for a point in the refined cell.

Then we compute circular arcs of and contained in a refined cell in time linear to the number of circular arcs in that refined cell plus the complexity of the refined cell. By traversing all refined cells, we can compute all circular arcs in time by the following lemma.

###### Lemma 8

The total number of circular arcs in and is .

Proof.  We prove the lemma only for . The case for can be proven analogously. The size of the (refined) farthest-point geodesic Voronoi diagram of sites in a simple polygon with vertices is  . In other words, there are refined cells and edges of the Voronoi diagram.

Let be a circular arc of . The center of the geodesic disk containing on its boundary lies in . Note that is unique by the general position assumption. Every geodesic disk whose center is a vertex in with radius contains in its interior. This means that, for any point , the farthest vertex from in is . Moreover, the combinatorial structures of the geodesic paths from the center to points on the circular arc are the same. Thus each circular arc is contained in a refined cell of whose site is . Moreover, each endpoint of the circular arc lies in the boundary of the refined cell containing it (including the boundary of .) Each edge of the diagram is intersected by at most one circular arc of . Therefore, the number of circular arcs in is by the fact that the size of the refined farthest-point geodesic Voronoi diagram is . Figure 5: The center of Di′ must lie to either the right of b(ci′,cj′) or the left of b(ci′,cℓ′).
###### Lemma 9

Let be a set of geodesic disks with the same radius and let be the intersection of all geodesic disks in . Let be the cyclic sequence of the circular arcs of along its boundary in clockwise order. For any integer , the circular arcs in are consecutive in .

Proof.  Assume to the contrary that there are four circular arcs in with such that , and for three distinct geodesic disks . See Figure 5. Let be the centers of the disks , respectively. Then the bisecting curve of and intersects exactly twice. Let and be these two intersection points such that is contained in the region bounded by and the part of from to in clockwise order. Similarly, the bisecting curve of and intersects exactly twice. Let and be these intersection points such that is contained in the region bounded by and the part of from to in clockwise order. When we traverse clockwise starting from , we encounter , , , , , and in order, where is the circular arc excluding its endpoints for a circular arc .

The center lies in the subset bounded by and the part of from to in clockwise order. On the other hand, lies in the subset bounded by and the part of from to in clockwise order. Thus, . Therefore, and must intersect. Since lies in the interior of , and must intersect in the interior of . In order to satisfy the order of appearances of , , and along , and must intersect an even number of times in the interior of . This is impossible since and cross each other at most once for any three points in . Thus , which is a contradiction.

Note that and consist of circular arcs and (possibly incomplete) edges of in total. Let and be the unions of the circular arcs of and , respectively. By the following lemma, it is sufficient to choose two points, one from and one from , in order to find a -center restricted to with radius .

###### Lemma 10

If , there is a triplet restricted to such that and .

Proof.  Since , there is a triplet made of a -set