Enumerating distances using spanners of bounded degree

Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Enumerating Distances
Using Spanners of
Bounded Degree
Generalizing skip lists: A
spanner with logarithmic
spanner diameter
Generalizing skip lists
Skip List
Skip List Spanner
Maya Zalcberg 049823446
Ilia Flax
015600052
1
Outline
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
 Enumerating distances using
spanners of bounded degree
 approximate distance enumeration
 Exact distance enumeration
 Generalizing skip lists: A spanner
with logarithmic spanner diameter
Skip List
Skip List Spanner
2
Outline
Introduction
Enumerating distance
Using spanners
 The goal:
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
 Enumating the smallest k distances
among the  n2  distances in a group of
n points.
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
 input:
 S: a set of n points in Rd
 k an integer such that 1 < k <
n
 
2
Skip List
Skip List Spanner
3
Outline
Introduction
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
 Output:
a sequence {a1,b1}…{ak,bk} distinct
pairs of S is called the k closest
pairs, if:
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
1.
a1b1  a2b2  .....  a k bk
2. the distances ai bi , 1  i  k
are the k smallest elements in
multiset
 pq :  p, q  S , p  q
4
Outline
Introduction
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 There are two solutions available:
 using bounded-degree spanner to
enumerate the k approximate closest
pairs in   n  k log k 
 Modify the algorithm to obtain the k
exact closest pairs in   (n  k )log n 
5
Outline
Approximate distance
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 S a set of n points in d, k an integer
such that , t > 1 a real number.


 n
ai , bi ,1  i    sorted
 2
by their distances
  pi , qi ,1 i  k is a sequence of k
t-approximate closest pairs if:
Generalizing skip lists
Skip List
Skip List Spanner
aibi / t  pi qi  t aibi
6
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Approximate distance
 G = (S,E) it a t-spanner for S
 D positive integer. The degree of each
point from S is less then or equal to D.
 PQ is a priority queue that stores at
most k pairs.
 Each priority(p,q) in PQ is equal to the
length of the shortest path in G between
p and q at the moment.
7
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Approximate distance
Dijkstra’s algorithm
 We use a variant of Dijkstra’s
SingleSource(G,s,R) algorithm
that takes as input an undirected
graph G in which every edge has a
positive weight, a vertex s of G,
and a real number R>0. It returns a
set A of all vertices v for which
δ  s, v   R
8
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Algorithm
 The algorithm uses the t-spanner
G to compute a sequence of k tapproximate closest pairs in S.
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
 The idea is to run Dijkstra’s singlesource shortest path algorithm
simultaneously from all point of S.
Skip List
Skip List Spanner
9
Outline
Enumerating distance
Using spanners
Algorithm
ApproxDistEnum(G,k)
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 Initializing: PQ contains the
min(k,|E|) shortest edges of E.
*. The priority(p,q) of any such edge
{p,q} is equal to the Euclidean
distance between p and q.
 Then a sequence of k iterations is
carried out.
10
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Algorithm
 In each iteration:
 The pair {p,q} with the lowest priority from
PQ is deleted and reported immediately.
 For each edge {q,r} (and, symmetrically
{p,s} ) of G:
 If the pair {p,r} doesn’t occur in PQ, then
priority({p,r})=priority({p,q})+|qr| and {p,r} inserted
into PQ. If PQ contains k+1 pairs, the pair with the
highest priority is deleted.
 If the pair {p,r} occures in PQ, then if it’s priority is
higher than priority({p,q})+|qr| , then the
priority{p,r} is set to priority({p,q})+|qr|.
11
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Correctness
 According to the analysis of
Dijkstra’s algorithm, the algorithm
returns the k shortest path
distances in G.
 We show that these k pairs are the
t-approximate closest pairs in G.
Skip List
Skip List Spanner
12
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Correctness
 Some new definitions…
 wi  aibi
 wi' the length of a shortest path
between ai and bi in the t-spanner G
 w1  w2  ...  w

n
2
  is a permutation of {1,2,… } such that
n
 
2
Generalizing skip lists
Skip List
Skip List Spanner
w' 1  w'  2  ...  w'


n
2
13
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Correctness
 ApproxDistEnum(G,k) reports k
