R-trees (data structure)

Post on 11-May-2015

268 views 0 download

Tags:

Transcript of R-trees (data structure)

WELCOME

R-TREES By:

Mahe Samrin FirdousM.E Software Engineering(1st Sem)

“A Dynamic Index Structure For Spatial Searching”.

The B-Tree provided a foundation for R-Trees

Region-Trees (R-Trees)

What are R-Trees?

What we mean by Spatial Data?

R1

R2

R1 R2

R3 R4 R5

R3R4

R5

R6

R7

R6 R7

R8

R9

R10

R8 R9 R10

R13R14

R13 R14

R15R16

R15 R16

Why do we need R-Trees?

B-Trees cannot store new types of data

Specifically people wanted to store geometrical data and multi-dimensional data

The R-Tree provided a way to do that (thanks to Antonin Guttman ‘84)

Allows Overlapping.

Properties of R-Trees

R-Trees can organize any-dimensional data by representing the data by a minimum bounding region(MBR).

Each node bounds it’s children. The leaves point to the actual objects

(stored on disk pages) The height is always log n. It is height

balanced. Root has at least two children

R-Tree of Order 4

R-Tree of Order 4

Example

a

b

cd

m

a b c d e f g h i j k l

m n o p

a

b

cd

me fn

Examplea b c d e f g h i j k l

m n o p

a

b

cd

me fn

h

g

i

o p

Examplea b c d e f g h i j k l

m n o p

j

kl

R-Trees: OperationsInserts

Deletes

Search

Queries/Searches Names of all the roads in 1 sq km area?Which buildings would be encountered between JU

1st Campus and JU 2nd Campus? Give me all rectangles that are contained in the

input rectangle.Give me all rectangles intersecting this rectangle.

Insert.

• Similar to insertion into B+-tree but may insert into any leaf; leaf splits in case capacity exceeded.

–Which leaf to insert into? (Choose Leaf)–How to split a node? (Node Split)

mn

o p

Insert: Choose Leaf

mn

o

Insert: Choose Leaf

17

Node Splitting

ab

c

d

ab

c

d

Bad split

Good split

Example:INSERTION

Example:INSERTION

Example:INSERTION

Delete

• Search for the rectangle• If the rectangle is found, remove it.• Adjust the rectangles making them

smaller.• If the node is too empty (deficient): • delete the node recursively at its parent • insert all entries of the deleted node into the R-tree

Re-use of INSERT routine Incrementally refines spatial structure

SEARCH

Similar to B-tree searchQuite easy & straight forward (Traverse the whole tree starting at the root node)No guarantee on good worst-case performance! (Possible overlapping of rectangles of entries within a single node!). Again, dependent on geometries.

Average case-O(logMn)

R-TREE VARIATIONS

• R+ trees differ from R trees in that:– No overlapping– An object ID may be stored in more than one leaf node.

• Advantages– Search is easier.– A fewer nodes are visited than with the R-tree.

• Disadvantages– Since rectangles are duplicated, it is larger than R tree.– Construction & maintenance is more complex.

R-Tree MBRs

R+-Tree MBRs

R+-TREE:

Applications of R-Trees

• Data objects in the map are represented by the Minimum Bounding Rectangles (MBRs)

R-TREE in MAPS:

VLSI DesignThe initial application that motivated Guttman to his pioneering research was VLSI design (i.e., how to efficiently answer whether a space is already covered by a chip or not).

A VLSI integrated-circuit

Image Replica Detection The system extracts robust features from images. These features are used for indexing the images in a database using an R-tree. When a query is made about whether a test image is a replica of an image in the database, then the R-tree is traversed.

Original Fingerprint image (left side) and a fake finger (right side), almost indistinguishable.

Template of the pores and search along ridges.

Fingerprint image (a) where pores can be easily noticed as small “holes” along ridges flow (as evident in the zoom (b)).

(a)

Image Replica Detection (b)

Astronomical Data Indexing In astronomical data collections, there are many data that can be thought of as points in a multi-dimensional space and are then suitable to be indexed using R-trees .Coordinates on the sky can be (and often are) represented in a database as ordered couples of longitude and latitude.

R-Trees in Road MapA common example of spatial data can be seen in a road map. Spatial data lets you use R-tree indexing .A road map is a two-dimensional object that contains points, lines, and polygons that can represent cities, roads, and political boundaries such as states or provinces.

Commercial uses of R-Trees

Biometric Attendance Machine Supplier: Divya, Affinis Technosoft, Excellex, JB Systems, Sterling Securities, Dotway Technologies, Sofgen India ,etc

Virtual Sky Application Virtual Sky Astronomy for iPad, iPhones on the App Store.

In many scientific applications such as Earth Observation System (EOSDIS) it is a daunting task to index ever increasing volume of complex data that are continuously added to databases. To efficiently manage multidimensional data in scientific and data warehousing environments, R-tree based index structures have been widely used

NASA’s earth observing mission

thank you!!!

Any questions?

??