Next, I describe how to construct the Gabriel graph inO(n2)using degree 2. I begin by defining the predicates used in our construction. LetD(p, q)be the closed disk withpqas the diameter. A sites, distinct frompandq,killsthe edge(p, q)ifslies inD(p, q). Letmbe the midpoint ofpq. The degree 2 predicateIsKiller(p, q, s)compares the squared distances betweenmandsand
mandpto determine ifskills edge(p, q).
Given the arrangementA(S∗)and a sitesi ∈ Swe compute the circular orderings of the sites
inS\ {si}aroundsi so that we may efficiently determine the edges of the Gabriel graph incident tosi. Consider the lines∗
and some other sitesj ∈ S. As mentioned in Section 6.2, the slope of←→sisj is thex-coordinate of
vj, thus, by walking along s∗
i inA(S∗)we find a set of lines, through si ordered by slope, which
gives the circular ordering of the sites ofS\ {si}aroundsi.
Constructing a circular ordering for a site is a purely topological operation on the arrangement
A(S∗)and uses degree 0. For each sites, computing the circular ordering takes time proportional
to the number of vertices that lie ons∗, which isO(n).
Lemma 13. Given A(S∗), for site s
∈ S, we can compute the circular ordering of the sites in
S\ {s}aroundsinO(n)time and degree 0.
Once we have computed a circular ordering ofS\ {s}around eachs∈S, inO(n)time we can compute the Gabriel edges incident ats. The key idea behind this step is captured in Lemma 14.
We number the circularly ordered sites inS\ {s}in a counter clockwise manner starting with anys0 ∈ S\ {s}, i.e.,ssi~+1 is the first ray counter clockwise fromssi~ ats. Let Dl(s, si)denote the closed semicircular disk that hasssi as the diameter and lies to the left ofssi~ . The sitesj kills the edge(s, si)from the leftif and only ifsj lies inDl(s, si). Then,
Lemma 14. Ifsj lies inDl(s, si)and∀k ∈ {i, i+ 1, . . . , j−1}, sk ∈/ Dl(s, si), then sj also lies inDl(s, sk),∀k ∈ {i, i+ 1, . . . , j−1}
s
s
is
ks
ju
kFigure 6.2: The sitesjlies in the part of Dl(s, si)that is to the left ofssk~ . This part ofDl(s, si)is a subset ofDl(s, uk), which itself is a subset ofDl(s, sk).
Intuitively, the lemma says that if sj is the first site (in a counter clockwise sense) that kills(s, si) from the
left, thensj kills all(s, sk), i≤ k≤j −1,from the left. Figure 6.2 gives a brief idea of the lemma and the proof.
Proof. Since i ≤ k ≤ j − 1 and sk ∈/ Dl(s, si), the segmentsskintersects the circular part of the boundary of
Dl(s, si)at some pointuk. For every pointp∈Dl(s, uk),
LetHbe the closed half plane that lies on left of the linesuk~ . For every pointp∈Dl(s, si)∩H, angle∠spuk ≥∠spsi > π/2. Thus(Dl(s, si)∩H)⊂Dl(s, uk). Using this with the subset relation from the previous paragraph we have(Dl(s, si)∩H)⊂Dl(s, sk). Sincesj lies in(Dl(s, si)∩H)
it also lies inDl(s, sk).
LetLbe the circularly doubly linked list of sites ofS\{s}ordered counter clockwise arounds. Algorithm 4 efficiently identifies sitess0
∈ Lsuch that the edge (s, s0)
is killed from the left by some site in L. Such edges are markeddead by the algorithm. A similar algorithm is used to identify the sites s00 such that the edge (s, s00)is killed from the right. The edges that are killed
neither from left nor right belong to the Gabriel graph.
We now give a brief overview of Algorithm 4. Given a siteu∈L, defineleft_victims(u)
as a subset of S \ {s} such that for each site v ∈ left_victims(u), u is the first (when walking left along the list L) site to kill the edge (s, v) from left. Lemma 14 says that the set
left_victims(u)is contained in a continuous sublist ofLthat starts on the right ofuand only contains sites wsuch that (s, w) is killed from left by u. The lemma is used in the inner while loop of Algorithm 4 to find a sublistLusuch that: (a) each site inLu has a killer in(u∪Lu); and (b) the union of the left_victims of the sites in(u∪Lu) is a subset ofLu. Due to (a), we know that the sites inLu can be killed from left and hence they are markeddead. Due to (b), for any remaining site v ∈ L\Lu, if the edge(s, v)is killed from the left thenv belongs to the set of left_victims of some site inL\Lu. Thus, to find the remaining left_victims, we process the smaller listL\Lu.
Testing ifkiller ∈ Dl(s, current)uses degree 2 predicatesisKillerandOrientation, thus, the above algorithm runs inO(|L|)time and is degree 2.
Lemma 15. Given the circular ordering ofS \ {s}arounds, inO(n)time and degree 2, we can find the Gabriel edges incident ats.
Algorithm 4KillFromLeft(L, s): Give a set of sitesLcircularly ordered aroundsDelete the sites ofLthat are killed from the left.
1: Initialize the unseen values of each site inLtotrue
2: Initialize the dead values of each site inLtof alse
3: u=any site inL
4: // Invar: Any site inLkilled from left is in the set ofleft_victimsof another site inL.
5: whileu→unseendo
6: u→unseen =f alse
7: killer =u
8: current=u→right
9: // The while loop computesLu
10: // Invar: Sites right ofu& left ofcurare killed from left byuor a site betweenuandcur.
11: // Invar: Alllef t_victimsof sites betweenuandkillerare found.
12: whilekiller6=currentdo
13: ifkiller∈ Dl(s, current)then
14: current→dead =true
15: current=current→right
16: else
17: killer =killer →right
18: end if
19: end while
20: Lu =the sublist ofL, that is to the right ofuand left ofcurrent
21: DeleteLu fromL
22: u=u→left
sitesSwith degree 2. First, computeA(S∗)
, which by Lemma 12 takesO(n2)time and degree 2. Second, for each sitesi ∈S compute the circular ordering of the sites ofS\ {si}, which in total, by Lemma 13, takesO(n2) and degree 0. Third, for each sitesi ∈ S, use the circular orderings to compute the set of Gabriel edges in whichsi is a member, which in total, by Lemma 15, takes
O(n2)and degree 2.
Corollary 16. We can compute the Gabriel graph inO(n2)time using degree 2.