R-Trees Albert-Jan Yzelman October 22, 2007 Albert-Jan Yzelman - - PowerPoint PPT Presentation

r trees
SMART_READER_LITE
LIVE PREVIEW

R-Trees Albert-Jan Yzelman October 22, 2007 Albert-Jan Yzelman - - PowerPoint PPT Presentation

R-Trees R-Trees Albert-Jan Yzelman October 22, 2007 Albert-Jan Yzelman R-Trees > Introduction Outline R-trees Introduction 1 Basics 2 Tree Construction 3 Conclusions 4 Albert-Jan Yzelman R-Trees > Introduction Background


slide-1
SLIDE 1

R-Trees

R-Trees

Albert-Jan Yzelman October 22, 2007

Albert-Jan Yzelman

slide-2
SLIDE 2

R-Trees > Introduction

Outline

R-trees

1

Introduction

2

Basics

3

Tree Construction

4

Conclusions

Albert-Jan Yzelman

slide-3
SLIDE 3

R-Trees > Introduction

Background Internship at Alten Nederland, started the ”R-tree Project” In close cooperation with Shell Exploration & Production

Albert-Jan Yzelman

slide-4
SLIDE 4

R-Trees > Introduction

Background Internship at Alten Nederland, started the ”R-tree Project” In close cooperation with Shell Exploration & Production Goals:

Albert-Jan Yzelman

slide-5
SLIDE 5

R-Trees > Introduction

Background Internship at Alten Nederland, started the ”R-tree Project” In close cooperation with Shell Exploration & Production Goals:

1

Create a datastructure which will enhance Shell’s oil reservoir simulation software

Albert-Jan Yzelman

slide-6
SLIDE 6

R-Trees > Introduction

Background Internship at Alten Nederland, started the ”R-tree Project” In close cooperation with Shell Exploration & Production Goals:

1

Create a datastructure which will enhance Shell’s oil reservoir simulation software

2

Obtain a generic, customisable R-tree software library for using R-trees in many other areas

Albert-Jan Yzelman

slide-7
SLIDE 7

R-Trees > Introduction

People involved Arno Swart (consultant from Alten, working at Shell; direct supervisor) Gerard Sleijpen (supervisor from Utrecht University)

Albert-Jan Yzelman

slide-8
SLIDE 8

R-Trees > Introduction

People involved Arno Swart (consultant from Alten, working at Shell; direct supervisor) Gerard Sleijpen (supervisor from Utrecht University) Eric Haesen (manager from Alten Nederland) Hans Molenaar (manager from Shell E&P)

Albert-Jan Yzelman

slide-9
SLIDE 9

R-Trees > Introduction

People involved Arno Swart (consultant from Alten, working at Shell; direct supervisor) Gerard Sleijpen (supervisor from Utrecht University) Eric Haesen (manager from Alten Nederland) Hans Molenaar (manager from Shell E&P) Many Alten consultants; Guy Calluy, Ron van Kesteren, Martijn Souman, Petr Sereda

Albert-Jan Yzelman

slide-10
SLIDE 10

R-Trees > Introduction

Shell’s oil reservoir simulation software; Dynamo Numerical modelling of oil reservoirs Simulates effects of, for example, well drilling at different locations

Albert-Jan Yzelman

slide-11
SLIDE 11

R-Trees > Basics

Outline

R-trees

1

Introduction

2

Basics

3

Tree Construction

4

Conclusions

Albert-Jan Yzelman

slide-12
SLIDE 12

R-Trees > Basics

Discretisation An oil reservoir discretisation (or grid) to work with is required for (FVM) simulation

Albert-Jan Yzelman

slide-13
SLIDE 13

R-Trees > Basics

Discretisation An oil reservoir discretisation (or grid) to work with is required for (FVM) simulation Grid extraction is done externally, by companies like Petrel; grid data thus is read in from externally supplied files

Albert-Jan Yzelman

slide-14
SLIDE 14

R-Trees > Basics

Discretisation An oil reservoir discretisation (or grid) to work with is required for (FVM) simulation Grid extraction is done externally, by companies like Petrel; grid data thus is read in from externally supplied files Such a grid is irregularly shaped, due to the many different ground layers and so called fault lines in the reservoir area

Albert-Jan Yzelman

slide-15
SLIDE 15

R-Trees > Basics

Example grid

Figure: Example oil reservoir grid

Albert-Jan Yzelman

slide-16
SLIDE 16

R-Trees > Basics

