Presentation is loading. Please wait.

Presentation is loading. Please wait.

May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty.

Similar presentations


Presentation on theme: "May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty."— Presentation transcript:

1 May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty

2 May 2012Range Search Algorithms2 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?

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

4 May 2012Range Search Algorithms4 Outline 1D range search 2D Kd-Tree 2D Range Tree Accelerating 2D Query Time Layered Range Tree

5 May 2012Range Search Algorithms5 1D Range Tree 59627080 89 100105 31019233037 49 10 37 6289 23 80 49 319 3059 70 100

6 May 2012Range Search Algorithms6 1D Range Searching

7 May 2012Range Search Algorithms7 59627080 89 100105 31019233037 49 10 37 6289 23 80 49 319 3059 70 100 searching paths reported points

8 May 2012Range Search Algorithms8

9 May 2012Range Search Algorithms9

10 May 2012Range Search Algorithms10

11 May 2012Range Search Algorithms11 Correctness of Query Algorithm

12 May 2012Range Search Algorithms12

13 May 2012Range Search Algorithms13

14 May 2012Range Search Algorithms14

15 May 2012Range Search Algorithms15 2D Kd-Tree Key idea: splitting points in alternating directions P right P left P bottom P top x’’ y’’ x’ y’ p y(p) x(p)

16 May 2012Range Search Algorithms16 l1l1 l2l2 l3l3 l4l4 l5l5 l7l7 l6l6 l8l8 l9l9 l4l4 l5l5 l6l6 l7l7 l2l2 l3l3 l1l1 p3p3 p2p2 p4p4 p5p5 p9p9 p7p7 p8p8 p6p6 p1p1 p 10 l8l8 p3p3 p5p5 p4p4 p8p8 p9p9 l9l9 p1p1 p6p6 p7p7 p2p2 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.

17 May 2012Range Search Algorithms17

18 May 2012Range Search Algorithms18 Construction Time and Storage

19 May 2012Range Search Algorithms19

20 May 2012Range Search Algorithms20 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. l1l1 l2l2 l3l3 region (v) v l1l1 l2l2 l3l3

21 May 2012Range Search Algorithms21 If node’s region is disjoint to a query rectangle, no point in node’s sub-tree satisfies the query. l1l1 l2l2 l3l3 region (v) v l1l1 l2l2 l3l3 If query rectangle contains node’s region all points in node’s sub-tree satisfy the query. Otherwise search must proceed.

22 May 2012Range Search Algorithms22 p 13 p 11 p 12 p3p3 p5p5 p4p4 p1p1 p6p6 p2p2 p8p8 p7p7 p 10 p9p9 p3p3 p2p2 p4p4 p5p5 p 12 p8p8 p 11 p7p7 p1p1 p 13 p 10 p9p9 p6p6

23 May 2012Range Search Algorithms23

24 May 2012Range Search Algorithms24

25 May 2012Range Search Algorithms25 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.

26 May 2012Range Search Algorithms26 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 T assoc (V) built on y-coordinate of points.

27 May 2012Range Search Algorithms27

28 May 2012Range Search Algorithms28

29 May 2012Range Search Algorithms29 Storage and Construction Time p p p p 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)

30 May 2012Range Search Algorithms30 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(nlog 2 n) 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.

31 May 2012Range Search Algorithms31

32 May 2012Range Search Algorithms32 Query Time

33 May 2012Range Search Algorithms33 Accelerating 2D Query Time 3101923303759627080100105 A1A1 101930627080100 A2A2 S 1 – set of objects ordered in array A 1 S 2 – subset of S 1, ordered in array A 2 Reporting objects of S 1 in range 20 to 75 Find 23 by binary search, then traverse and report until 70 in O(logn+k) time Reporting objects from S 2 can save binary search ! Every object in A 1 points to the smallest object in A 2 larger or equal to it. Use NIL if such one not exists. This is only O(k) time !

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

35 May 2012Range Search Algorithms35 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.

36 May 2012Range Search Algorithms36 Layered Range Tree 23305949708995310193762809910193780362995970892330499510371980 62 39930492395 59 7089310231930375949627089809599 19803710399304995238970

37 May 2012Range Search Algorithms37 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[V split ] 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 V split.

38 May 2012Range Search Algorithms38 Report time per node is O(1+k V ), yielding total O(logn+k) compared to O (log 2 n+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 (V parent ) and split into sorted A(V left ) and A (V right ) according to the split made by x-coordinate in T. –Total work per level of T to construct all A(V) is O(n).


Download ppt "May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty."

Similar presentations


Ads by Google