Computational Topology (Jeff Erickson)
Testing Homotopic Paths in the Plane
When you turn the corner
And you run into
yourself
Then you know that you have turned
All the corners that are left.
— Langton Hughes, “Final Curve” (1951)
3 Testing Homotopic Paths in the Plane
In the previous lecture, we saw an algorithm to compute the shortest path in a polygon with holes that
is homotopic to a given path. Here we consider an apparently easier problem: Given two paths in
P
, are
they homotopic? Or equivalently, given a loop
‘
in
P
, is it contractible. We can solve both problems by
computing the reduced crossing sequence(s) of the input path(s). Two paths are homotopic if and only
if they have the same reduced crossing sequence, and a loop is contractible if and only if its reduced
crossing sequence is the empty string. We can test both of these conditions in time
O
(
nk
)
using the ﬁrst
two phases of our previous algorithm.
In this lecture, I’ll describe a faster algorithm for both of these problems for
simple
paths and loops,
originally due to Cabello
et al.
[
4
]
, with some simpliﬁcations by Efrat
et al.
[
6
]
. Most of the lecture will
concentrate on testing whether a simple loop in a polygon with holes is contractible. We will brieﬂy
return to testing homotopy of simple paths at the end.
3.1 Sentinel Points
If the number of holes in
P
is small, we can test contractibility more quickly by applying a little more
topology. Let
S
=
{
s
1
,
s
2
,...,
s
h
}
denote a set of
h sentinel
points, one chosen arbitrarily inside each hole
of
P
. Because
P
is a proper subset of the space
R
2
\
S
, any function from
[
0,1
]
2
to
P
is also a function
from
[
]
2
to
R
2
\
S
. It follows that any contractible loop in
P
is also contractible in
R
2
\
S
. In fact, the
converse is true as well.
Lemma 3.1.
Let
‘
be a loop in
P
. If
‘
is contractible in
R
2
\
S
, then
‘
is contractible in
P
.
Proof:
Let
P
0
denote the outer boundary of
P
, and let
P
1
P
h
denote the boundaries of its holes,
indexes so that each sentinel point
s
i
lies in the interior of the corresponding polygon
P
i
. The Jordan
Schönﬂies theorem implies that for each
i
, there is a homeomorphism
φ
i
:
R
2
→
R
2
such that the
restriction of
φ
i
to
S
1
is the cycle
P
i
. Without loss of generality, we can assume that
φ
i
(
0
) =
s
i
, where 0
denotes the origin. Let
u
:
R
2
\
0
→
S
1
be the function
u
(
x
) =
x
/
k
x
k
; this function is clearly continuous.
Then the function
Φ
i
=
φ
i
◦
u
◦
φ

1
i
maps
R
2
\
s
i
continuously onto
P
i
. Finally, let
Φ
:
R
2
\
S
→
P
denote
the function
Φ(
x
) =
x
if
x
∈
P
,
Φ
0
(
x
)
if
x
is outside
P
0
,
Φ
i
(
x
)
if
x
is inside
P
i
.
This function is continuous and obviously ﬁxes
P
. Thus, for any homotopy
h
:
[
]
2
→
R
2
\
S
between
two paths in
P
, the function
Φ
◦
h
:
[
]
2
→
P
is a homotopy in
P
between the same two paths.
±
Thus, to test the contractibility of a loop in
P
, it sufﬁces to work in the simpler space
R
2
\
S
. We
can construct a ‘triangulation’ of
R
2
\
S
(or more accurately, a triangulation of
R
\
S
where
R
is a
sufﬁciently large rectangle) in
O
(
h
log
h
)
time. Any loop composed of
k