Download R Trees

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
R-Trees
Index Structures for Spatial Data
Outlines
Spatial Applications
 Requirements for indexing spatial data
 Properties of R-trees
 Insertion
 Deletion

2
R-Trees: Index Structures for Spartial Data
2301474
Spatial Applications

Maps



3

Google Earth
Navigation Systems
Computer Aided Design


Automobile design
Interior design
Computer Graphics
R-Trees: Index Structures for Spartial Data
2301474
Requirements for Indexing Spatial Data

Support both point and region data.

Support data in 2-, 3-, 4-dimensional spaces.

Support spatial queries such as overlap, adjacent,
in, contain, to the north of, …
4
R-Trees: Index Structures for Spartial Data
2301474
Types of Spatial Data

Point Data
Points in a multidimensional space
 E.g., Raster data such as satellite imagery, where
each pixel stores a measured value
 E.g., Feature vectors extracted from text


Region Data
Objects have spatial extent with location and
Boundary
 DB typically uses geometric approximations
constructed using line segments, polygons, etc.,
called vector data.

5
II. Spatial Databases
2301474
Types of Spatial Queries

Spatial Range Queries




Nearest-Neighbor Queries



Find the 10 cities nearest to Madison
Results must be ordered by proximity
Spatial Join Queries


6
Find all cities within 50 miles of Madison
Query has associated region (location, boundary)
Answer includes ovelapping or contained data regions
Find all cities near a lake
Expensive, join condition involves regions and proximity
II. Spatial Databases
2301474
Applications of Spatial Data

Geographic Information Systems (GIS)




Computer-Aided Design/Manufacturing



Store spatial objects such as surface of airplane
fuselage
Range queries and spatial join queries are common
Multimedia Databases



7
E.g., ESRI’s ArcInfo; OpenGIS Consortium
Geospatial information
All classes of spatial queries and data are common
Images, video, text, etc. stored and retrieved by content
First converted to feature vector form; high
dimensionality
Nearest-neighbor queries are the most common
II. Spatial Databases
2301474
Single-Dimensional Indexes



B+ trees are fundamentally single-dimensional indexes.
When we create a composite search key B+ tree, e.g., an index
on <age, sal>, we effectively linearize the 2-dimensional space
since we sort entries first by age and then by sal.
Consider entries:
<11, 80>, <12, 10>
<12, 20>, <13, 75>
90
80
70
60
50
40
30
20
10
0
B+ tree
order
10
8
II. Spatial Databases
11
12
13
14
2301474
Concepts of R-Trees




9
The minimum bounding
rectangle (MBR) of an object is
the smallest box in the ndimensional space bounding
the object.
In an n-dimensional space, the
index of a set of spatial objects
is an n-dimensional box
bounding the set of objects.
Bounding boxes are used as
indices in R-trees.
Similar to B+ trees, but indices
are allowed to be overlapped.
R-Trees: Index Structures for Spartial Data
2301474
Properties of R-Trees

An index record is composed of




10
R
Q
P
S
Each node contains at most M
index records.


a bounding rectangle B, and
a pointer to a child node or a
pointer to a data record.
Non-root nodes contain between
M/2 and M index records.
The root node contains at least 2
index records.
Q
R S
R-trees are height-balanced.
R-Trees: Index Structures for Spartial Data
P
2301474
Example
A
H
C
D
I
J
A
B
E
K
D
L
P
Q
J
R
E
L
M
I
Q
P
F
11
N
K
H
C
M
G
F
N
R
G
R-Trees: Index Structures for Spartial Data
B
2301474
Query I
A
H
C
D
I
J
A
B
E
K
D
L
P
Q
J
R
E
L
M
I
Q
P
F
12
N
K
H
C
M
G
F
N
R
G
R-Trees: Index Structures for Spartial Data
B
2301474
Query II
A
H
C
D
I
J
A
B
E
K
D
L
P
Q
J
R
E
L
M
I
Q
P
F
13
N
K
H
C
M
G
F
N
R
G
R-Trees: Index Structures for Spartial Data
B
2301474
Insertion

Choose a leaf node L to insert
the new record E.


IF there is a room in L:



14
Different criteria for choosing
the node.
1
THEN insert E in L.
ELSE split L into L and L’, with
records in L and E.
4
2
3
5
4
5
Add the index of L’ in the
parent of L.
R-Trees: Index Structures for Spartial Data
2301474
Insertion
1
15
2
3
4
5
4
5
R-Trees: Index Structures for Spartial Data
2301474
Insert without Split
A
H
C
D
I
J
A
B
E
K
D
L
P
Q
J
R
E
L
M
I
Q
P
F
16
N
K
H
C
M
G
F
N
R
G
R-Trees: Index Structures for Spartial Data
B
2301474
Insert with Split
A
C
H
I
D
J
A
B
E
L
K
D
M
J
N
Q
P
L
X
R
E
Y
M
I
Q
P
F
17
Y
K
H
C
X
G
F
N
R
G
R-Trees: Index Structures for Spartial Data
B
2301474
Splitting a Node
Splitting can be propagated up the tree.
 If the root node is split, a new root node is created.

18
R-Trees: Index Structures for Spartial Data
2301474
Splitting
A
C
D
E
L
19
B
M
X
G
F
Y
N
R-Trees: Index Structures for Spartial Data
P
Q
R
2301474
Splitting
A
C
E’
D
L
20
B
X
E
M
G
F
Y
N
R-Trees: Index Structures for Spartial Data
P
Q
R
2301474
Splitting
A
C
E’
D
L
21
B
X
E
M
G
F
Y
N
R-Trees: Index Structures for Spartial Data
P
Q
R
2301474
Splitting
A
C
E’
D
L
22
B’
B
X
E
M
G
F
Y
N
R-Trees: Index Structures for Spartial Data
P
Q
R
2301474
Deletion
Find the leaf node L containing the record E to be
deleted.
 Remove E from L.
Set Q = {}.
 WHILE (E is not the root and has < m elements)

Remove the pointer to E from its parent node.
 Adjust the bounding rectangle of the parent of E.
 Set Q = Q U {E}, E=parent of E.


For each node N in Q

23
Re-insert all elements in N in the correct level.
R-Trees: Index Structures for Spartial Data
2301474
How to split
24
R-Trees: Index Structures for Spartial Data
2301474
Variations of R-trees
25
R-Trees: Index Structures for Spartial Data
2301474