1 / 63

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 Generalizing skip lists Skip List Skip List Spanner.

marek
Download Presentation

Enumerating Distances Using Spanners of Bounded Degree

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 Enumerating Distances Using Spanners of Bounded Degree Generalizing skip lists: A spanner with logarithmic spanner diameter Maya Zalcberg 049823446 Ilia Flax 015600052

  2. 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 Outline • Enumerating distances using spanners of bounded degree • approximate distance enumeration • Exact distance enumeration • Generalizing skip lists: A spanner with logarithmic spanner diameter

  3. Outline Enumeratingdistance Using spanners Approximate distance Presentation Algorithm Correctness Time Analysis Exact distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner Introduction • 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 <

  4. 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 Outline Enumeratingdistance Using spanners Approximate distance Presentation Algorithm Correctness Time Analysis Exact distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner Introduction

  5. Outline Enumeratingdistance Using spanners Approximate distance Presentation Algorithm Correctness Time Analysis Exact distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner Introduction • 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

  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 • 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:

  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 • 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.

  8. 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

  9. 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 • 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.

  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 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.

  11. 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|.

  12. 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 • 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.

  13. 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 • Some new definitions… • the length of a shortest path between and in the t-spanner G • is a permutation of {1,2,… } such that

  14. 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 • 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

  15. Correctness 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 Proof

  16. 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

  17. 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

  18. 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 • For each i, 1<i< : • The k pairs of points that are reported by the algorithm are the k t-approximate closest pairs, if:

  19. Correctness 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 • Proof • Reminder! the length of the shortest path in G between and is equal to . • Else: G is a t-spanner, so

  20. 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: • Running Dijkstra:

  21. 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. 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

  22. Algorithm 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 distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner

  23. 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…. 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

  24. Algorithm 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 distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner

  25. 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|. 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

  26. Correctness 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 distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner

  27. Correctness Proof: Let {r,s} a pair that causes us to stop. At the termination time priority({r,s})>tx Also, at the same time priority({r,s}) is equal to the length of the shortest path between r and s in G. 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 distance Presentation Algorithm Correctness Time Analysis Generalizing skip lists Skip List Skip List Spanner

  28. Correctness Proof: - the length of the shortest path in G between p and q. priority({r,s}). Since G is a t-spanner, 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

  29. Correctness 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. 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

  30. Time 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} 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

  31. Time Analysis Proof: – the length of the shortest path in G between p and q x – the k-th smallest Euclidean distance Priority({p,q})= We have to show that > tx 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

  32. Time Analysis Proof: Any pair {r,s} whose distance in G has already occurred as minimal element in PQ. r,s – distinct points of S such that – the length of a shortest path in G between r and s. 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

  33. 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. > tx 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

  34. Time Analysis 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: 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…

  35. Time Analysis 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 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

  36. Time Analysis 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 Proof: - 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.

  37. Time Analysis 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 a cell of is nonempty, if it contains at least one point of S. g – the number of nonempty cells. we number these cell arbitrarily . - the number of points of S that are contained in the i-th nonempty cell. , the total number of pairs {x,y} such that x and y are contained in the same cell of .

  38. Time Analysis 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 if two points are in the same cell, their distance is less . w is the k-th smallest distance in S, therefore . , and an arbitrary cell in , the neighborhood of C in the d-dimensional hypercube is defines as followed: To be continued….

  39. Time Analysis 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 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 . 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.

  40. Time Analysis 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 p,q two distinct points of s such that . p,q are contained in the i-th and j-th nonempty cells of . if but therefore .

  41. Time Analysis 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 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 .

  42. Summary 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 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

  43. Generalizing Skip Lists 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 • 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…

  44. Generalizing Skip Lists 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 • 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….

  45. Generalizing Skip Lists 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 • 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.

  46. Generalizing Skip Lists 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 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.

  47. Generalizing skip lists 12 12 15 9 5 9 2 10 12 15 5 14 1 2 10 4 8 9 12 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. 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 • Example:

  48. Generalizing Skip Lists 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 Lemma: • , , 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 :

  49. Building the paths 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 • p,q – two points in S. we want to build a path between p and q. • Start at p at level 1. walk right until you reach an point at level 2. • If q is reached – finished. • Otherwise, let p1 be the first point encountered at level 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. • Recursively build a path between p1 and q1.

  50. Building the paths 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 • 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:

More Related