Grid operations The simulation software and grid upscaling software included in Dynamo require efficient answers to at least the following types of queries: Point Line Box The irregular input grids and the geometric nature of querying call for a specialised data structure.

Albert-Jan Yzelman

slide-17
SLIDE 17

R-Trees > Basics

Example data

Albert-Jan Yzelman

slide-18
SLIDE 18

R-Trees > Basics

Point query

Albert-Jan Yzelman

slide-19
SLIDE 19

R-Trees > Basics

Point query

Albert-Jan Yzelman

slide-20
SLIDE 20

R-Trees > Basics

Point query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄

Albert-Jan Yzelman

slide-21
SLIDE 21

R-Trees > Basics

Line query

Albert-Jan Yzelman

slide-22
SLIDE 22

R-Trees > Basics

Line query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆

Albert-Jan Yzelman

slide-23
SLIDE 23

R-Trees > Basics

Box query

Albert-Jan Yzelman

slide-24
SLIDE 24

R-Trees > Basics

Box query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄

Albert-Jan Yzelman

slide-25
SLIDE 25

R-Trees > Basics

Data structure demands:

Albert-Jan Yzelman

slide-26
SLIDE 26

R-Trees > Basics

Data structure demands: Can store d-dimensional hypercubes

Albert-Jan Yzelman

slide-27
SLIDE 27

R-Trees > Basics

Data structure demands: Can store d-dimensional hypercubes Performs point, line, and box queries as fast as possible...

Albert-Jan Yzelman

slide-28
SLIDE 28

R-Trees > Basics

Data structure demands: Can store d-dimensional hypercubes Performs point, line, and box queries as fast as possible... ...but also keeps memory usage in check!

Albert-Jan Yzelman

slide-29
SLIDE 29

R-Trees > Basics

R-tree ingredients:

1 Tree-like data structure 2 Minimal Bounding Rectangles (MBRs) Albert-Jan Yzelman

slide-30
SLIDE 30

R-Trees > Basics

(1) The tree data structure

Root node Internal node Leaf node Height

Albert-Jan Yzelman

slide-31
SLIDE 31

R-Trees > Basics

(2) Minimum Bounding Rectangle (MBR)

Figure: A two-dimensional object

Albert-Jan Yzelman

slide-32
SLIDE 32

R-Trees > Basics

(2) Minimum Bounding Rectangle (MBR)

Figure: A two-dimensional object with its MBR

Albert-Jan Yzelman

slide-33
SLIDE 33

R-Trees > Basics

(2) Minimum Bounding Rectangle (MBR)

Figure: Multiple objects

Albert-Jan Yzelman

slide-34
SLIDE 34

R-Trees > Basics

(2) Minimum Bounding Rectangle (MBR)

Figure: Multiple objects contained in their MBR

Albert-Jan Yzelman

slide-35
SLIDE 35

R-Trees > Basics

(2) Minimum Bounding Rectangle (MBR)

Figure: Multiple MBRs

Albert-Jan Yzelman

slide-36
SLIDE 36

R-Trees > Basics

(2) Minimum Bounding Rectangle (MBR)

Figure: Multiple MBRs contained in another MBR

Albert-Jan Yzelman

slide-37
SLIDE 37

R-Trees > Basics

R-trees We can let each node of a tree correspond to an MBR and obtain the so called R-trees.

Albert-Jan Yzelman

slide-38
SLIDE 38

R-Trees > Basics

R-trees We can let each node of a tree correspond to an MBR and obtain the so called R-trees. Let each internal node of the R-tree correspond to the MBR of all MBRs stored in the children of that internal node

Albert-Jan Yzelman

slide-39
SLIDE 39

R-Trees > Basics

R-trees We can let each node of a tree correspond to an MBR and obtain the so called R-trees. Let each internal node of the R-tree correspond to the MBR of all MBRs stored in the children of that internal node Let each leaf node of the R-tree correspond to the MBR of a single object stored in the R-tree

Albert-Jan Yzelman

slide-40
SLIDE 40

R-Trees > Basics

R-trees

Albert-Jan Yzelman

slide-41
SLIDE 41

R-Trees > Basics

R-trees

Albert-Jan Yzelman

slide-42
SLIDE 42

R-Trees > Basics

R-trees

Albert-Jan Yzelman

slide-43
SLIDE 43

R-Trees > Basics

R-trees

Albert-Jan Yzelman

slide-44
SLIDE 44

R-Trees > Basics

