Back to index
R-Trees: A Dynamic Index Structure for Spatial Searching
Antonin Guttman
University of California, Berkeley
Scribe: Zuyu Zhang
Overview/Main Points
- Problem
- Given a collection of two-dimension rectangles, find all rectangles that overlap a given rectangle.
- Why cannot B-tree do this?
- B-tree has two properties.
- a short, flat tree with 2 or 3 levels to reduce # of nodes during search.
- balanced.
- B-tree is a one-dimension index data structure with one pass scan.
- Two B-tree indices with multiple lookups? Too complicated and too many IO for both index and data pages! We could have a better solution than B-trees.
- n-dimension index with multiple lookup? No.
- Another question: Intersections between a collection of set value?
- R-Tree, an index mechanism in a spatial database
- A height-balanced tree with index records in its leaf nodes containing pointers to data objects.
- Let M be max entries that fit on a node, and m ≤ M ⁄ 2 be a specified minimum.
- Each leaf node contains between m and M entries (unless it is root).
- For each index record (I, tid) in a leaf, I is the smallest rectangle that contains that data object represented in the tuple with id “ tid ”.
- Every non-leaf node has between m and M entries (unless it is root).
- For each entry (I, tid), I is the smallest rectangle that contains all rectangles in the child node.
- The root has at least 2 children (unless it is leaf).
- All leaves appear at the same level.
- Each rectangle appears once and only once in the tree.
- Each entry has two elements: E.I and E.p.
- To find all entries that overlap a search rectangle S in an R-tree with root T.
- If T is not a leaf, check each entry E to see if E.I overlaps S. For all overlapping entries E, search on E.p.
- If T is a leaf, check all entries E to determine if E.I overlaps S.
- Insert E into an R-tree
- Invoke ChooseLeaf to select leaf node L in which to place I.
- If L has room, install E. Otherwise, invoke SplitNode to obtain L & LL containing E & all the old entries of L.
- Invoke AdjustTree on L, also passing LL if there was a split.
- If split caused the root to split, add a new root.
- ChooseLeaf
- Set N to be root.
- If N is a leaf, return.
- If N is not a leaf, let F be the entry in N whose rectangle F.I needs the least enlargement to include E.I. Break ties by choosing the smallest rectangle.
- Set N to be the child node pointed to by F.p & go to 2.
- SplitNode
- Goal is to minimise the sum of resulting areas.
- CC on R-tree: no split but have to adjust tree
- AdjustTree // after insertion in Leaf L
- Set N to be L. If L was split, set NN to be the new second node.
- If N is the root, stop.
- Let P be the parent of N, & EN be N's entry in P. Adjust EN.I so that it tightly encloses all rectangles in N.
- If N was split, create a new entry ENN.P pointing to NN, & ENN.I enclosing all rectangles in NN. Add ENN to P if there is room; if not, invoke SplitNode to produce P & PP containing ENN & all P's entries.
- Set N to be P, & NN to be PP if a split occured. Goto 2.
- Comparing with B-trees
- Two-dimension index only has two choices
- R-tree
- Search multiple paths
- No replication of entries
- R*-tree
- Search on path
- Replicates entries
Relevance
Flaws