pairs of points whose final priority
'
'
'
w
,
w
,...,
w
values are  1   2
 k 
 Since G is a t-spanner, w  w  twi
so by replacing i by  we get
'
i
 w i   w i   tw i 
'
Generalizing skip lists
Skip List
Skip List Spanner


wi  w' i   twi
14
Correctness
Outline
Enumerating distance
Using spanners
Proof
 wi  w' i 
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 
 w    wi 
wi  w i   w' i   tw i  
  i   i
 i
  i   i
1 j  i
  j  i
Generalizing skip lists
 
Skip List
Skip List Spanner
2
wi  w' i 

 w   w
 w   w  
w'  j   w' i 
 j
i
'
 j
3
1
'
wi  w  j   w'  j   w i 
 j


wi  w' i 
Outline
Enumerating distance
Using spanners
Correctness
'
w
  i   twi
 
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
 i
n
i j 
2
  i   i

  
Skip List
Skip List Spanner
1
3
'

'
'
w  j   wi
w' i   tw  j 

2 t
w i   w  j   tw  j   twi
'
w i   tw i 
'
 w i   w  j 
  j  i
Generalizing skip lists
i
i
w i   tw i 
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 w    wi  tw    tw 
  i   i

w' i   twi
Outline
Enumerating distance
Using spanners
Correctness
'
w

w
  i   i   tw i 
'
 wi  w i   twi
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis

 

w i   w i   twi
'
tw i   w' i   wi


w i   wi / t
w i   twi

Generalizing skip lists
Skip List
Skip List Spanner

wi / t  w i   twi
Outline
Enumerating distance
Using spanners
Approximate distance
Correctness
 For each i, 1<i<
n
 
2
: wi / t  w i   twi
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 The k pairs of points that are reported by
the algorithm are the k t-approximate
closest pairs, if:
wi / t  pi qi  twi
18
Correctness
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 Proof
 Reminder!
the length of the shortest path in G
'
between pi and qi is equal to w i .
 w i   pi qi
wi / t  pi qi  twi
 Else: G is a t-spanner, so
pi qi / t  w' i   t pi qi
Generalizing skip lists
Skip List
Skip List Spanner


pi qi  w i   twi
'

pi qi  twi

pi qi  w i   wi / t
'

pi qi  wi / t
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Time Analysis
 Initializing:
 Building PQ: ( D  n)
 ( n)
 Running Dijkstra:   Dk log k 
  k log k 

   n  k log k 
20
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Exact Distance
 G = (S,E) it a t-spanner for point
set S, such that the maximum
degree is D.
 By making two modifications to
ApproxDistEnum(G,k) we can
enumerate the k exact closest
pairs.
Skip List
Skip List Spanner
21
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Algorithm
 This algorithm takes as input a tspanner G = (S,E) and an integer
k.
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 It returns a sequence of k exact
closest pairs in S.
Generalizing skip lists
Skip List
Skip List Spanner
22
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Algorithm
ExactDistEnum(G,k)
 We make two modification to
ApproxDistEnum(G,k):
1. The priority queue PQ is maintained
at full size.
2. The algorithm does not report pairs
as before. It keeps the k closest
pairs among all pairs that were ever
inserted into PQ.
to be continued….
23
Outline
Enumerating distance
Using spanners
Algorithm
ExactDistEnum(G,k)
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
2. the terminition is when the smallest
priority in PQ is larger then t times
the Euclidian-distance of the k-th
closest pair found so far.
*. At termination, the k closest pairs that
have been found are reported.
24
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Algorithm
 Implementation issues:
 A second priority queue is maintained
that contains the same pairs as PQ,
and in which the priority of and pair
{p,q} is equal to the euclidian distance
|pq|.
Generalizing skip lists
Skip List
Skip List Spanner
25
Outline
Correctness
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 Claim:
 Let x be the Euclidian distance of the
k-th pair reported by the algorithm.
 Let p,q be any two distinct points of S
such that the pair {p,q} is never
inserted into PQ.

|pq|>x
26
Outline
Correctness
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 Proof:
1. Let {r,s} a pair that causes us to stop.
2. At the termination time
priority({r,s})>tx
3. Also, at the same time priority({r,s}) is
equal to the length of the shortest
path between r and s in G.
4. At termination, all the shortest paths
in G shorter then priority({r,s}) have
been found.
27
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Correctness
 Proof:
5.  - the length of the shortest path
in G between p and q.

6.   priority({r,s}).
7. Since G is a t-spanner, pq   / t

8. t pq    priority({r, s})  tx
Skip List
Skip List Spanner

9.
pq  x
28
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Correctness
 Summary:
 For each pair {p,q}, with pq  x , is
inserted into PQ.
 The distance of the k-th closest pair
in S is less then or equal to x.

 ExactDistEnum(G,k) enumerates the
k closest pairs in S.
29
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Time Analysis
 Fundamental claim:
 wk - the k-th smallest Euclidean
distance in S.
 {p,q} – the current pair with minimum
priority in PQ.
 Assume {p,q} is the first pair for
which pq  twk

 ExactDistEnum(G,k) terminates at
the moment when it selects {p,q}
30
Outline
Time Analysis
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 Proof:
1.
 – the length of the shortest path in
G between p and q
2. x – the k-th smallest Euclidean
distance
3. Priority({p,q})=
4. We have to show that

> tx
31
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Time Analysis
 Proof:
5.   pq    twk
6. Any pair {r,s} whose distance in G
has already occurred as minimal
element in PQ.
7. r,s – distinct points of S such that
rs  wk
'

8. – the length of a shortest path in
G between r and s.

9.
  t rs  twk  
'
32
Outline
Time Analysis
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 Summary:
 At {p,q} selection as a minimal element
in PQ, all pairs of distinct points of S
having Euclidean distance at most Wk
have been inserted into PQ.


x  wk
Generalizing skip lists
Skip List
Skip List Spanner



> tx
33
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Time Analysis
Summary:
 I – the number of iterations made by
ExactDistEnum(G,k)
 Then the running time is   Dn  ID log n 
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
 I is less than or equal to the number of
pairs of distinct points of S having
distance at most twk
Skip List
Skip List Spanner
 Now we need to give an upper bound to I…
34
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Time Analysis
Lemma:
 wk - the k-th smallest Euclidean distance
in S.
 t – a real number, larger then 1.
 M – the number of pairs of distinct points
of S having distance at most twk


  n  2k 
M  2 t d   1
d
35
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Time Analysis
Proof:
1. w : wk
2.  - d-dimensional grid with cells of side
lengths w / d . Each cell of this grid has
the form

i1w / d ,  i1  1 w / d  id w / d ,  id  1 w / d



for some integers i1 , i2 ,..., id . a cell is the
Cartesian product of d intervals, which are
closed on the left and open on the right.
36
Outline
Time Analysis
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
3. a cell of  is nonempty, if it contains at
least one point of S.
4. g – the number of nonempty cells. we
number these cell arbitrarily 1, 2,..., g .
5. ni - the number of points of S that are
contained in the i-th nonempty cell.
 ni 
Z :   
6.
i 1  2  , the total number of pairs {x,y}
g
such that x and y are contained in the
same cell of  .
37
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Time Analysis
7. if two points are in the same cell, their
distance is less d  w / d  w
.
8. w is the k-th smallest distance in S,
thereforeZ  k .
9.  : t d  , and C an arbitrary cell in  ,

C : i1w / d ,  i1  1 w / d  id w / d ,  id  1 w / d

10. the neighborhood of C in the d-dimensional
hypercube is defines as followed:

C ' : (i1   ) w / d ,  i1  1    w / d  (id   ) w / d ,  id  1    w / d
To be continued….
38

Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Time Analysis
10. the side lengths of C ' are equal to
 2  1 w / d , and C ' contains the cell c
in its center.
Neighborhood of C : the set of all
nonempty cells of  that overlap C ' .
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
11.For each i, 1  i  g . N i is the set of all
indices j, such that the j-th nonempty
cell is in the neighborhood of the i-th
nonempty cell.
d
N

2


1

12. i 
39
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Time Analysis
13. p,q two distinct points of s such that
pq  tw. p,q are contained in the i-th
and j-th nonempty cells of  .
14. if j  Ni

pq    w / d  t d  w / d  tw
15. but pq  tw therefore j  Ni .
Skip List
Skip List Spanner
40
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Time Analysis
16. Finally, we can prove the upper bound
on M, which is the number of
distances in S that are less then or
equal to tw .
g
M
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
1
ni  n j