Further R-tree properties Each node contains between m and M children All leaves are on the same tree level

Albert-Jan Yzelman

slide-45
SLIDE 45

R-Trees > Basics

Demonstration of a line query

Albert-Jan Yzelman

slide-46
SLIDE 46

R-Trees > Basics

Demonstration of a line query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁

Albert-Jan Yzelman

slide-47
SLIDE 47

R-Trees > Basics

Demonstration of a line query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄

Albert-Jan Yzelman

slide-48
SLIDE 48

R-Trees > Basics

Demonstration of a line query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆

Albert-Jan Yzelman

slide-49
SLIDE 49

R-Trees > Basics

Demonstration of a line query

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆

Albert-Jan Yzelman

slide-50
SLIDE 50

R-Trees > Basics

Asymptotic query time tquery ≤ c · logm n, n → ∞ = O(log n) Because: the tree is tallest when each internal node has precisely m children, and the tree is balanced.

Albert-Jan Yzelman

slide-51
SLIDE 51

R-Trees > Tree Construction

Outline

R-trees

1

Introduction

2

Basics

3

Tree Construction

4

Conclusions

Albert-Jan Yzelman

slide-52
SLIDE 52

R-Trees > Tree Construction

Actively researched R-tree variations: The original R-tree, introduced in 1984 Top-down Greedy Split (TGS) Hilbert R-tree Hilbert TGS

Albert-Jan Yzelman

slide-53
SLIDE 53

R-Trees > Tree Construction

Grouping criteria

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞

Figure: Four to-be grouped MBRs

Albert-Jan Yzelman

slide-54
SLIDE 54

R-Trees > Tree Construction

Grouping criteria

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞

Figure: Minimum overlap criteria

Albert-Jan Yzelman

slide-55
SLIDE 55

R-Trees > Tree Construction

Grouping criteria

✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✁ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✂ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ✄ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ☎ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✝ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞

Figure: Minimum total volume criteria

Albert-Jan Yzelman

slide-56
SLIDE 56

R-Trees > Tree Construction

Original dynamic R-tree We start out with an empty R-tree and insert new objects one-by-one. For this we need an insertion algorithm which works on arbitrary R-trees. Consider the following example with m = 2 and M = 3.

Albert-Jan Yzelman

slide-57
SLIDE 57

R-Trees > Tree Construction

Original dynamic R-tree

Albert-Jan Yzelman

slide-58
SLIDE 58

R-Trees > Tree Construction

Original dynamic R-tree

Albert-Jan Yzelman

slide-59
SLIDE 59

R-Trees > Tree Construction

Original dynamic R-tree

Albert-Jan Yzelman

slide-60
SLIDE 60

R-Trees > Tree Construction

Original dynamic R-tree

Albert-Jan Yzelman

slide-61
SLIDE 61

R-Trees > Tree Construction

Original dynamic R-tree Differences in overflow handling yield the linear, quadratic and the polynomial R-tree variants. Consider the following example with m = 2 and M = 3.

Albert-Jan Yzelman

slide-62
SLIDE 62

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-63
SLIDE 63

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-64
SLIDE 64

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-65
SLIDE 65

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-66
SLIDE 66

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-67
SLIDE 67

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-68
SLIDE 68

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-69
SLIDE 69

R-Trees > Tree Construction

Overflow handling: linear splitting

Albert-Jan Yzelman

slide-70
SLIDE 70

R-Trees > Tree Construction

Top-down Greedy Split (TGS) Observation: Query efficiency is determined top-down by the shape of the bounding boxes Why not build the R-tree top-down?

Albert-Jan Yzelman

slide-71
SLIDE 71

R-Trees > Tree Construction

Top-down Greedy Split (TGS) Uses an collection of orderings S. Subdivide the input set into a maximum of M subsets each containing no more than ˜ n elements: With respect to each ordering in S, subdivide the input set into groups of ˜ n elements Find the best binary split with repect to all s ∈ S Recursively split both groups until all groups contain less than m elements So either we sort |S| times to find this best binary split, or we duplicate the input set |S| times

Albert-Jan Yzelman

slide-72
SLIDE 72

R-Trees > Tree Construction

Top-down Greedy Split (TGS)

n=28, M=3, and so: h=4

Albert-Jan Yzelman

slide-73
SLIDE 73

R-Trees > Tree Construction

Top-down Greedy Split (TGS)

n=26, M=3, and so: h=3 at the first tree level, each subtree of height h−1=2 may contain 3^2=9 elements x x y y

