Lecture 8

9. Randomized Incremental Construction
Leture on Monday 19
th
Otober, 2009 by Bernd G
artner
<[email protected]>
In Leture 5, we have disussed the inremental onstrution of the Delaunay triangulation of a nite point set. In this leture, we want to analyze the runtime of this
algorithm if the insertion order is hosen uniformly at random among all insertion orders. We will do the analysis not diretly for the problem of onstruting the Delaunay
triangulation but in a somewhat more abstrat framework, with the goal of reusing the
analysis for other problems.
Throughout this leture, we again assume general position: no three points on a line,
no four on a irle.
9.1 The Delaunay triangulation — an abstract view
The inremental onstrution onstruts and destroys triangles. In this setion, we want
to take a loser look at these triangles, and we want to understand exatly when a triangle
is \there".
Given three points p, q, r 2 R, the triangle ∆(p, q, r) with verties p, q, r
is a triangle of DT (R) if and only if the irumirle of ∆(p, q, r) is empty of points
from R.
Lemma 9.1
Proof. The \only if" diretion follows from the denition of a Delaunay triangulation
(Denition 4.3). The \if" diretion is a onsequene of general position and Lemma 4.9:
if the irumirle C of ∆(p, q, r) is empty of points from R, then all the three edges
pq, qr, pr are easily seen to be in the Delaunay graph of R. C being empty also implies
that the triangle ∆(p, q, r) is empty, and hene it forms a triangle of DT (R).
Next we develop a somewhat more abstrat view of DT (R).
Definition 9.2
(i) For all p, q, r 2 P, the triangle ∆ = ∆(p, q, r) is alled a onguration. The
points p, q and r are alled the dening elements of ∆.
(ii) A onguration ∆ is in onit with a point s 2 P if s is stritly inside the
irumirle of ∆. In this ase, the pair (∆, s) is also alled a onit.
(iii) A onguration ∆ is alled ative w.r.t. R P if (a) the dening elements of
∆ are in R, and (b) if ∆ is not in onit with any element of R.
Aording to this denition and Lemma 9.1, DT (R) onsists of exatly the ongurations that are ative w.r.t. R. Moreover, if we onsider DT (R) and DT (R [ {s}) as sets
of ongurations, we an exatly say how these two sets dier.
49
Randomized Inremental Constrution (19.10.2009)
CG 2009
There are the ongurations in DT (R) that are not in onit with s. These ongurations are still in DT (R [ {s}). The ongurations of DT (R) that are in onit with
s will be removed when going from R to R [ {s}. Finally, DT (R [ {s}) ontains some new
ongurations, all of whih must have s in their dening set. Aording to Lemma 9.1,
it annot happen that we get a new onguration without s in its dening set, as suh
a onguration would have been present in DT (R) already.
9.2 Configuration Spaces
Here is the abstrat framework that generalizes the previous onguration view of the
Delaunay triangulation.
Let X (the ground set) and Π (the set of ongurations) be nite sets.
Furthermore, let
Definition 9.3
D : Π → 2X
be a funtion that assigns to every onguration ∆ a set of dening elements D(∆).
We assume that only a onstant number of ongurations have the same dening
elements. Let
K : Π → 2X
be a funtion that assigns to every onguration ∆ a set of elements in onit with
∆ (the \killer" elements). We stipulate that D(∆) \ K(∆) = ; for all ∆ 2 Π.
Then the quadruple S = (X, Π, D, K) is alled a onguration spae. The number
d = d(S ) := max |D(∆)|
2
∆ Π
is alled the dimension of S .
Given R X, a onguration ∆ is alled ative w.r.t. R if
D(∆) R
and K(∆) \ R = ;,
i.e. if all dening elements are in R but no element of R is in onit with ∆. The
set of ative ongurations w.r.t. R is denoted by TS (R), where we drop the subsript
if the onguration spae is lear from the ontext.
In ase of the Delaunay triangulation, we set X = P (the input point set). Π onsists
of all triangles ∆ = ∆(p, q, r) spanned by three points p, q, r 2 X [ {a, b, c}, where a, b, c
are the three artiial far-away points. We set D(∆) := {p, q, r} \ X. The set K(∆) onsists
of all points stritly inside the irumirle of ∆. The resulting onguration spae has
dimension 3, and the tehnial ondition that only a onstant number of ongurations
share the dening set is satised as well. In fat, every set of three points denes a
unique onguration (triangle) in this ase. A set of two points or one point denes
50
9.3. Expeted strutural hange
CG 2009
three triangles (we have to add one or two artiial points whih an be done in three
ways). The empty set denes one triangle, the initial triangle onsisting of just the three
artiial points.
Furthermore, in the setting of the Delaunay triangulation, a onguration is ative
w.r.t. R if it is in DT (R [ {a, b, c}), i.e. we have T (R) = DT (R [ {a, b, c}).
9.3 Expected structural change
Let us x a onguration spae S = (X, Π, D, K) for the remainder of this leture. We
an also interpret the inremental onstrution in S . Given R X and s 2 X \ R, we
want to update T (R) to T (R [ {s}). What is the number of new ongurations that arise
during this step? For the ase of Delaunay triangulations, this is the relevant question
when we want to bound the number of Lawson ips during one update step, sine this
number is exatly the number of new ongurations minus three.
Here is the general piture.
Definition 9.4 For Q X and s 2 Q, deg(s, Q) is dened
tions of T (Q) that have s in their dening set.
as the number of ongura-
With this, we an say that the number of new ongurations in going from T (R) to
T (R [ {s}) is preisely deg(s, R [ {s}), sine the new ongurations are by denition
exatly the ones that have s in their dening set.
Now the random insertion order omes in for the rst time: what is
E(deg(s, R [ {s})),
averaged over all insertion orders? In suh a random insertion order, R is a random relement subset of X (when we are about to insert the (r+1)-st element), and s is a random
element of X \ R. Let Tr be the \random variable" for the set of ative ongurations
after r insertion steps.
It seems hard to average over all R, but there is a trik: we make a movie of the
randomized inremental onstrution, and then we wath the movie bakwards. What
we see is elements of X being deleted one after another, again in random order. This is
due to the fat that the reverse of a random order is also random. At the point where the
(r + 1)-st element is being deleted, it is going to be a random element s of the urrently
present (r + 1)-element subset Q. For xed Q, the expeted degree of s is simply the
average degree of an element in Q whih is
1 X
d
deg(s, Q) |T (Q)|,
r + 1 s2Q
r+1
sine the sum ounts every onguration of T (Q) at most d times. Sine Q is a random
(r + 1)-element subset, we get
E(deg(s, R [ {s})) d
tr+1,
r+1
51
Randomized Inremental Constrution (19.10.2009)
CG 2009
where tr+1 is dened as the expeted number of ative ongurations w.r.t. a random
(r + 1)-element set.
Here is a more formal derivation that does not use the bakwards movie view. It
exploits the bijetion
(R, s) 7→ (R [ {s}, s)
| {z }
Q
between pairs (R, s) with |R| = r and s 2/ R and pairs (Q, s) with |Q| = r + 1 and s 2 Q.
Let n = |X|.
X
1
E(deg(s, R [ {s})) = n
r
R X,|R|=r
1 X
deg(s, R [ {s})
n−r
2
s X\R
1 X
deg(s, Q)
n − r s2Q
X,|Q|=r+1
Q
r
n
X
1 X
1
r+1
deg(s, Q)
= n
n n−r
s2Q
X
1
= n
Q X,|Q|=r+1
1
X
= n
r+1
=
r+1
1
n
r+1
Q X,|Q|=r+1
X
Q X,|Q|=r+1
r
1 X
deg(s, Q)
r + 1 s2Q
d
|T (Q)|
r+1
d
tr+1.
r+1
Thus, the expeted number of new ongurations in going from Tr to Tr+1 is bounded by
d
tr+1,
r+1
where tr+1 is the expeted size of Tr+1.
What do we get for Delaunay triangulations? We have d = 3 and tr+1 2(r + 4) − 4
(the maximum number of triangles in a triangulation of r + 4 points. Hene,
E(deg(s, R [ {s})) 6r + 12
r+1
6.
This means that on average, 3 Lawson ips are done to update DT r (the Delaunay
triangulation after r insertion steps) to DT r+1. Over the whole algorithm, the expeted
update ost is thus O(n).
52
9.4. Expeted number of onits
CG 2009
9.4 Expected number of conflicts
Before we an even update DT r to DT r+1 during the inremental onstrution of the
Delaunay triangulation, we need to loate the new point s in DT r, meaning that we need
to nd the triangle that ontains s. We have done this with the history graph, and every
triangle that we searh during the insertion of s is a triangle that
is in DT k for some k r
is in onit with s.
Over the whole algorithm, the ost of all history graph searhes an therefore asymptotially be bounded by the expeted number of pairs (∆, s) with ∆ 2 DT k for some k n
and s 2 P in onit with ∆.
We an ount these pairs by ounting onits in general onguration spaes, aording to the following
A onit is a pair (∆, s) where ∆ 2 Tr for some r and s 2 K(∆).
Sine every onguration involved in a onit has been reated in some step r (we
inlude step 0), the expeted number of onits is
Definition 9.5
n
X
X
2Tr \Tr−1
|K(∆)|,
r=0 ∆
where T−1 := ;. T0 onsists of only onstantly many ongurations, eah of whih is in
onit with at most all elements; moreover, no onit is reated in step n. Hene,
n
X
X
2Tr \Tr−1
n−1
X
|K(∆)| = O(n) +
r=0 ∆
X
2Tr \Tr−1
|K(∆)|,
r=1 ∆
and we will bound the latter quantity. Let
X
K(r) =
2Tr \Tr−1
|K(∆)|,
r = 1, . . . , n − 1.
∆
Bounding K(r). We know that
arises from a random r-element set R. Fixing R, the
bakwards movie view tells us that Tr−1 arises from Tr by deleting a random element s
of R. Thus,
1
K(r) = n
r
1
= n
X
R X,|R|=r
X
r
R X,|R|=r
1
X
n
r
R X,|R|=r
Tr
1X
r s2R
1X
r s2R
X
2T (R)\T (R\{s})
|K(∆)|
∆
X
2T (R),s2D(∆)
∆
d X
|K(∆)|,
r
2T (R)
∆
53
|K(∆)|
Randomized Inremental Constrution (19.10.2009)
CG 2009
sine in the sum over s 2 R, every onguration is ounted at most d times. Sine we
an rewrite
X
2T (R)
|K(∆)| =
X
|{∆ 2 T (R) : y 2 K(∆)}|,
2
y X\R
∆
we thus have
X
1
K(r) n
r
R X,|R|=r
d X
|{∆ 2 T (R) : y 2 K(∆)}|.
r
2
y X\R
To estimate this further, here is a simple but ruial
The ongurations in T (R) that are not in onit with y are the ongurations in T (R [ {y}) that do not have y in their dening set; in formulas:
Lemma 9.6
|T (R)| − |{∆ 2 T (R) : y 2 K(∆)}| = |T (R [ {y})| − deg(y, R [ {y}).
The proof is a diret onsequene of the denitions: every onguration in T (R) not in
onit with y is by denition still present in T (R [ {y}) and still does not have y in
its dening set. And a onguration in T (R [ {y}) with y not in its dening set is by
denition already present in T (R) and already there not in onit with y.
The lemma implies that
K(r) k1(r) − k2(r) + k3(r),
where
X
1
k1(r) = n
R X,|R|=r
r
X
1
k2(r) = n
R X,|R|=r
r
X
1
k3(r) = n
r
Estimating k1(r).
R X,|R|=r
2
y X\R
d X
|T (R [ {y})|,
r
2
y X\R
d X
deg(y, R [ {y}).
r
2
y X\R
This is really simple.
1
k1(r) = n
r
1
= n
r
=
d X
|T (R)|,
r
X
R X,|R|=r
X
R X,|R|=r
d X
|T (R)|
r
2
y X\R
d
(n − r)|T (R)|
r
d
(n − r)tr.
r
54
9.4. Expeted number of onits
CG 2009
For this, we need to employ our earlier (R, y) 7→ (R [ {y}, y) bijetion
Estimating k2(r).
again.
X
1
k2(r) = n
r
R X,|R|=r
d X
|T (R [ {y})|
r
2
y X\R
dX
|T (Q)|
r y2Q
r QX,|Q|=r+1
n
X
1
r+1 d
(r + 1)|T (Q)|
=
n
n
r
X
1
= n
r+1
Q X,|Q|=r+1
1
X
= n
r+1
Q X,|Q|=r+1
r
d
(n − r)|T (Q)|
r
d
=
(n − r)tr+1
r
dn
d
(n − (r + 1))tr+1 +
tr+1
=
r+1
r(r + 1)
dn
= k1(r + 1) +
tr+1.
r(r + 1)
Estimating k3(r).P This is similar to k2(r) and in addition uses a fat that we have emy2Q deg(y, Q) d|T (Q)|.
ployed before:
X
1
k3(r) = n
r
R X,|R|=r
1
= n
r
d X
deg(y, R [ {y})
r
2
y X\R
X
Q X,|Q|=r+1
dX
deg(y, Q)
r y2Q
d2
|T (Q)|
n
r
r QX,|Q|=r+1
n
2
X
1
r+1 d
= n
|T (Q)|
n
r
X
1
Q X,|Q|=r+1
1
X
= r+1
n
r+1
Q X,|Q|=r+1
r
n − r d2
|T (Q)|
r+1 r
2
d
(n − r)tr+1
r(r + 1)
d2n
d2
=
tr+1 −
tr+1.
r(r + 1)
r+1
=
55
Randomized Inremental Constrution (19.10.2009)
Summing up.
n−1
X
CG 2009
Let us reapitulate: the overall expeted number of onits is O(n) plus
n−1
X
K(r) =
(k1(r) − k2(r) + k3(r)).
r=1
r=1
Using our previous estimates, k1(2), . . . , k1(n) = 0 are aneled by the rst terms of
k2(1), . . . , k2(n − 1). The seond term of k2(r) an be ombined with the rst term of
k3(r), so that we get
n−1
X
(k1(r) − k2(r) + k3(r))
k1(1) + n
r=1
r=1
n
X
d2
tr+1 −
tr+1
r(r + 1)
r+1
r=1
n
X
d(d − 1)
d(n − 1)t1 + d(d − 1)n
n
X
r=1
tr+1
.
r(r + 1)
The Delaunay case. We have argued that the expeted number of onits asymptotially
bounds the expeted total loation ost over all insertion steps. The previous equation
tells us that this ost is proportional to O(n) plus
6n
n
X
2(r + 4) − 4
r=1
r(r + 1)
0
1
n−1
X
1
A = O(n log n).
= O n
r
r=1
Here,
n−1
X
1
r=1
r
=: Hn−1
is the (n − 1)-st Harmoni Number whih is known to be approximately ln(n − 1).
By going through the abstrat framework of onguration spaes, we have thus analyzed the randomized inremental onstrution of the Delaunay triangulation of n points.
Aording to Setion 9.3, the expeted update ost itself is only O(n). The steps dominating the runtime are the loation steps via the history graph. Aording to Setion
9.4, all history graph searhes (whose number is proportional to the number of onits)
an be performed in expeted time O(n log n), and this then also bounds the spae
requirements of the algorithm.
Questions
24. What is a onguration spae? Give a preise denition! What is an ative
onguration?
25. How do we get a onguration spae from the problem of omputing the Delaunay triangulation of a nite point set?
56
9.4. Expeted number of onits
CG 2009
26. How many new ative ongurations do we get on average when inserting the
r-th element? Provide an answer for onguration spaes in general, and for the
speial ase of the Delaunay triangulation.
27. What is a onit? Provide an answer for onguration spaes in general, and
for the speial ase of the Delaunay triangulation.
28. Explain why ounting the expeted number of onits asymptotially bounds
the ost for the history searhes during the randomized inremental onstrution of the Delaunay triangulation!
57