2 i 1 jNi
2
1 g
    max(ni , n j )  
2 i 1 jNi
  2   1
d
d

l 1
g
 nl   2  1
2
l 1
  2   1
g
d
Ni nl 2

 nl  
n

2
 l

 
l 1 
 2 
g
 n  2Z   (2  1)d  n  2k 
41
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Summary
Theorem:
 Let S be a set on n points in d ,
let t  1 be a real number, let D be
a positive integer, and let G be a tspanner for S of degree D. Given
 n
any integer k with 1  k    ,
 2
algorithm ExactDistEnum(G,k)
computes a sequence of k exact
closest pairs in S in
  Dt
d
 n  k  log n 
42
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Generalizing Skip Lists
 We present a randomized algorithm
that constructs a sparse spanner whose
expected spanner diameter is   logn .
 Skip lists – this randomized data
structure is a sparse 1-spanner whose
spanner diameter is   logn  .
 Lets start by presenting some
definitions…
43
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Generalizing Skip Lists
 Sparse Spanner – a spanner with
  n  or with a spanner with small
weight/size.
 Spanner Diameter – The longest
shortest path between a pair of points
in S.
 Next we will present the skip list data
structure….
44
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Generalizing Skip Lists




S a set on n real numbers.
Construct a sequence of subsets of S:
S1 : S and i : 1.
As long as Si  ,construct a random
subset Si 1 of Si as followed:
 Each number of Si has a 50% chance of
getting picked.
 Set Si 1 to be the subset of all the picked
points of Si .
 Finally, Set i : i  1 and iterate.
45
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Generalizing Skip Lists
 h - the number of iterations. Then we
obtain the following sequence:
  Sh1  Sh  Sh1  Sh2    S2  S1  S
of subsets of S, where Sh  .
 Definition: Si ,1  i  h . The Skip List for S:
1. for each i, 1  i  h, there is a double
linked list Li storing the elements of Si in
sorted order. Elements of Si are at level i
of the skip list.
2. for each i,1  i  h , and each p  Si , the
occurrences of p in Li and Li 1 are
46
connected by pointers.
Outline
Enumerating distance
Using spanners
Generalizing skip lists
 Example:
12
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
9
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
5
2
Exact distance
1
2
4
5
8
12
15
15
9
10
12
9
10
12
14
15
A skip list for the set S = {1, 2, 4, 5, 8, 9, 10, 12, 14, 15}.
There are four nonempty subsets S1 , S2 , S3 and S 4
The value of h is equal to 4.
47
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Generalizing Skip Lists
Lemma:
 Si, 1  i  h, produced by the given random
process, and let M be the total size of the
corresponding skip list.
1. The expected value of h is   log n .
2. There is a constant C that for all large
enough real numbers S :
Pr(h  s log n)  1/ n h
cs
3. M is proportional to  Si , which has
i 1
expected value of   n .
,
4. There is a constant c that for all large
enough real numbers S :
48
 c' sn
Pr(M  sn)  e
Outline
Enumerating distance
Using spanners
Building the paths

p,q – two points in S. we want to build a
path between p and q.
1.
Start at p at level 1. walk right until you
reach an point at level 2.
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
1.
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
2.
2.
Do the same walking left from q at level 1
- let q1 is the first point encountered at level 2.
- if p1 is reached – finished.
Generalizing skip lists
Skip List
Skip List Spanner
If q is reached – finished.
Otherwise, let p1 be the first point encountered at
level 2.
3.
Recursively build a path between p1 and
q1.
49
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Building the paths
 This way, we construct two paths.
 The construction stops as soon as the
two paths meet.
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 The result of building a path between 4
and 14 on the skip list example is:
Generalizing skip lists
Skip List
Skip List Spanner
41 ,51 ,52 ,92 ,93 ,123 ,122 ,121 ,141
50
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Building the paths
 The expected number of steps made
to build a path between p and q is
  log n  .
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
 The excepted number of steps made
at level i is O(1), and there are   log n 
levels.
Generalizing skip lists
Skip List
Skip List Spanner
51
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
The spanner in 1-D
 By “flattening” the vertices, we can regard