Albert-Jan Yzelman

slide-74
SLIDE 74

R-Trees > Tree Construction

Top-down Greedy Split (TGS)

n=26, M=3, and so: h=3 at the first tree level, each subtree of height h−1=2 may contain 3^2=9 elements x x y

Albert-Jan Yzelman

slide-75
SLIDE 75

R-Trees > Tree Construction

Top-down Greedy Split (TGS)

n=26, M=3, and so: h=3 at the first tree level, each subtree of height h−1=2 may contain 3^2=9 elements At the second tree level, each subtree of height h−2=1 may contain 3 elements

Albert-Jan Yzelman

slide-76
SLIDE 76

R-Trees > Tree Construction

Random TGS For each of the K times divide some set in two, we sort |S| times:      c11 c21 · · · c|S|1 c12 c22 · · · c|S|2 . . . ... . . . c1M c2M · · · c|S|M     

Albert-Jan Yzelman

slide-77
SLIDE 77

R-Trees > Tree Construction

Ordering on MBRs It would be useful to have an ordering on MBRs where: X < Y < Z (1) Would imply that X is closer to Y than to Z.

Albert-Jan Yzelman

slide-78
SLIDE 78

R-Trees > Tree Construction

Ordering on MBRs

A B C D A < B < C < D E F E=max(A,B) < F=max(C,D) G G=max(E,F)

Albert-Jan Yzelman

slide-79
SLIDE 79

R-Trees > Tree Construction

Ordering on MBRs Let us use the centre coordinate of MBRs for ordering. This is trivial in one dimension; x < y, with x, y ∈ ❘ is well-defined.

Albert-Jan Yzelman

slide-80
SLIDE 80

R-Trees > Tree Construction

Ordering on MBRs Let us use the centre coordinate of MBRs for ordering. But for a higher number of dimensions d ∈ ◆, d > 1:

  • x <

y, with x, y ∈ ❘d is not well-defined.

Albert-Jan Yzelman

slide-81
SLIDE 81

R-Trees > Tree Construction

Ordering on MBRs To solve this, we find a mapping: h : ❘d → ❘ by using the Hilbert curve.

Albert-Jan Yzelman

slide-82
SLIDE 82

R-Trees > Tree Construction

Ordering on MBRs

Figure: First-order Hilbert curve

Albert-Jan Yzelman

slide-83
SLIDE 83

R-Trees > Tree Construction

Ordering on MBRs

Figure: Recursion of the Hilbert curve

Albert-Jan Yzelman

slide-84
SLIDE 84

R-Trees > Tree Construction

Ordering on MBRs

Figure: Second-order Hilbert curve

Albert-Jan Yzelman

slide-85
SLIDE 85

R-Trees > Tree Construction

Ordering on MBRs

Figure: Third-order Hilbert curve

Albert-Jan Yzelman

slide-86
SLIDE 86

R-Trees > Tree Construction

Ordering on MBRs Map points in ❘d to a point y ∈ ❘d on the nth order Hilbert curve Calculate the distance d =

i 2dn of y on the nth order Hilbert curve

Write hn(x) = d =

i 2dn for the nth order Hilbert coordinate

transform of x ❘

Albert-Jan Yzelman

slide-87
SLIDE 87

R-Trees > Tree Construction

Ordering on MBRs Map points in ❘d to a point y ∈ ❘d on the nth order Hilbert curve Calculate the distance d =

i 2dn of y on the nth order Hilbert curve

Write hn(x) = d =

i 2dn for the nth order Hilbert coordinate

transform of x The true Hilbert coordinate transform h is then defined by: h(x) = lim

n→∞ hn(x),

x ∈ ❘d

Albert-Jan Yzelman

slide-88
SLIDE 88

R-Trees > Tree Construction

Ordering on MBRs In software calculation we use instead: ˜ h(x) = c 2dn where c is the cell number containing x.

Albert-Jan Yzelman

slide-89
SLIDE 89

R-Trees > Tree Construction

Hilbert R-tree Invariants: Each leaf node stores the Hilbert coordinate of the centre coordinate of the MBR of the object stored there Each internal node stores the maximum Hilbert coordinate value hmax found at its children

Albert-Jan Yzelman

slide-90
SLIDE 90

R-Trees > Tree Construction

