Rtrees

download Rtrees

of 21

Transcript of Rtrees

  • 7/27/2019 Rtrees

    1/21

    R-TreesIndex Structures for Spatial Data

  • 7/27/2019 Rtrees

    2/21

    2301474R-Trees: Index Structures for Spartial Data2

    Outlines Spatial Applications Requirements for indexing spatial data

    Properties of R-trees

    Insertion Deletion

  • 7/27/2019 Rtrees

    3/21

    2301474R-Trees: Index Structures for Spartial Data3

    Spatial Applications Maps

    Google Earth

    Navigation Systems

    Computer Graphics

    Computer Aided Design

    Automobile design

    Interior design

  • 7/27/2019 Rtrees

    4/21

    2301474R-Trees: Index Structures for Spartial Data4

    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,

  • 7/27/2019 Rtrees

    5/21

    2301474R-Trees: Index Structures for Spartial Data5

    Concepts of R-Trees The minimum bounding

    rectangle (MBR) of an object isthe smallest box in the n-dimensional space boundingthe object.

    In an n-dimensional space, theindex of a set of spatial objectsis an n-dimensional boxbounding the set of objects.

    Bounding boxes are used asindices in R-trees.

    Similar to B+ trees, but indicesare allowed to be overlapped.

  • 7/27/2019 Rtrees

    6/21

    2301474R-Trees: Index Structures for Spartial Data6

    Properties of R-Trees

    An index record is composed of a bounding rectangle B, and

    a pointer to a child node or a

    pointer to a data record.

    Each node contains at most Mindex records.

    Non-root nodes contain between

    M/2 and M index records.

    The root node contains at least 2

    index records.

    R-trees are height-balanced.

    R

    R

    P

    PQ

    S

    Q S

  • 7/27/2019 Rtrees

    7/212301474R-Trees: Index Structures for Spartial Data7

    ExampleA B

    C D

    R

    F GE

    M N P QI J K LH

    A

    BC

    D

    F G

    EH

    IJ

    KL

    M

    NPQ

    R

  • 7/27/2019 Rtrees

    8/212301474R-Trees: Index Structures for Spartial Data8

    Query IA B

    C D

    R

    F GE

    M N P QI J K LH

    A

    BC

    D

    F G

    EH

    IJ

    KL

    M

    NPQ

    R

  • 7/27/2019 Rtrees

    9/212301474R-Trees: Index Structures for Spartial Data9

    Query IIA B

    C D

    R

    F GE

    M N P QI J K LH

    A

    BC

    D

    F G

    EH

    IJ

    KL

    M

    NPQ

    R

  • 7/27/2019 Rtrees

    10/212301474R-Trees: Index Structures for Spartial Data10

    Insertion

    Choose a leafnode

    Lto insertthe new record E.

    Different criteria for choosing

    the node.

    IF there is a room in L: THEN insert E in L.

    ELSE split L into L and L, with

    records in L and E.

    Add the index ofL in theparent ofL.

    4 5

    51 2 3 4

  • 7/27/2019 Rtrees

    11/212301474R-Trees: Index Structures for Spartial Data11

    Insertion

    4 551 2 3 4

  • 7/27/2019 Rtrees

    12/212301474R-Trees: Index Structures for Spartial Data12

    Insert without SplitA B

    C D

    R

    F GE

    M N P QI J K LH

    A

    BC

    D

    F G

    EH

    IJ

    K LM

    NPQ

    R

  • 7/27/2019 Rtrees

    13/212301474R-Trees: Index Structures for Spartial Data13

    Insert with SplitA B

    C D

    R

    F GE

    M N P QI J K LH

    A

    BC

    D

    F G

    EH

    IJ

    K LM

    NPQ

    R

    X Y

    X Y

  • 7/27/2019 Rtrees

    14/212301474R-Trees: Index Structures for Spartial Data14

    Splitting a Node

    Splitting can be propagated up the tree. If the root node is split, a new root node is created.

  • 7/27/2019 Rtrees

    15/212301474R-Trees: Index Structures for Spartial Data15

    SplittingA B

    C D

    R

    F GE

    N P QL M X Y

  • 7/27/2019 Rtrees

    16/212301474R-Trees: Index Structures for Spartial Data16

    SplittingA B

    C D

    R

    F GE

    N P QL MX Y

    E

  • 7/27/2019 Rtrees

    17/212301474R-Trees: Index Structures for Spartial Data17

    SplittingA B

    C D

    R

    F GE

    N P QL MX Y

    E

  • 7/27/2019 Rtrees

    18/212301474R-Trees: Index Structures for Spartial Data18

    SplittingA B

    C D

    R

    F GE

    N P QL MX Y

    E

    B

  • 7/27/2019 Rtrees

    19/212301474R-Trees: Index Structures for Spartial Data19

    Deletion

    Find the leaf node L containing the record E to bedeleted.

    Remove E from L. Set Q = {}.

    WHILE (E

    is not the root and has