Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spatial Indexing SAMs.

Similar presentations


Presentation on theme: "Spatial Indexing SAMs."— Presentation transcript:

1 Spatial Indexing SAMs

2 Spatial Indexing Point Access Methods can index only points. What about regions? Use the transformation technique Z-ordering and quadtrees New methods: Spatial Access Methods SAMs R-tree and variations

3 Problem Given a collection of geometric objects (points, lines, polygons, ...) organize them on disk, to answer spatial queries (range, nn, etc)

4 R-tree z-ordering: cuts regions to pieces -> dup. elim.
how could we avoid that? Idea: try to extend/merge B-trees and k-d trees R-tree: a generalization of the B+-tree for multidimensional spaces

5 Kd-Btrees [Robinson, 81]: if f is the fanout, split point-set in f parts; and so on, recursively

6 Kd-Btrees But: insertions/deletions are tricky (splits may propagate downwards and upwards) no guarantee on space utilization

7 R-trees [Guttman 84] Main idea: allow parents to overlap!
=> guaranteed 50% utilization => easier insertion/split algorithms. (only deal with Minimum Bounding Rectangles - MBRs)

8 R-trees A multi-way external memory tree
Index nodes and data (leaf) nodes All leaf nodes appear on the same level Every node contains between m and M entries The root node has at least 2 entries (children)

9 Example eg., w/ fanout 4: group nearby rectangles to parent MBRs; each group -> disk page I C A G F H B J E D

10 Example F=4 P1 P3 I C A G F H B J A B C H I J E P4 P2 D D E F G

11 Example F=4 P1 P3 I C A G F H B J E P4 P2 D P1 P2 P3 P4 A B C H I J D

12 R-trees - format of nodes
{(MBR; obj_ptr)} for leaf nodes P1 P2 P3 P4 x-low; x-high y-low; y-high ... obj ptr A B C ...

13 R-trees - format of nodes
{(MBR; node_ptr)} for non-leaf nodes x-low; x-high y-low; y-high ... node ptr P1 P2 P3 P4 ... A B C

14 R-trees:Search P1 P3 I C A G F H B J E P4 P2 D P1 P2 P3 P4 A B C H I J

15 R-trees:Search P1 P3 I C A G F H B J E P4 P2 D P1 P2 P3 P4 A B C H I J

16 R-trees:Search Main points:
every parent node completely covers its ‘children’ a child MBR may be covered by more than one parent - it is stored under ONLY ONE of them. (ie., no need for dup. elim.) a point query may follow multiple branches. everything works for any dimensionality

17 R-trees:Insertion Insert X P1 P3 I C A G F H B X J E P4 P2 D P1 P2 P3

18 R-trees:Insertion Insert Y P1 P3 I C A G F H B J Y E P4 P2 D P1 P2 P3

19 R-trees:Insertion Extend the parent MBR P1 P3 I C A G F H B J Y E P4

20 R-trees:Insertion How to find the next node to insert the new object?
Using ChooseLeaf: Find the entry that needs the least enlargement to include Y. Resolve ties using the area (smallest) Other methods (later)

21 R-trees:Insertion P1 K P3 I C A G W F H B J E P4 P2 D
If node is full then Split : ex. Insert w P1 K P3 I P1 P2 P3 P4 C A G W F H B J A B C K H I J E P4 P2 D D E F G

22 R-trees:Split (A1: plane sweep, until 50% of rectangles) P1 K
Split node P1: partition the MBRs into two groups. (A1: plane sweep, until 50% of rectangles) A2: ‘linear’ split A3: quadratic split A4: exponential split: 2M-1 choices P1 K C A W B

23 R-trees:Split seed2 R seed1 pick two rectangles as ‘seeds’;
assign each rectangle ‘R’ to the ‘closest’ ‘seed’ seed2 R seed1

24 R-trees:Split seed2 R seed1 pick two rectangles as ‘seeds’;
assign each rectangle ‘R’ to the ‘closest’ ‘seed’: ‘closest’: the smallest increase in area seed2 R seed1

25 R-trees:Split How to pick Seeds:
Linear:Find the highest and lowest side in each dimension, normalize the separations, choose the pair with the greatest normalized separation Quadratic: For each pair E1 and E2, calculate the rectangle J=MBR(E1, E2) and d= J-E1-E2. Choose the pair with the largest d

26 R-trees:Insertion Use the ChooseLeaf to find the leaf node to insert an entry E If leaf node is full, then Split, otherwise insert there Propagate the split upwards, if necessary Adjust parent nodes

27 R-Trees:Deletion Other method (later)
Find the leaf node that contains the entry E Remove E from this node If underflow: Eliminate the node by removing the node entries and the parent entry Reinsert the orphaned (other entries) into the tree using Insert Other method (later)

28 R-trees: Variations R+-tree: DO not allow overlapping, so split the objects (similar to z-values) R*-tree: change the insertion, deletion algorithms (minimize not only area but also perimeter, forced re-insertion ) Hilbert R-tree: use the Hilbert values to insert objects into the tree


Download ppt "Spatial Indexing SAMs."

Similar presentations


Ads by Google