1 / 38

Range Search Algorithms

Range Search Algorithms. Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty. VLSI designer is drawing schematics or designing layout. He / she wishes to focus on a small portion of data by zooming in. How to find efficiently the objects of interest?. How to store the objects?.

maeve
Download Presentation

Range Search Algorithms

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. Range Search Algorithms Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty Range Search Algorithms

  2. VLSI designer is drawing schematics or designing layout He / she wishes to focus on a small portion of data by zooming in How to find efficiently the objects of interest? How to store the objects? How to tradeoff Memory size and query time? Range Search Algorithms

  3. A victim signal found to fail in silicon due to noise. We’d like to find the aggressors in layout. Range Search Algorithms

  4. Outline • 1D range search • 2D Kd-Tree • 2D Range Tree • Accelerating 2D Query Time • Layered Range Tree Range Search Algorithms

  5. 49 23 80 37 10 62 89 3 19 100 70 30 59 89 49 3 10 19 23 30 37 59 62 70 80 100 105 1D Range Tree Range Search Algorithms

  6. 1D Range Searching Range Search Algorithms

  7. 49 23 80 37 10 62 89 3 19 100 70 30 59 89 49 3 10 19 23 30 37 59 62 70 80 100 105 searching paths reported points Range Search Algorithms

  8. Range Search Algorithms

  9. Range Search Algorithms

  10. Range Search Algorithms

  11. Correctness of Query Algorithm Range Search Algorithms

  12. Range Search Algorithms

  13. Range Search Algorithms

  14. Range Search Algorithms

  15. y’’ p y(p) y’ x’ x(p) x’’ 2D Kd-Tree Ptop Key idea: splitting points in alternating directions Pright Pleft Pbottom Range Search Algorithms

  16. l5 l1 l3 l7 l6 l5 l2 l8 l9 l1 l4 l7 p4 p5 p9 p10 p2 l2 l3 p7 l8 p1 p8 p3 p6 l9 p9 p4 p8 p10 p3 p5 l4 l6 p6 p7 p1 p2 Vertical and horizontal splits are alternating. Points on split lines belong to lower left regions. Split ends when region contains one point. We assume without loss of generality that all coordinates are distinct. Range Search Algorithms

  17. Range Search Algorithms

  18. Construction Time and Storage Range Search Algorithms

  19. Range Search Algorithms

  20. l1 l1 l2 l2 l3 v l3 region (v) Querying Every internal node of Kd-tree stores a region of xy plane defined by the path to root. Regions are defined in O(1) time per node at construction. Range Search Algorithms

  21. l1 l1 l2 l2 l3 v l3 region (v) If node’s region is disjoint to a query rectangle, no point in node’s sub-tree satisfies the query. If query rectangle contains node’s region all points in node’s sub-tree satisfy the query. Otherwise search must proceed. Range Search Algorithms

  22. p4 p5 p12 p13 p2 p8 p10 p12 p4 p11 p13 p3 p5 p1 p11 p3 p9 p6 p1 p2 p7 p6 p7 p8 p9 p10 Range Search Algorithms

  23. Range Search Algorithms

  24. Range Search Algorithms

  25. Reminder of 1D Range Tree Objects are stored in leaves of balanced binary tree. Internal nodes store search directives. Starts search at root until node’s key falls in range. Left path is issued from forking node down to left end of range. All right sub-trees are reported. Similar for right path. Range Search Algorithms

  26. 2D Range Tree [x`,x``] × [y`,y``] is a range query. In 1D range tree P ( V ), the points stored at leaves of T(V), is called the canonical subset of V. P (root) is all points,P (leaf) is a single point. In 1D range tree points in [x`,x``] are obtained from O (log n) disjoint sub-trees (right sub-trees of left path and left sub-trees of right path). Hence [y`, y``] query further looks into P (V). Construct 2-level data structure: Binary search tree T built on x-coordinate of P. For any node V store P (V) in an associated binary tree Tassoc (V) built on y-coordinate of points. Range Search Algorithms

  27. Range Search Algorithms

  28. Range Search Algorithms

  29. p p p p Storage and Construction Time A point p is stored in log n associated trees. The size of associated tree (binary) is linear in number of stored points Associated trees at a level of primary tree are disjoint, hence total storage consumed at a level is O(n) Range Search Algorithms

  30. 2D range tree requires O(nlogn) storage Construction described in Build_2D_RangeTree is not efficient as it takes O(nlogn) time to build the associated trees, thus resulting in O(nlog2n) time. Total construction time can be reduced to O(nlogn) by pre-sorting of the points by y-coordinate and then building the 2D range tree bottom-up rather than top-down. Range Search Algorithms

  31. Range Search Algorithms

  32. Query Time Range Search Algorithms

  33. 3 10 19 23 30 37 59 62 70 80 100 105 A1 10 19 30 62 70 80 100 A2 Accelerating 2D Query Time S1 – set of objects ordered in array A1 S2 – subset of S1, ordered in array A2 Reporting objects of S1 in range 20to75 Find 23 by binary search, then traverse and report until 70 in O(logn+k)time Reporting objects from S2 can save binary search ! Every object in A1 points to the smallest object in A2 larger or equal to it. Use NIL if such one not exists. This is only O(k)time ! Range Search Algorithms

  34. 17 8 52 5 15 33 58 17 62 58 59 2 7 12 21 41 67 2 19 5 80 7 10 8 37 12 3 15 99 21 49 33 30 41 95 52 23 67 89 93 70 Observation: The canonical sub-set P(LSON[V]) and the canonical sub-set P(RSON[V]) are canonical sub-set of P(V) Range Search Algorithms

  35. Implementation • T is a range tree of P of n points. • P (V) is canonical point set stored in leaves of T(V) • Instead of storing P(V) in associated tree sorted by y-coordinate, it is stored in an array A(V) sorted by y-coordinate. • Each entry in A(V) maintains two pointers: • One to an entry in A(LSON[V]) (the smallest equal or larger) • One to an entry in A(RSON [V]) (the smallest equal or larger) • Reporting from node V is done directly from A(V) rather than by T(V) traversal. Range Search Algorithms

  36. 3 10 19 23 30 37 49 59 62 70 80 89 95 99 3 10 19 37 62 80 99 10 19 37 80 23 30 49 95 23 30 49 59 70 89 95 3 99 30 49 23 95 70 89 19 80 3 62 99 59 70 89 10 37 19 80 10 37 3 99 49 30 95 23 89 70 Layered Range Tree 62 59 Range Search Algorithms

  37. Performance of Layered Range Tree • [x`,x``]×[y`,y``] is a range query. • Perform x-range search on primary tree T to determine left and right paths down to leaves x` and x`` in O(logn) time. Points of canonical subsets adhere [x`,x``]. This takes O(logn). • We find in A[Vsplit] the smallest entry of [y`,y``] in O(logn) time. • Reports are made from A[V] in right nodes of left path and left node of right path. The smallest entry of [y`,y``] is found in constant time by the pointer to parents propagating up to Vsplit. Range Search Algorithms

  38. Report time per node is O(1+kV), yielding total O(logn+k) compared to O (log2n+k) in 2D range tree. • Storage is O(nlogn) same as 2D range tree. • Construction time is O(nlogn) as in 2D range tree. • Sort initially all objects by y-coordinate stored in an array with pointers to objects in primary binary tree T. • Every split to left and right sub-trees in T is followed by linear traversal of A (Vparent) and split into sorted A(Vleft) and A (Vright) according to the split made by x-coordinate in T. • Total work per level of T to construct all A(V) is O(n). Range Search Algorithms

More Related