enumerating distances using spanners of bounded degree
DESCRIPTION
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. - PowerPoint PPT PresentationTRANSCRIPT
1
Enumerating Distances Enumerating Distances Using Spanners of Using Spanners of Bounded DegreeBounded Degree
Maya Zalcberg 049823446
Ilia Flax 015600052
Generalizing skip lists: A Generalizing skip lists: A spanner with logarithmic spanner with logarithmic
spanner diameterspanner diameter
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
2
OutlineOutline
Enumerating distances using spanners of bounded degree approximate distance enumeration Exact distance enumeration
Generalizing skip lists: A spanner with logarithmic spanner diameter
OutlineOutline
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
IntroductionIntroduction
The goal: Enumating the smallest k distances
among the distances in a group of n points.
input: S: a set of n points in k an integer such that 1 < k <
2
n
dR2
n
Outline
EnumeratingEnumerating distance distance
Using spannersUsing spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
4
IntroductionIntroduction
Output:
a sequence {a1,b1}…{ak,bk} distinct pairs of S is called the k closest pairs, if:
1.
2. the distances , are the k smallest elements in multiset
1 1 2 2 .....k ka b a b a b
i ia b 1 i k
: , ,pq p q S p q
Outline
EnumeratingEnumerating distance distance
Using spannersUsing spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
5
There are two solutions available:
using bounded-degree spanner to enumerate the k approximate closest pairs in
Modify the algorithm to obtain the k
exact closest pairs in
logn k k
( ) logn k n
IntroductionIntroductionOutline
EnumeratingEnumerating distance distance
Using spannersUsing spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
6
Approximate distanceApproximate distance
S a set of n points in , k an integer such that , t > 1 a real number.
sorted by their distances
is a sequence of k t-approximate closest pairs if:
, ,12n
a b ii i
, ,1p q i ki i
/i i p q t a bi i i ia b t
Outline
Enumerating distance Using spanners
Approximate distance Approximate distance
PresentationPresentation
Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
d
7
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.
Approximate distanceApproximate distanceOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
PresentationPresentation
Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
8
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
Approximate distanceApproximate distance
δ s, v R
Outline
Enumerating distance Using spanners
Approximate distance Approximate distance
PresentationPresentation
Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
9
The algorithm uses the t-spanner G to compute a sequence of k t-approximate closest pairs in S.
The idea is to run Dijkstra’s single-source shortest path algorithm simultaneously from all point of S.
AlgorithmAlgorithmOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
10
ApproxDistEnum(G,k)
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.
AlgorithmAlgorithmOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
11
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|.
AlgorithmAlgorithmOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
12
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.
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
13
Some new definitions…
the length of a shortest path between and in the t-spanner G
is a permutation of {1,2,… } such that
i i iw a b'iw
ia ib
21 2 ...n
w w w
2
n
2' ' '1 2 ...
nw w w
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
14
ApproxDistEnum(G,k) reports k pairs of points whose final priority values are
Since G is a t-spanner,
so by replacing i by we get
' ' '1 2, ,..., kw w w
'i iw w tw
'
i i iw w tw
'
i iiw w tw
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
Proof
i i
'
i iw w
i iw w
'
i iw w '
i i i iw w w tw
i i 1 j i
' 'j iw w
j i
ijw w
'
j jw w
' '
i j j iw w w w
'
i iw w2 3 1
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
'
iiw tw
i i i iw w
i iw tw
iitw tw
'i iw tw
i i 2
ni j
' 'i jw w
j i ijw w
'
iiw tw
'i jw tw
' '
ii j jw w tw tw 1 3 2 t
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
'
i i iw w tw '
i iiw w tw
'ii iw w tw
iiw tw
'
ii itw w w
/iiw w t
/i iiw t w tw
18
CorrectnessCorrectness
For each i, 1<i< :
The k pairs of points that are reported by the algorithm are the k t-approximate closest pairs, if:
2
n /i iiw t w tw
/i i i iw t p q tw
Outline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
CorrectnessCorrectnessOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
Proof Reminder!
the length of the shortest path in G between and is equal to .
Else: G is a t-spanner, so
ip iq 'iw
i iiw p q /i i i iw t p q tw
'/i i i iip q t w t p q
'
i i iip q w tw
i i ip q tw
' /i i iip q w w t
/i i ip q w t
20
Initializing: Building PQ:
Running Dijkstra:
( )D n ( )n
logDk k logk k
logn k k
Time AnalysisTime AnalysisOutline
Enumerating distance Using spanners
Approximate distance Approximate distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
21
Exact DistanceExact 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.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
PresentationPresentation
Algorithm Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
22
AlgorithmAlgorithm
This algorithm takes as input a t-spanner G = (S,E) and an integer k.
It returns a sequence of k exact closest pairs in S.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
23
AlgorithmAlgorithm
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….
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
24
AlgorithmAlgorithm
ExactDistEnum(G,k)
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.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
25
AlgorithmAlgorithm
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|.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation AlgorithmAlgorithm
Correctness Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
26
CorrectnessCorrectness
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
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
27
CorrectnessCorrectness
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.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
28
CorrectnessCorrectness 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,
8.
9.
/pq t
({ , })t pq priority r s tx
pq x
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
29
CorrectnessCorrectness
Summary: For each pair {p,q}, with , 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.
pq x
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm CorrectnessCorrectness
Time Analysis
Generalizing skip lists
Skip List Skip List Spanner
30
Time AnalysisTime Analysis Fundamental claim: - 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
ExactDistEnum(G,k) terminates at the moment when it selects {p,q}
kw
kpq tw
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
31
Time AnalysisTime Analysis
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
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
32
Time AnalysisTime Analysis Proof:
5.
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
8. – the length of a shortest path in G between r and s.
9. '
kt rs tw
kpq tw
'krs w
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
33
Time AnalysisTime 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.
> tx
kx w
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
34
Summary: I – the number of iterations made by
ExactDistEnum(G,k) Then the running time is
I is less than or equal to the number of pairs of distinct points of S having distance at most
Now we need to give an upper bound to I…
Time AnalysisTime Analysis
logDn ID n
ktw
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
35
Lemma: - 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
Time AnalysisTime Analysis
kw
ktw
2 1 2d
M t d n k
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
36
Proof:1.
2. - d-dimensional grid with cells of side lengths . Each cell of this grid has the form
for some integers . a cell is the Cartesian product of d intervals, which are closed on the left and open on the right.
Time AnalysisTime Analysis
: kw w
/w d
1 1/ , 1 / / , 1 /d di w d i w d i w d i w d
1 2, ,..., di i i
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
37
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 .
5. - the number of points of S that are contained in the i-th nonempty cell.
6. , the total number of pairs {x,y} such that x and y are contained in the same cell of .
Time AnalysisTime Analysis
1,2,..., g
in
1
:2
gi
i
nZ
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
38
7. if two points are in the same cell, their distance is less .
8. w is the k-th smallest distance in S, therefore .
9. , and an arbitrary cell in ,
10. the neighborhood of C in the d-dimensional hypercube is defines as followed:
Time AnalysisTime Analysis
/d w d w
Z k: t d
1 1: / , 1 / / , 1 /d dC i w d i w d i w d i w d
C
'1 1: ( ) / , 1 / ( ) / , 1 /d dC i w d i w d i w d i w d
To be continued….
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
39
10. the side lengths of are equal to , and contains the cell c in its center. Neighborhood of C : the set of all nonempty cells of that overlap .
11.For each 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.
12.
Time AnalysisTime Analysis'C
2 1 /w d 'C
'C
1 i g iN
2 1d
iN
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
40
Time AnalysisTime Analysis
pq tw
ij N
/ /pq w d t d w d tw
13. p,q two distinct points of s such that . p,q are contained in the i-th and j-th nonempty cells of .
14. if
15. but therefore .
ij N
pq tw
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
41
Time AnalysisTime Analysis16. 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
1
1
2i
g
i ji j N
M n n
21
1max( , )
2i
g
i ji j N
n n
2
1
g
i ll
N n
2
1
2 1g
d
ll
n
1
2 1 22
gd l
ll
nn
2 1 2dn Z (2 1) 2d n k
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
42
Theorem: Let S be a set on n points in ,
let be a real number, let be a positive integer, and let be a t-spanner for S of degree . Given any integer with , algorithm ExactDistEnum(G,k) computes a sequence of exact closest pairs in S in
SummarySummary
d
12
nk
logdDt n k n
1t D
GD
k
k
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distanceExact distance
Presentation Algorithm Correctness Time AnalysisTime Analysis
Generalizing skip lists
Skip List Skip List Spanner
43
Generalizing Skip ListsGeneralizing Skip Lists
We present a randomized algorithm that constructs a sparse spanner whose expected spanner diameter is .
Skip lists – this randomized data
structure is a sparse 1-spanner whose spanner diameter is .
Lets start by presenting some definitions…
logn
logn
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
44
Generalizing Skip ListsGeneralizing Skip Lists Sparse Spanner – a spanner with
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….
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
n
45
Generalizing Skip ListsGeneralizing Skip Lists S a set on n real numbers. Construct a sequence of subsets of S: and . As long as ,construct a random
subset of as followed: Each number of has a 50% chance of
getting picked. Set to be the subset of all the picked
points of . Finally, Set and iterate.
1 :S S : 1i
iS
iS1iS
1iS
iS
iS: 1i i
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
46
Generalizing Skip ListsGeneralizing Skip Lists - the number of iterations. Then we
obtain the following sequence:
of subsets of S, where . Definition: , . The Skip List for S:
1. for each i, , there is a double linked list storing the elements of in sorted order. Elements of are at level i of the skip list.2. for each i, , and each , the occurrences of in and are connected by pointers.
h
1 1 2 2 1h h h hS S S S S S S
hS
iS 1 i h 1 i h
iL iS
iS
1 i h ip Sp
iL 1iL
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
47
Generalizing skip listsGeneralizing skip lists
1 2 4 5 8 9 10 12 14 15
2 5 9
9
10 12
12
12
15
15
A skip list for the set S = {1, 2, 4, 5, 8, 9, 10, 12, 14, 15}.
There are four nonempty subsets and
The value of h is equal to 4.1 2 3, ,S S S
4S
Example:
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
48
Generalizing Skip ListsGeneralizing Skip ListsLemma: , , produced by the given random
process, and let M be the total size of the corresponding skip list.1. The expected value of is . 2. There is a constant C that for all large enough real numbers S : 3. M is proportional to , which has expected value of . 4. There is a constant that for all large enough real numbers S :
iS 1 i h
log nh
Pr( log ) 1/ csh s n n
1
h
ii
S n
'
Pr( ) c snM sn e
,c
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
49
Building the paths 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.1. If q is reached – finished.
2. Otherwise, let p1 be the first point encountered at level 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.
3. Recursively build a path between p1 and q1.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
50
Building the pathsBuilding the paths
This way, we construct two paths. The construction stops as soon as the
two paths meet.
The result of building a path between 4 and 14 on the skip list example is:
1 1 2 2 3 3 2 1 14 ,5 ,5 ,9 ,9 ,12 ,12 ,12 ,14
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
51
Building the pathsBuilding the paths The expected number of steps made
to build a path between p and q is .
The excepted number of steps made at level i is O(1), and there are levels.
log n
log n
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
52
The spanner in 1-DThe 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 . 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 ?
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
log n
53
SummarySummaryTheorem:
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
and its spanner diameter is .
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip ListSkip List
Skip List Spanner
log n n
54
Skip list spannerSkip 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:
of subsets of S, where .
1 1 2 2 1h h h hS S S S S S S
hS
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
55
Skip List 2-D spannerSkip List 2-D spannerDefinition: - an integer. , are
constructed be the random process. For S is defined as follows:
1. For each, i, , the points of are stored in the graph . The points of are at level i of the skip list spanner.
2. for each i, , and each , the occurrences of in level i and level i-1 are connected by pointers.
2k iS 1 i h
( , )SLS S k1 i h iS
,iS kiS
1 i h ip Sp
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
56
Recall Recall ΘΘ graph graphDefinition: Let be an integer, let and let S
be a set of points in the plane. The undirected graph is defined as follows:
1. The vertices of 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 , the graph contains one edge where r is a point in , whose orthogonal projection onto is closest to p
2k 2 / k
,S k
,S k
\S p ,S k ,p r
/pC S p
,C pl
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
57
Recall Recall ΘΘ graph graph
p
,C pl
r
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
58
Skip List 2-D spannerSkip List 2-D spanner is a graph with vertex set S
and edge set the union of the edge sets of the graphs , .
Lemma: an integer, , S a set of n
points in the plane. The skip list spanner is a t-spanner for S with with high probability, this graph contains edges and can be constructed in time.
( , )SLS S k
1 i h ,iS k
9k 2 / k
1/ cos sint
kn( log )kn n
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
59
Building a pathBuilding 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 from p toward q.
Suppose we’ve built a path from p to x. If x = q – finished. If and x doesn’t occur on level 2:
1. C a cone of such that q in .
2. x’ is the point of such that {x,x’} is an edge of .
1,S k
x q
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner kC Cx
1xC S 1,S k
60
Building a pathBuilding 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
.
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.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
1,S k
61
Building a pathBuilding 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.
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
62
SummarySummaryTheorem: Let be an integer, let , and let
be a set of n points in the plane. Then the following is true: 1. The skip list spanner is a t-spanner for with high probability it contains edges. 2. The skip list spanner can be constructed in with high probability. 3. with high probability, the spanner diameter of the skip list spanner is . 4. all these bounds are with respect to the coin flips that are used to build the skip list spanner.
9k 2 / k
1/ cos sint
Outline
Enumerating distance Using spanners
Approximate distance
Presentation Algorithm Correctness Time Analysis
Exact distance
Presentation Algorithm Correctness Time Analysis
Generalizing skip listsGeneralizing skip lists
Skip List Skip List SpannerSkip List Spanner
S
( , )SLS S k
kn
logkn n
(log )n
63