Table Of ContentThe Geodesic Diameter of Polygonal Domains
∗
SangWonBae1 MatiasKorman2 YoshioOkamoto3
1DepartmentofComputerScienceandEngineering,
POSTECH,Pohang,Korea.
E-mail: [email protected]
2ComputerScienceDepartment,Universite´ LibredeBruxelles,Belgium.
E-mail: [email protected]
3GraduateSchoolofInformationScienceandEngineering,
TokyoInstituteofTechnology,Tokyo,Japan.
0
E-mail: [email protected]
1
0
2
n
Abstract
a
J This paper studies the geodesic diameter of polygonal domains having h holes and n corners.
5 Forsimplepolygons(i.e.,h = 0),itisknownthatthegeodesicdiameterisdeterminedbyapairof
cornersofagivenpolygonandcanbecomputedinlineartime. Forgeneralpolygonaldomainswith
]
G h 1,however,noalgorithmforcomputingthegeodesicdiameterwasknownpriortothispaper.
≥
In this paper, we present first algorithms that compute the geodesic diameter of a given polygonal
C
domain in worst-case time O(n7.73) or O(n7(logn+h)). The algorithms are based on our new
.
s geometricobservations,partofwhichstatesasfollows:thegeodesicdiameterofapolygonaldomain
c
canbedeterminedbytwopointsinitsinterior,andinthatcasethereareatleastfiveshortestpaths
[
betweenthetwopoints.
1
v
5
9
6
0
.
1
0
0
1
:
v
i
X
r
a
∗WorkbyS.W.BaewassupportedbytheBrainKorea21Project.WorkbyY.OkamotowassupportedbyGlobalCOEPro-
gram“ComputationismasaFoundationfortheSciences”andGrant-in-AidforScientificResearchfromMinistryofEducation,
ScienceandCulture,Japan,andJapanSocietyforthePromotionofScience.
1 Introduction
A polygonal domain with h holes and n corners V is a connected and closed subset of R2 of genus
P
h whose boundary ∂ consists of h+1 simple closed polygonal chains of n total line segments. The
P
holesandtheouterboundaryof areregardedasobstaclessothatanyfeasiblepathin isnotallowed
P P
to cross the boundary ∂ . The geodesic distance d(p,q) between any two points p,q in a polygonal
P
domain isdefinedasthe(Euclidean)lengthofashortestobstacle-avoidingpathbetweenpandq.
P
In this paper, we address the geodesic diameter problem in polygonal domains. The geodesic di-
ameter diam( ) of a polygonal domain is defined as diam( ) := max d(s,t). A pair (s,t)
s,t∈P
P P P
of points in that realizes the geodesic diameter diam( ) is called a diametral pair. The geodesic
P P
diameterproblemistofindthevalueofdiam( )andadiametralpair.
P
For simple polygons (i.e., h = 0), the geodesic diameter has been extensively studied and fully
understood. Chazelle [6] provided the first O(n2)-time algorithm computing the geodesic diameter
ofasimplepolygon,andSuri[18]presentedanO(nlogn)-timealgorithmthatsolvestheall-geodesic-
farthestneighborsproblem,computingthefarthestneighborofeverycornerandthusfindingthegeodesic
diameter. At last, Hershberger and Suri [11] showed that the diameter can be computed in linear time
usingtheirfastmatrixsearchtechnique.
Ontheotherhand,tothebestofourknowledge,noalgorithmforcomputingdiam( )hasyetbeen
P
discovered when is a polygonal domain having one or more holes (h 1). Mitchell [14] has posed
P ≥
an open problem asking an algorithm for computing the geodesic diameter diam( ). However, even
P
for the corner-to-corner diameter max d(u,v), only known is a brute-force algorithm that takes
u,v∈V
O(n2logn)time,checkingallthegeodesicdistancesbetweeneverypairofcorners.1
This fairly wide gap between simple polygons and polygonal domains is seemingly due to the
uniqueness of the shortestpath between any two points; it is well known that there is a unique shortest
pathbetweenanytwopointsinasimplepolygon[9]. Usingthisuniqueness,onecanshowthatthediam-
eterisindeedrealizedbyapairofcornersinV;thatis,diam( ) = max d(u,v)ifh = 0[11,18].
u,v∈V
P
For general polygonal domains with h 1, however, this is not the case. In this paper, we exhibit
≥
several examples where the diameter is realized by non-corner points on ∂ or even by interior points
P
of . (SeeFigure1andAppendixA.)Thisobservationalsoshowsanimmediatedifficultyindevising
P
anyexhaustivealgorithmsincethesearchspacelike∂ orthewholedomain isnotdiscrete.
P P
The status of the geodesic center problem is also similar. The geodesic center is defined to be a
point in that minimizes the maximum geodesic distance from it to any other point of . Asano and
P P
Toussaint [3] introduced the first O(n4logn)-time algorithm for computing the geodesic center of a
simplepolygon,andPollack,SharirandRote[17]improvedittoO(nlogn)time. Aswiththediameter
problem,thereisnoknownalgorithmforgeneralpolygonaldomains. Notethatcomputingthegeodesic
centerinvolvescomputingthegeodesicdiameterbecausethegeodesiccentermaybedeterminedbythe
midpointofashortestpathdefiningthegeodesicdiameter. SeeO’RourkeandSuri[16]andMitchell[14]
formorereferencesonthegeodesicdiameter/centerprobleminsimplepolygonsandpolygonaldomains.
Sincethegeodesicdiameter/centerofasimplepolygonisdeterminedbyitscorners,onecanexploit
the geodesic farthest-site Voronoi diagram of the corners V to compute the diameter/center, which can
be built in O(nlogn) time [2]. Recently, Bae and Chwa [4] presented an O(nklog3(n + k))-time
algorithm for computing the geodesic farthest-site Voronoi diagram of k sites in a general polygonal
domain. Thiscanbeusedtocomputethegeodesicdiametermax d(p,q)ofafinitesetS ofpoints
p,q∈S
in , but cannot be exploited for computing diam( ) without any characterization of the geodesic
P P
diameterofpolygonaldomainswithh 1. Moreover,whenS = V,thisapproachisnobetterthanthe
≥
brute-forceO(n2logn)-timealgorithmforcomputingthecorner-to-cornerdiametermax d(u,v).
u,v∈V
Inthispaper,wepresentthefirstalgorithmsthatcomputethegeodesicdiameterofagivenpolygonal
domaininO(n7.73)orO(n7(logn+h))timeintheworstcase. Wealsoshowthatforsmallconstanth
1PersonalcommunicationwithMitchell.
1
s∗ s∗
u v
2 2
u1 t∗ v1
s∗
u v
t∗ 3 3
t∗
(a) (b) (c)
Figure 1: Threepolygonaldomainswherethegeodesicdiameterisdeterminedbyapair(s∗,t∗)ofnon-corner
points;Gray-shadedregionsdepicttheinterioroftheholesanddarkgraysegmentsdepicttheboundary∂ .Recall
that ,asaset,containsitsboundary∂ . (a)Boths∗ andt∗ lieon∂ . TherearethreeshortestpathsPbetween
s∗ anPdt∗. Inthispolygonaldomain,thePrearetwo(symmetric)diametrPalpairs. (b)s∗ ∂ V andt∗ int .
Threetriangularholesareplacedinasymmetricway. Therearefourshortestpathsbetw∈eenPs∗\andt∗.(c)∈BothPs∗
andt∗lieintheinteriorint . Here,thefiveholesarepackedlikejigsawpuzzlepieces,formingnarrowcorridors
P
(darkgraypaths)andtwoempty,regulartriangles. Observethatd(u1,v1) = d(u1,v2) = d(u2,v2) = d(u2,v3)
= d(u3,v3) = d(u3,v1). s∗ and t∗ lie at the centers of the triangles formed by the ui and the vi, respectively.
Therearesixshortestpathsbetweens∗andt∗. MoredetailsonthisexamplecanbefoundinAppendixA.2.
thediametercanbecomputedmuchfaster. Ournewgeometricresultsunderlyingthealgorithmsindeed
show that the existence of any diametral pair consisting of non-corner points implies multiple shortest
pathsbetweenthepair;asoneofthecases,itisshownthatif(s,t)isadiametralpairandbothsandt
lieintheinteriorof ,thenthereareatleastfiveshortestpathsbetweensandt.
P
SomeanalogiesbetweenpolygonaldomainsandconvexpolytopesinR3canbeseen. O’Rourkeand
Schevon[15]provedthatifthegeodesicdiameteronaconvex3-polytopeisrealizedbytwonon-corner
points, at least five shortest paths exist between the two. Based on this observation, they presented an
O(n14logn)-timealgorithmforcomputingthegeodesicdiameteronaconvex3-polytope. Afterwards,
the time boundhas been improvedto O(n8logn) by Agarwal etal. [1] and recently toO(n7logn) by
Cook IV and Wenk [8]. This is also compared with the running time of our algorithms for polygonal
domains,O(n7.73)orO(n7(logn+h)).
2 Preliminaries
Throughoutthepaper, wefrequentlyuseseveraltopologicalconceptssuchasopenandclosedsubsets,
neighborhoods, and the boundary ∂A and the interior intA of a set A; unless stated otherwise, all of
them are supposed to be derived with respect to the standard topology on Rd with the Euclidean norm
forfixedd 1. Wedenotethestraightlinesegmentjoiningtwopointsa,bbyab.
k·k ≥
Wearegivenasinputapolygonaldomain withhholesandncorners. Moreprecisely, consists
P P
of an outer simple polygon in the plane R2 and a set of h ( 0) disjoint simple polygons inside the
≥
outer polygon. As a subset of R2, is the region contained in its outer polygon excluding the interior
P
oftheholes;thus isabounded,closedsubsetofR2. Theboundary∂ of isregardedasaseriesof
P P P
obstacles so that any feasible path inside is not allowed to cross ∂ . Note that some portion or the
P P
wholeofafeasiblepathmaygoalongtheboundary∂ . ThelengthofapathisthesumoftheEuclidean
P
lengthsofitssegments. Itiswellknownfromearlierworkthattherealwaysexistsashortest(feasible)
path between any two points p,q [13]. The geodesic distance, denoted by d(p,q), is then defined
∈ P
tobethelengthofashortestpathbetweenp andq .
∈ P ∈ P
Shortestpathmap. LetV bethesetofallcornersof andπ(s,t)beashortestpathbetweens
P ∈ P
and t . Then, it is represented as a sequence π(s,t) = (s,v ,...,v ,t) for some v ,...,v V;
1 k 1 k
∈ P ∈
that is, a polygonal chain through a sequence of corners [13]. Note that possibly we may have k = 0
2
when d(s,t) = s t . If two paths (with possibly different endpoints) induce the same sequence of
k − k
corners,thentheyaresaidtohavethesamecombinatorialstructure.
TheshortestpathmapSPM(s)forafixeds isadecompositionof intocellssuchthatevery
∈ P P
point in a common cell can be reached from s by shortest paths of the same combinatorial structure.
Each cell σ (v) of SPM(s) is associated with a corner v V or s itself, which is the last corner of
s
∈
π(s,t) for any t in the cell σ (v). In particular, the cell σ (s) is the set of points t such that π(s,t)
s s
passes through no corner in V and thus d(s,t) = s t . Each edge of SPM(s) is an arc on the
k − k
boundaryoftwoincidentcellsσ (v )andσ (v )andthusdeterminedbytwocornersv ,v V s .
s 1 s 2 1 2
∈ ∪{ }
Similarly,eachvertexofSPM(s)isdeterminedbyatleastthreecornersv ,v ,v V s . Notethat
1 2 3
∈ ∪{ }
for fixed s a point t that locally maximizes d (t) := d(s,t) lies at either (1) a vertex of SPM(s),
s
∈ P
(2)anintersectionbetweentheboundary∂ andanedgeofSPM(s),or(3)acornerinV.
P
The shortest path map SPM(s) has O(n) complexity can be computed in O(nlogn) time using
O(nlogn)workingspace[12]. Formoredetailsonshortestpathmaps,see[12–14].
Path-lengthfunction. Ifπ(s,t) = st,thentherearetwocornersu,v V suchthatπ(s,t)isformed
6 ∈
as the union of a shortest path from u to v and two segments su and vt. Note that u and v are not
necessarily distinct. In order to realize such a path, we assert that s is visible from u and t is visible
fromv;thus,s VP(u)andt VP(v),whereVP(p)foranyp isdefinedtobethesetofallpoints
∈ ∈ ∈ P
q suchthatpq . ThesetVP(p)isalsocalledthevisibilityprofileofp [7].
∈ P ⊂ P ∈ P
We now define the path-length function len : VP(u) VP(v) R for any fixed pair of corners
u,v
× →
u,v V tobe
∈
len (s,t) := s u +d(u,v)+ v t .
u,v
k − k k − k
Then,len (s,t)representsthelengthofthepathfromstotthathasthefixedcombinatorialstructure,
u,v
entering u from s and exiting v to t. Also, unless d(s,t) = s t (equivalently, s VP(t)), the
k − k ∈
geodesicdistanced(s,t)canbeexpressedasthepointwiseminimumofsomepath-lengthfunctions:
d(s,t) = min len (s,t).
u,v
u∈VP(s),v∈VP(t)
Consequently, we have two possibilities for a diametral pair (s∗,t∗); either we have d(s∗,t∗) =
s∗ t∗ orthepair(s∗,t∗)isalocalmaximumofthelowerenvelopeofseveralpath-lengthfunctions.
k − k
3 LocalMaximaontheLowerEnvelopeofConvexFunctions
Inthissection,wegivesomeanalysisonlocalmaximaofthelowerenvelopeofconvexfunctions,which
providesakeyobservationforourfurtherdiscussionsonthegeodesicdiameteranddiametralpairs.
We start with a basic observation on the intersection of hemispheres on a unit sphere in the d-
dimensional space Rd. For any fixed positive integer d, let Sd−1 := x Rd x = 1 be the
{ ∈ | k k }
unit sphere in Rd centered at the origin. A closed (or open) hemisphere on Sd−1 is defined to be the
intersection of Sd−1 and a closed (open, respectively) half-space of Rd bounded by a hyperplane that
contains the origin. We call a k-dimensional affine subspace of Rd a k-flat. Note that a hyperplane in
Rd is a (d 1)-flat and a line in Rd is a 1-flat. Also, the intersection of Sd−1 and a k-flat through the
−
origininRd iscalledagreat(k 1)-sphereonSd−1. Notethatagreat1-sphereiscalledagreatcircle
−
andagreat0-sphereconsistsoftwoantipodalpoints. Then,weobservethefollowing.
Lemma1 Foranytwopositiveintegersdandm d,asetofanymclosedhemispheresonSd−1 has
≤
anonemptycommonintersection.Moreover,iftheintersectionhasanemptyinteriorrelativetoSd−1,
thenitincludesagreat(d m)-sphereonSd−1.
−
Proof. ProofcanbefoundinAppendixB.
UsingLemma1weprovethefollowingtheorem,whichisthegoalofthissection.
3
Theorem 1 Let beafinitefamilyofreal-valuedconvexfunctionsdefinedonanopenandconvex
F
subsetC Rd andg(x) := min f(x) betheirpointwiseminimum. Supposethatg attainsa
f∈F
⊆
localmaximumatx∗ C andthereareexactlym functionsf ,...,f suchthatm d and
1 m
∈ ∈ F ≤
f (x∗) = g(x∗)foralli = 1,...,m.Ifnoneofthef attainsalocalminimumatx∗,thenthereexistsa
i i
(d+1 m)-flatϕ Rdthroughx∗suchthatgisconstantonϕ U forsomeneighborhoodU Rd
− ⊂ ∩ ⊂
ofx∗withU C.
⊂
Proof. Letx∗ C andmbeasinthestatement. Foreachi,considerthesublevelsetL := x C
i
∈ { ∈ |
f (x) f (x∗) . Sinceeachf isconvexandx∗ doesnotminimizef ,thesetL isconvexandx∗ lies
i i i i i
≤ }
ontheboundary∂L ofL . Therefore,thereexistsasupportinghyperplaneh toL atx∗. Denotebyh⊕
i i i i i
the closed half-space that is bounded by h and does not contain L . Note that f (x∗) f (x) for any
i i i i
≤
x h⊕ C andf (x∗) < f (x)foranyx (h⊕ h ) C. LetH := x x∗ x h⊕, x x∗ = 1
∈ i ∩ i i ∈ i \ i ∩ i { − | ∈ i k − k }
beaclosedhemisphereontheunitsphereSd−1 centeredattheorigin.
Sinceg(x∗) = f (x∗)foranyi 1,...,m andx∗ isalocalmaximumofg,theintersection H
i i
∈ { }
hasanemptyinteriorrelativetoSd−1;otherwise,thereexistsy Sd−1 suchthatf (x∗+λy) > f (x∗)
i i
∈ T
foranyi 1,...,m andanyλ > 0withx∗ +λy C. Hence, byLemma1, H hasanonempty
i
∈ { } ∈
intersectionincludingagreat(d m)-sphereGonSd−1. Letϕbethecorresponding(d m+1)-flat
− T −
inRd throughx∗ definedasϕ := x∗+λy Rd y Gandλ R . Considertherestrictionf
i ϕ∩C
{ ∈ | ∈ ∈ } |
of f on ϕ C. Since f is convex and ϕ is an affine subspace (thus convex), f is also convex
i i i ϕ∩C
∩ |
andtheirpointwiseminimumg attainsalocalmaximumatx∗. Furthermore,eachf attainsa
ϕ∩C i ϕ∩C
| |
local minimum at x∗; since ϕ h⊕, we have f (x∗) f(x) for any point x ϕ C. Hence, g
⊆ i i ≤ ∈ ∩ |ϕ∩C
also attains a local minimum at x∗ since g(x∗) = f (x∗) for any i 1,...,m . Consequently, g is
i
∈ { }
locally constant at x∗ on ϕ; more precisely, there is a sufficiently small neighborhood U Rd of x∗
⊂
withU C suchthatg isconstantonU ϕ,completingtheproof.
⊂ ∩
Remark that the theorem should have its own interest and find an application in problems of maxi-
mizingthepointwiseminimumofseveralconvexfunctions.
4 PropertiesofGeodesic-MaximalPairs
Wecallapair(s∗,t∗) maximalif(s∗,t∗)isalocalmaximumofthegeodesicdistancefunction
∈ P×P
d. That is, (s∗,t∗) is maximal if and only if there are two neighborhoods U ,U R2 of s∗ and of t∗,
s t
⊂
respectively,suchthatforanys U andanyt U wehaved(s∗,t∗) d(s,t). Foranypair
s t
∈ ∩P ∈ ∩P ≥
(s,t), let Π(s,t) = π ,...,π be the set of all distinct shortest paths from s to t, where m denotes
1 m
{ }
thenumberofshortestpaths. Letu andv bethefirstandthelastcornersinV alongπ fromstot,and
i i i
letV := u ,...,u andV := v ,...,v .
s 1 m t 1 m
{ } { }
LetEbethesetofallsidesof withouttheirendpointsand betheirunion. Notethat = ∂ V,
P B B P\
theboundaryof exceptthecornersV. Thegoalofthissectionistoprovethefollowingtheorem,which
P
isthemaingeometricresultofthispaper.
Theorem2 Supposethat(s∗,t∗)isamaximalpairin andΠ(s∗,t∗),Vs∗,andVt∗bedefinedasabove.
P
Then,wehavethefollowingimplications.
(VV) s∗ V, t∗ V implies Π(s∗,t∗) 1, Vs∗ 1, Vt∗ 1;
∈ ∈ | | ≥ | | ≥ | | ≥
(VB) s∗ V, t∗ implies Π(s∗,t∗) 2, Vs∗ 1, Vt∗ 2;
∈ ∈ B | | ≥ | | ≥ | | ≥
(VI) s∗ V, t∗ int implies Π(s∗,t∗) 3, Vs∗ 1, Vt∗ 3;
∈ ∈ P | | ≥ | | ≥ | | ≥
(BB) s∗ , t∗ implies Π(s∗,t∗) 3, Vs∗ 2, Vt∗ 2;
∈ B ∈ B | | ≥ | | ≥ | | ≥
(BI) s∗ , t∗ int implies Π(s∗,t∗) 4, Vs∗ 2, Vt∗ 3;
∈ B ∈ P | | ≥ | | ≥ | | ≥
(II) s∗ int , t∗ int implies Π(s∗,t∗) 5, Vs∗ 3, Vt∗ 3.
∈ P ∈ P | | ≥ | | ≥ | | ≥
Moreover,eachoftheaboveboundsisbestpossiblebyexamples.
4
πi πi πi πi πi
u′i u′i u′i
ui=u′i ui ui ui u′i ui
s∗ s∗ s∗ s∗
s∗
(a) (b)
Figure2: (a)Howtodetermineu′i. (lefttoright)ui =u′i;s∗,ui,andthesecondcornerarecollinear;s∗ andthe
firstthree corners are collinear (b) For points in a small disk B centered at s∗ with B VP(u′i) VP(ui), the
functionhsmeasuresthelengthoftheshortestpathfromu′ toeach. ⊂ ∪
i i
Toseethetightnessofthebounds,wepresentexampleswithremarksinFigure1andAppendixA.
In particular, one can easily see the tightness of the bounds on Vs∗ and Vt∗ from shortest path maps
| | | |
SPM(s∗)andSPM(t∗),whenV s∗,t∗ isingeneralposition.
∪{ }
Throughoutthissection,foreasydiscussion,weassumethatthereisauniqueshortestpathbetween
any two corners u,v V. This assumption does not affect Theorem 2 since multiple shortest paths
∈
between corners in V can only increase Π(s∗,t∗) . Note that this assumption implies that the pairs
| |
(ui,vi) are distinct, while the ui (also the vi) are not necessarily distinct. We thus have Vs∗ m,
| | ≤
Vt∗ m,and (ui,vi) 1 i m = m,wherem = Π(s∗,t∗) .
| | ≤ |{ | ≤ ≤ }| | |
The following lemma proves the bounds on Vs∗ and Vt∗ of Theorem 2. Proofs of the lemmas
| | | |
presentedinthissectioncanbefoundinAppendixB.
Lemma2 Let(s∗,t∗)beamaximalpair.Then, Vt∗ 2ift∗ ; Vt∗ 3ift∗ int .Moreover,
| | ≥ ∈ B | | ≥ ∈ P
ift∗ e E,thenthereexistsv Vt∗ suchthatvisoffthelinesupportinge;ift∗ int ,thent∗lies
∈ ∈ ∈ ∈ P
intheinterioroftheconvexhullofVt∗.
Lemma 2 immediately implies the lower bound on Π(s∗,t∗) when s∗ V or t∗ V since
| | ∈ ∈
Π(s∗,t∗) max Vs∗ , Vt∗ . ThisfinishestheproofforCases(V–). NotethatCase(VV)istrivial.
| | ≥ {| | | |}
From now on, we assume that both s∗ and t∗ are not corners in V. This assumption, together with
Lemma2,impliesmultipleshortestpathsbetweens∗ andt∗,andthusd(s∗,t∗) > s∗ t∗ . Hence,as
k − k
discussedinSection2,anymaximalpairfallingintooneofCases(BB),(BI),and(II)appearsasalocal
maximumofthelowerenvelopeofsomepath-lengthfunctions.
Case(II):Whenboths∗ andt∗ lie inint . We will applyTheorem 1to proveTheorem2 forCase
P
(II). For the purpose, we find m = Π(s∗,t∗) convex functions f defined on a convex neighborhood
i
| |
C of (s∗,t∗) such that the following requirements are satisfied: (i) the pointwise minimum g of the
f coincides with the geodesic distance d on C, (ii) f (s∗,t∗) = g(s∗,t∗) = d(s∗,t∗) for any i
i i
∈
1,...,m , (iii) g attains a local maximum at (s∗,t∗) C, and (iv) none of the f attains a local
i
{ } ∈
minimumat(s∗,t∗).
Ifthereareexactlympairs(u,v)ofcornerssuchthatlen (s∗,t∗) = d(s∗,t∗),thenwecanapply
u,v
Theorem1simplywiththempath-lengthfunctionslen . Unfortunately,thisisnotalwaysthecase;
ui,vi
asingleshortestpathπ Π(s∗,t∗)mayresultinseveralpairs(u,v)ofcornerswithu,v π suchthat
i i
∈ ∈
(u,v) = (u ,v ) and len (s∗,t∗) = d(s∗,t∗). This happens only when either u,u ,s∗ or v,v ,t∗ are
i i u,v i i
6
collinear. In this degenerate case, the path-length functions len violate the first requirement above.
ui,vi
Inthefollowing,wethusdefinethemerged path-lengthfunctionsthatsatisfyalltherequirementseven
underthedegeneratecase.
Recall that the combinatorial structure of each shortest path π Π(s∗,t∗) can be represented by
i
∈
a sequence (u = u ,...,u = v ) of corners in V. We define u′ to be one of the u as follows:
i i,1 i,k i i i,j
If s∗ does not lie on the line ℓ R2 through u and u , then u′ := u ; otherwise, if s∗ ℓ, then
⊂ i i,2 i i ∈
u′ := u , wherej isthelargestindexsuchthatforanyopenneighborhoodU R2 ofs∗ thereexists
i i,j ⊂
apoints (U VP(u )) ℓ. Notethatsuchu′ alwaysexists,andifnothreeofV arecollinear,then
∈ ∩ i,j \ i
5
π
i
t′′ δ
δ s′ t t′
s′′ s ui vi
Figure 3: IllustrationtoLemma 4; for any (s,t) Di and any sufficiently smallδ if we pick (s′,t′) such that
s′ is δ closer to ui than s and t′ is δ farther from∈vi than t, then we have fi(s′,t′) = fi(s,t). Symmetrically,
fi(s′′,t′′)=fi(s,t)with s′′ ui = s ui +δand t′′ vi = t vi δ.
k − k k − k k − k k − k−
wealwayshaveeitheru′ = u oru′ = u ;Figure2(a)illustrateshowtodetermineu′. Also,wedefine
i i i i,2 i
v′ inananalogousway. Leths andht betwofunctionsdefinedas
i i i
s u′ ifs VP(u′),
hs(s) := k − ik ∈ i
i (ks−uik+kui−u′ik ifs ∈ VP(ui)\VP(u′i);
t v′ ift VP(v′),
ht(t) := k − ik ∈ i
i (kt−vik+kvi−vi′k ift ∈ VP(vi)\VP(vi′).
Then,themergedpath-lengthfunctionf : D Risdefinedas
i i
→
f (s,t) := hs(s)+d(u′,v′)+ht(t),
i i i i i
where D := (VP(u′) VP(u )) (VP(v′) VP(v )) . We consider as a subset of
i i ∪ i × i ∪ i ⊆ P ×P P ×P
R4 and each pair (s,t) as a point in R4. Also, we denote by (s ,s ) the coordinates of a
x y
∈ P × P
points andwewrites = (s ,s )or(s,t) = (s ,s ,t ,t )byanabuseofnotation. Observethat
x y x y x y
∈ P
lfein(s,t()s=,t)m=in{lewnuhie,vni(ss,t)V,Ple(nuu)′i,ovri(vs,t)V,lPen(vu)i,;vsi′e(se,Ft)ig,ulerneu2′i(,vbi′)(.s,t)} for any (s,t) ∈ Di if we define
u,v
∞ 6∈ 6∈
Wefirstshowtheconvexityofthefunctionsf .
i
Lemma3 Foranyi 1,...,m andanyconvexsubsetC D,f isconvexonC.
i i
∈ { } ⊂
Observethateachofthef isindeednotstrictlyconvex. Figure3illustratesonesuchlineinR4 for
i
afixed(s,t) D thatf staysconstantwhen(s,t)moveslocallyalongtheline. Weshowthatsucha
i i
∈
lineinR4 isuniqueforanyfixed(s,t) D .
i
∈
Lemma 4 Foranyi 1,...,m andany(s,t) intD,thereexistsauniquelineℓ R4 through
i i
∈ { } ∈ ⊂
(s,t)suchthatf isconstantonℓ U forsomeneighborhoodU of(s,t)withU D.Moreover,f
i i i i
∩ ⊂
isconstantonℓ C foranyconvexneighborhoodC of(s,t)withC D .
i i
∩ ⊂
Now,weletg: D Rbethepointwiseminimumofthef definedasg(s,t) = min f (s,t)for
i i i i
→
any(s,t) D . Notethattheintersection D containsanonemptyinteriorand(s∗,t∗) int D
i i i
∈ T ∈
byourconstruction. Weshowthatthef satisfytheaforementionedrequirementstoapplyTheorem1.
i
T T T
Lemma5 Thefunctionsf andtheirpointwiseminimumgsatisfythefollowingconditions.
i
(i) ThereexistsaconvexneighborhoodC R4of(s∗,t∗)withC D suchthatd(s,t) = g(s,t)
i
⊂ ⊆
forany(s,t) C.
∈ T
(ii) f (s∗,t∗) = g(s∗,t∗) = d(s∗,t∗)foranyi 1,...,m .
i
∈ { }
(iii) gattainsalocalmaximumat(s∗,t∗).
(iv) Noneofthef attainsalocalminimumat(s∗,t∗).
i
Now,wetakeaconvexneighborhoodC R4of(s∗,t∗)thatisasdescribedinLemma5. Werestrict
⊂
f ,...,f andg onC. Then,eachf isconvexbyLemma3and,byLemma5,themfunctionsf and
1 m i i
theirpointwiseminimumg satisfytheconditionsofTheorem1withopenconvexdomainC R4.
⊂
Suppose that m < 5. Then, Theorem 1 implies that there exists at least one line ℓ R4 through
⊂
(s∗,t∗)suchthatg isconstantonℓ C. Ontheotherhand,Lemma4impliesthatthereisauniqueline
∩
6
ℓ through(s∗,t∗)suchthatf isconstantonℓ C,andnootherlinealongwhichf islocallyconstant
i i i i
∩
at(s∗,t∗). Hence,thereexistsatleastoneindexisuchthatℓ = ℓ . Wealsoobservethefollowing.
i
Lemma6 Thereareatmosttwoindicesi 1,...,m suchthatℓ = ℓ.
i
∈ { }
The last task is to check two possibilities; one or two of the f are constant on ℓ C. Also, recall
i
∩
that m 3 by Lemma 2. Without loss of generality, we first assume that ℓ = ℓ = ℓ for any i 2.
1 i
≥ 6 ≥
Alongℓ ,eachf withi 2isnotconstantbutconvex. Sincef (s,t) = g(s,t) = min f (s,t)forany
1 i 1 i i
≥
(s,t) ℓ C,byLemma4,f withi 2muststrictlyincreasefrom(s∗,t∗)inbothdirectionsalongℓ.
i
∈ ∩ ≥
Thus,forany(s,t) ℓ Cwith(s,t) = (s∗,t∗),wehaveastrictinequalityg(s,t) = f (s,t) < f (s,t).
1 i
∈ ∩ 6
Then, byLemmas3and4atanysuch(s,t) ℓ C thereisadirectioninwhichf strictlyincreases:
1
∈ ∩
more precisely, for any arbitrarily small neighborhood U C of (s∗,t∗), g(s,t) = f (s,t) < f (s,t)
1 i
⊂
for(s,t) ∂U ℓandthusthereexistasufficientlysmallneighborhoodU′ C of(s,t)and(s′,t′)
∈ ∩ ⊂ ∈
U′ such that f (s,t) < f (s′,t′) < f (s′,t′) for any i 2, which implies that g(s∗,t∗) = g(s,t) <
1 1 i
≥
g(s′,t′),acontradictiontothatg attainsalocalmaximumat(s∗,t∗).
Thus, two of the f must be constant on ℓ C. We assume that ℓ = ℓ = ℓ = ℓ for i 3. In
i 1 2 i
∩ 6 ≥
this case, for any (s,t) ℓ C with (s,t) = (s∗,t∗), we have a strict inequality g(s,t) = f (s,t) =
1
∈ ∩ 6
f (s,t) < f (s,t). Thenthereexistsadirectionfrom(s,t)inwhichbothoff andf strictlyincrease
2 i 1 2
byLemmas3and4. Sinceg(s,t) = f (s,t) = f (s,t) < f (s,t)foranyi 3,wegetacontradiction
1 2 i
≥
analogouslytotheabove.
Hence,weachieveaboundm = Π(s∗,t∗) 5,asclaimedinCase(II)ofTheorem2.
| | ≥
Case(BB):Whenboths∗andt∗lieon . Inthiscase,weassumethats∗ e E andt∗ e E.
s t
B ∈ ∈ ∈ ∈
Letpbeanendpointofe andl bethelengthofe . Wedenotebys(ζ )theuniquepointone suchthat
s s s s s
s(ζ ) p = ζ forany0 < ζ < l . Here,weconsiders: (0,l ) e asabijectivemapbetweena
s s s s s s
k − k →
realopeninterval(0,l ) Randasegmente R2 exceptitsendpoints. Analogously,wealsodefine
s s
⊂ ⊂
t(ζ ). Letζ∗ andζ∗ berealnumberssuchthats∗ = s(ζ∗)andt∗ = t(ζ∗).
t s t s t
TheoutlineofproofisanalogoustotheabovediscussionforCase(II).Weredefinef : D Ras
i i
→
f (ζ ,ζ ) := hs(s(ζ ))+d(u′,v′)+ht(t(ζ )),
i s t i s i i i t
where D := s−1((VP(u′) VP(u )) e ) t−1((VP(v′) VP(v )) e ). We consider D as a
i i ∪ i ∩ s × i ∪ i ∩ t i
subset of R2 and each pair (ζ ,ζ ) D as a point in R2. Also, let g(ζ ,ζ ) := min f (ζ ,ζ ) for any
s t i s t i i s t
∈
(ζ ,ζ ) D .
s t i
∈
Theconvexityoff onanyconvexsubsetofD isdeducedfromLemma3. AnalogouslytoLemma5,
i i
T
one can show that (i) there exists a convex neighborhood C R2 of (ζ∗,ζ∗) with C D such
s t i
⊂ ⊂
that g(ζ ,ζ ) = min f (ζ ,ζ ) = d(s(ζ ),t(ζ )) for any (ζ ,ζ ) C, (ii) f (ζ∗,ζ∗) = g(ζ∗,ζ∗) =
s t i i s t s t s t ∈ i s t Ts t
d(s(ζ∗),t(ζ∗)) for any i 1,...,m , (iii) g attains a local maximum at (ζ∗,ζ∗). Also, observe that
s t s t
∈ { }
(iv) none of the f attains a local minimum at (ζ∗,ζ∗) if m < 3: Assume that some f attains a local
i s t i
minimumat(ζ∗,ζ∗)andm < 3. Thishappensonlywhens∗ = s(ζ∗)istheperpendicularfootofu on
s t s i
e andt∗ = t(ζ∗)istheperpendicularfootofv one . Inthiscase,therealwaysexistsadirectionalong
s t i t
e such that if we move s∗ in the direction, then hs strictly increases for every 1 i m < 3, which
s i ≤ ≤
contradictstotheassumptionthat(s∗,t∗)ismaximal.
Inaddition,weobservethefollowing.
Lemma7 Ifthereexistsalineℓ R2suchthatf isconstantonℓ C,thenu liesonthelinesupporting
i i
⊂ ∩
e andv liesonthelinesupportinge .
s i t
Weassumethatm < 3,andrestrictthefunctionsf andgonC R2. Then,Theorem1impliesthat
i
⊂
thereexistsalineℓ R2 through(ζ∗,ζ∗)suchthatgisconstantonℓ C. Moreover,Lemma4implies
s t
⊂ ∩
thatatleastoneofthef isconstantonℓ C. Assumethatonlyf isconstantonℓ C. Then,bythesame
i 1
∩ ∩
argumentasaboveforCase(II),foranypoint(ζ ,ζ ) ℓ C with(ζ ,ζ ) = (ζ∗,ζ∗),wehaveastrict
s t s t s t
∈ ∩ 6
inequality g(ζ ,ζ ) = f (ζ ,ζ ) < f (ζ ,ζ ) for i 2, leading to a contradiction: for any arbitrarily
s t 1 s t i s t
≥
7
small neighborhood U C of (ζ∗,ζ∗), g(ζ ,ζ ) = f (ζ ,ζ ) < f (ζ ,ζ ) for (ζ ,ζ ) ∂U ℓ
s t s t 1 s t i s t s t
⊂ ∈ ∩
and thus there exist a sufficiently small neighborhood U′ C of (ζ ,ζ ) and (ζ′,ζ′) U′ such that
s t s t
⊂ ∈
f (ζ ,ζ ) < f (ζ′,ζ′) < f (ζ′,ζ′),whichimpliesthatd(s∗,t∗) = g(ζ∗,ζ∗) = g(ζ ,ζ ) < g(ζ′,ζ′).
1 s t 1 s t i s t s t s t s t
Hence,bothf andf areconstantonℓ C. Then,byLemma7,u ,u ,ands∗ arecollinearandv ,
1 2 1 2 1
∩
v ,andt∗ arecollinear. Sincem < 3,thissituationviolatesthesecondpartofLemma2. Thus,weget
2
acontradictionagain,concludingthatm = Π(s∗,t∗) 3forCase(BB)whenboths∗ andt∗ lieon .
| | ≥ B
Case(BI):Whens∗ andt∗ int . Weassumethats∗ e E andt∗ int . Defines(ζ )
s s
∈ B ∈ P ∈ ∈ ∈ P
asdoneinCase(BB)withs(ζ∗) = s∗. Weredefinethefunctionf : D Rtobe
s i i
→
f (ζ ,t ,t ) := hs(s(ζ ))+d(u′,v′)+ht(t ,t ),
i s x y i s i i i x y
whereD := s−1((VP(u′) VP(u )) e ) (VP(v′) VP(v ))isasubsetofR3. Letg(ζ ,t ,t ) :=
i i ∪ i ∩ s × i ∪ i s x y
min f (ζ ,t ,t )forany(ζ ,t ,t ) D .
i i s x y s x y i
∈
Analogously to Lemmas 3 and 5, each f is convex on any convex subset of D and there exists
i i
T
a convex neighborhood C R3 of (ζ∗,t∗,t∗) with C D such that the four requirements are
s x y i
⊂ ⊂
satisfied. Suppose that m = Π(s∗,t∗) < 4. Then, Theorem 1 implies that there exists a line ℓ R3
| | T ⊂
through(ζ∗,t∗,t∗) R3 suchthatg isconstantonℓ C,thusatleastoneofthef isconstantonℓ C
s x y i
∈ ∩ ∩
byLemma4.
If only one of the f is constant on ℓ C, then we have a contradiction as done in Cases (II) and
i
∩
(BB). Thus, assume that f and f are constant on ℓ C. By Lemmas 4 and 7, v , v , and t∗ should
1 2 1 2
∩
be collinear. Further, by the second part of Lemma 2, t∗ must lie in the interior of the convex hull of
Vt∗. Inordertohaveaninteriorpointoftheconvexhullonthesegmentbetweenv1 andv2,weneedat
least two more points. Nonetheless, we have Vt∗ Π(s∗,t∗) < 4, a contradiction. Thus, we have
| | ≤ | |
m = Π(s∗,t∗) 4forCase(BI),asclaimed.
| | ≥
Finally, we complete a proof of Theorem 2: The claimed bounds on Vs∗ and Vt∗ are shown by
| | | |
Lemma2,andtheboundson Π(s∗,t∗) areshowncasebycaseasabove.
| |
5 ComputingtheGeodesicDiameter
Sinceadiametralpairisinfactmaximal, itfallsintooneofthecasesshowninTheorem2. Inorderto
findadiametralpairweexamineallpossiblescenariosaccordingly.
Cases(V–),whereatleastonepointisacornerinV,canbehandledinO(n2logn)timebycomput-
ingSPM(v)foreveryv V andtraversingittofindthefarthestpointfromv,asdiscussedinSection2.
∈
WethusfocusonCases(BB),(BI),and(II),whereadiametralpairconsistsoftwonon-cornerpoints.
Fromthecomputationalpointofview,themostdifficultcasecorrespondstoCase(II)ofTheorem2;
in particular, Π(s∗,t∗) = 5 in which 10 corners of V are involved, resulting in Vs∗ = Vt∗ = 5
| | | | | |
(see Appendix A.3). Note that we do not need to take a special care for the case of Π(s∗,t∗) > 5.
| |
By Theorem 2 and its proof, it is guaranteed that there are five distinct pairs (u ,v ),...,(u ,v ) of
1 1 5 5
corners in V such that len (s∗,t∗) = d(s∗,t∗) for any i 1,...,5 and the system of equations
ui,vi ∈ { }
len (s,t) = = len (s,t) indeed determines a 0-dimensional zero set, corresponding to a
u1,v1 ··· u5,v5
constant number of candidate pairs in int int . Moreover, each path-length function len is an
u,v
P × P
algebraicfunctionofdegreeatmost4. Thus,givenfivedistinctpairs(u ,v )ofcorners,wecancompute
i i
allcandidatepairs(s,t)inO(1)timebysolvingthesystem.2 Then,foreachcandidatepairwecompute
the geodesic distance between the pair to check its validity. Since the geodesic distance between any
twopointss,t canbecomputedinO(nlogn)time[12],weobtainabrute-forceO(n11logn)-time
∈ P
algorithm,checkingO(n10)candidatepairsobtainedfromallpossiblecombinationsof10cornersinV.
2Here, weassumethatfundamentaloperationsonaconstantnumberofpolynomialsofconstantdegreewithaconstant
numberofvariablescanbeperformedinconstanttime.
8
Asadifferentapproach,onecanexploittheSPM-equivalencedecompositionof ,whichsubdivides
P
intoregionssuchthattheshortestpathmapofanytwopointsinacommonregionare“topologically
P
equivalent”[7]. Itisnotdifficulttoseethatif(s,t)isapairofpointsthatequalizesanyfivepath-length
functions,thenbothsandtappearasverticesofthedecomposition. However,thecurrentlybestupper
boundonthecomplexityoftheSPM-equivalencedecompositionisO(n10)[7], andthusthisapproach
hardlyleadstoaremarkableimprovement.
Instead,wedothefollowingforCase(II)with Vs∗ = 5. Wechooseanyfivecornersu1,...,u5
| | ∈
V (as a candidate for the set Vs∗) and overlay their shortest path maps SPM(ui). Since each SPM(ui)
hasO(n)complexity,theoverlayconsistsofO(n2)cells. Then,anycelloftheoverlayistheintersection
offivecellsassociatedwithv ,...,v V inSPM(u ),...,SPM(u ),respectively. Choosingacellof
1 5 1 5
∈
theoverlay,wegetfive(possibly,notdistinct)v ,...,v andthusaconstantnumberofcandidatepairs
1 5
bysolvingthesystemlen (s,t) = = len (s,t). Weiteratethisprocessforallpossibletuples
u1,v1 ··· u5,v5
offivecornersu ,...,u ,obtainingatotalofO(n7)candidatepairsinO(n7logn)time. Notethatthe
1 5
othersubcaseswith Vs∗ 4canbehandledsimilarly,resultinginO(n6)candidatepairs.
| | ≤
In order to test the validity of each candidate pair (s,t), we check the geodesic distance d(s,t)
usingatwo-pointquerystructureofChiangandMitchell[7]: forafixedparameter0 < δ 1andany
≤
fixed ǫ > 0, we can construct, in O(n5+10δ+ǫ) time, a data structure that supports O(n1−δlogn)-time
two-pointshortestpathqueries. Then,thetotalrunningtimeisO(n7logn)+O(n5+10δ+ǫ)+O(n7)
O(n1−δlogn). Wesetδ = 3 tooptimizetherunningtimetoO(n7+181+ǫ). ×
11
Also,wecanuseanalternativetwo-pointquerydatastructurewhoseperformanceissensitivetothe
number h of holes [7]: after O(n5) preprocessing time using O(n5) storage, two-point queries can be
answeredinO(logn+h)time.3 Usingthisalternativestructure,thetotalrunningtimeofouralgorithm
8
becomesO(n7(logn+h)). Notethatthismethodoutperformsthepreviousonewhenh = O(n11).
The other cases can be handled analogously with strictly better time bound. For Case (BI), we
handle only the case of Π(s∗,t∗) = 4 with Vt∗ = 3 or 4. For the subcase with Vt∗ = 4, we
| | | | | |
chooseanyfourcornersfromV asv1,...,v4 asacandidateforVt∗ andoverlaytheirshortestpathmaps
SPM(v ). Theoverlay, togetherwithV, decomposes∂ intoO(n)intervals. Then, eachsuchinterval
i
P
determines u ,...,u as above, and the side e E on which s∗ should lie. Now, we have a system
1 4 s
∈
of four equations on four variables: three from the corresponding path-length functions len which
ui,vi
shouldbeequalizedat(s∗,t∗)andthefourthfromthesupportinglineofe . Solvingthesystem,weget
s
a constant number of candidate maximal pairs, again by Theorem 2 and its proof. In total, we obtain
O(n5) candidate pairs. The other subcase with Vt∗ = 3 can be handled similarly, resulting in O(n4)
| |
candidatepairs. Asabove,wecanexploittwodifferentstructuresfortwo-pointqueries. Consequently,
wecanhandleCase(BI)inO(n5+1110+ǫ)orO(n5(logn+h))time.
In Case (BB) when s∗,t∗ , we handle the case of Π(s∗,t∗) = 3 with Vs∗ = 2 or 3. For
∈ B | | | |
the subcase with Vs∗ = 3, we choose three corners as a candidate of Vs∗ and take the overlay of
| |
their shortest path maps SPM(u ). It decomposes ∂ into O(n) intervals. Then, each such interval
i
P
determinesthreecornersv1,v2,v3 formingVt∗ andasideet E onwhicht∗ shouldlie. Notethatwe
∈
have only three equations so far; two from the three path-length functions and the third from the line
supporting to e . Since s∗ also should lie on a side e E with e = e , we need to fix such a side e
t s s t s
∈ 6
that VP(u )intersectse . Intheworstcase,thenumberofsuchsidese isΘ(n). Thus,wehave
1≤i≤3 i s s
O(n5) candidate pairs for Case (BB); again, the other subcase with Vs∗ = 2 contributes to a smaller
T | |
number O(n4) of candidate pairs. Testing each candidate pair can be performed as above, resulting in
O(n5+1110+ǫ)orO(n5(logn+h))totalrunningtime.
For Case (BB), however, one can exploit a two-point query structure only for boundary points
on ∂ . The two-point query structure by Bae and Okamato [5] indeed builds an explicit representa-
P
3Ifhisrelativelysmall,onecouldusethestructureofGuo,MaheshwariandSack[10]whichanswersatwo-pointqueryin
O(hlogn)timeafterO(n2logn)preprocessingtimeusingO(n2)storage,oranotherstructurebyChiangandMitchell[7]
thatsupportsatwo-pointqueryinO(hlogn)time,spendingO(n+h5)preprocessingtimeandstorage.
9