Hilbert R-tree Invariants: Each leaf node stores the Hilbert coordinate of the centre coordinate of the MBR of the object stored there Each internal node stores the maximum Hilbert coordinate value hmax found at its children Insertion: Get the Hilbert coordinate h of the MBR of the new object to-be inserted Find the deepest internal node v with the smallest hmax larger than h and insert the new object there Update the hmax value at the v and all its parent nodes Check if v overflows

Albert-Jan Yzelman

slide-91
SLIDE 91

R-Trees > Tree Construction

Hilbert R-tree: overflow handling When a single internal node v overflows:

0.8 0.3 0.5 0.8 0.7 0.7 0.8 0.8 0.8 0.5 0.3 0.5

Figure: Overflow handling when there are no neighbour nodes

Albert-Jan Yzelman

slide-92
SLIDE 92

R-Trees > Tree Construction

Hilbert R-tree: overflow handling When a single internal node v overflows:

0.4 0.8 0.8 0.8 0.5 0.8 0.3 0.5 0.4 0.7 0.8 0.8 0.1 0.7 0.5 0.4 0.1 0.3

Figure: Overflow handling when there is a non-full neighbour

Albert-Jan Yzelman

slide-93
SLIDE 93

R-Trees > Tree Construction

Hilbert Top-down Greedy Split Like normal TGS, but with S containing only the Hilbert coordinate based ordering.

Albert-Jan Yzelman

slide-94
SLIDE 94

R-Trees > Conclusions

Outline

R-trees

1

Introduction

2

Basics

3

Tree Construction

4

Conclusions

Albert-Jan Yzelman

slide-95
SLIDE 95

R-Trees > Conclusions

Experiments Some variations have been implemented in C++. The resulting library recently went public as an open-source project: http://www.sourceforge.net/projects/rtree-lib Applied to datasets supplied by Shell we obtained the following experimental results.

Albert-Jan Yzelman

slide-96
SLIDE 96

R-Trees > Conclusions

Experiments: construction time

10

3

10

4

10

5

10

6

10

7

10 10

1

10

2

10

3

10

4

10

5

10

6

Number of grid elements Building time (in processor ticks) Grid size vs. building time Bisection tree. 2/4 RandomTGS bulk−loaded basic R−tree. 2/4 HilbertTGS bulk−loaded basic R−tree.

Albert-Jan Yzelman

slide-97
SLIDE 97

R-Trees > Conclusions

Experiments: point query time

10

2

10

3

10

4

10

5

10

6

10

7

10

−5

10

−4

10

−3

10

−2

10

−1

10 Number of grid elements Average required time per point query (in seconds) Grid size vs. query time −− point query Bisection tree. 2/4 RandomTGS bulk−loaded basic R−tree. 2/4 HilbertTGS bulk−loaded basic R−tree.

Albert-Jan Yzelman

slide-98
SLIDE 98

R-Trees > Conclusions

Experiments: line query time

10

2

10

3

10

4

10

5

10

6

10

7

10

−4

10

−3

10

−2

10

−1

10 10

1

Number of grid elements Average required time per line query (in seconds) Grid size vs. query time −− line query Bisection tree. 2/4 RandomTGS bulk−loaded basic R−tree. 2/4 HilbertTGS bulk−loaded basic R−tree.

Albert-Jan Yzelman

slide-99
SLIDE 99

R-Trees > Conclusions

Experiments: box query time

10

2

10

3

10

4

10

5

10

6

10

7

10

−4

10

−3

10

−2

10

−1

10 10

1

10

2

Number of grid elements Average required time per box query (in seconds) Grid size vs. query time −− box query Bisection tree. 2/4 RandomTGS bulk−loaded basic R−tree. 2/4 HilbertTGS bulk−loaded basic R−tree.

Albert-Jan Yzelman

slide-100
SLIDE 100

R-Trees > Conclusions

Other query types: k-nn query (implemented) Hyperplane query (not implemented)

10

2

10

3

10

4

10

5

10

6

10

7

10

−3

10

−2

10

−1

10 10

1

10

2

Number of grid elements Average required time per knn query (in seconds) Grid size vs. query time −− knn query Bisection tree. 2/4 RandomTGS bulk−loaded basic R−tree. 2/4 HilbertTGS bulk−loaded basic R−tree.

Figure: knn query time

Albert-Jan Yzelman

slide-101
SLIDE 101

R-Trees > Conclusions

Possible other application areas: Databases Graphics/Gaming Chip Design Navigation Systems Image Processing ...?

Albert-Jan Yzelman

slide-102
SLIDE 102

R-Trees > Conclusions

Questions?

Albert-Jan Yzelman