the skip list as a graph G.
 The expected path length between two
points p,q is   log n  .
 The path the from the example in G is:
4,5,9,12,14.
 The skip list is a 1-spanner for S.
 What is the expected spanner diameter ?
52
Outline
Enumerating distance
Using spanners
Summary
Theorem:
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
 Let S be a set on n real numbers.
The skip list of S can be regarded
as a graph which is a 1-spanner
for S. with high probability, the
number of edges of this graph is
  n  and its spanner diameter is
  log n .
53
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Skip list spanner
 We want to generalize out solution for
1-D to 2-D.
 S – a set of n points in the plane.
 We’ll use the same random process to
obtain the following sequence:
  Sh1  Sh  Sh1  Sh2    S2  S1  S
of subsets of S, where Sh  .
54
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Skip List 2-D spanner
Definition:
 k  2 - an integer. Si, 1  i  h are
constructed be the random process.
SLS ( S , k ) For S is defined as follows:
1. For each, i, 1  i  h , the points of Si are
stored in the graph   Si , k . The points
of Si are at level i of the skip list
spanner.
2. for each i, 1  i  h , and each p  Si, the
occurrences of p in level i and level i-1
are connected by pointers.
55
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Recall Θ graph
Definition:
 Let k  2 be an integer, let   2 / k and let S
be a set of points in the plane. The undirected
graph   S , k  is defined as follows:
1. The vertices of   S , k  are the points of S.
2. For each point p of S and for each cone
C of Ck, such that the translated cone Cp
contains one or more points of S \  p,
the graph   S , k  contains one edge p, r
where r is a point in C p  S /  p, whose
orthogonal projection onto l
is closest
C, p
to p


56
Outline
Recall Θ graph
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
lC , p
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
r
Generalizing skip lists
Skip List
Skip List Spanner
p
57
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Skip List 2-D spanner
 SLS ( S , k ) is a graph with vertex set S
and edge set the union of the edge sets
of the graphs   Si , k , 1  i  h .
Lemma:
 k  9 an integer,   2 / k , S a set of n
points in the plane. The skip list spanner
is a t-spanner for S with t  1/  cos  sin 
with high probability, this graph contains
  kn  edges and can be constructed in
(kn log n) time.
58
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Building a path
 Like in the 1-D case in order to build a
path between p and q we build two paths.
One starting at p and the other at q.
We stop when the paths meet.
 We start at p at level 1 and build a path in
the graph   S1, k  from p toward q.
 Suppose we’ve built a path from p to x.
 If x = q – finished.
 If x  q and x doesn’t occur on level 2:
1. C a cone of Ck such that q in Cx .
2. x’ is the point of Cx  S1 such that {x,x’} is an
edge of   S1, k  .
59
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Building a path
 Then x’ is the next point on the path from
p toward q. set x=x’.
 We keep extending this path until x=q or
the point x occurs at level 2.
 Assume that x occurs at level 2.
 We start building a path from q to x in
  S1 , k  .
 Assume we’ve built a path from q to y.
 We stop extending the path if y is one of
the points on the path from p to x or if y
occurs at level 2.
60
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Building a path
 Assume y is a point p’ on the path
from p to x. In this case we return the
path from p to p’ followed by the
reverse of the path from q to p’ and
stop.
 Otherwise, x and y are both on level 2
and we use the same algorithm to
construct a path between them.
Generalizing skip lists
Skip List
Skip List Spanner
61
Outline
Enumerating distance
Using spanners
Approximate distance
Presentation
Algorithm
Correctness
Time Analysis
Exact distance
Presentation
Algorithm
Correctness
Time Analysis
Generalizing skip lists
Skip List
Skip List Spanner
Summary
Theorem:
 Let k  9 be an integer, let   2 / k, and let S
be a set of n points in the plane. Then the
following is true:
1. The skip list spanner SLS ( S , k ) is a t-spanner
for t  1/  cos  sin   with high probability it
contains   kn  edges.
2. The skip list spanner can be constructed in
  kn log n  with high probability.
3. with high probability, the spanner diameter
of the skip list spanner is (log n).
4. all these bounds are with respect to the coin
flips that are used to build the skip list
62
spanner.
63