R-Trees for Indexing Multidimensional Data

An R-tree is a data structure used to index multidimensional data in database systems for spatial queries. Branches in an R-tree maintain a minimum bounding rectangle of all the child branches and nodes. Queries against the R-tree traverse the tree by performing relatively inexpensive intersection operations against the minimum bounding rectangles. On the top, you can see the data and the minimum bounding rectangles containing the data. On the bottom, you can see the tree itself. Clicking anywhere in the panel at the top adds new data points to the tree. Hover over a node in the tree to see its label. Clicking a branch in the tree highlights the minimum bounding rectangle to which it corresponds.


  • [Snapshot]
  • [Snapshot]


The R-tree was first proposed by Guttman in 1984. It is used in many spatial database systems, including PostGIS and JTS, to efficiently index and query multidimensional data. R-trees create a hierarchical decomposition of the data space that minimizes the area of rectangles needed to group the data. Each branch in an R-tree maintains a minimum bounding rectangle for all of the children of that branch, including sub-branches and data elements. Each node in an R-tree has a configurable maximum number of elements. The insertion algorithm requires that nodes be split when they are full. There are multiple optimal splitting techniques. The one used in this Demonstration is the quadratic cost splitting criterion, which trades off speed for optimality. A split could cause splits to propagate up the tree. When this happens, the tree grows at the root to accommodate the new data. R-trees are particularly suited for computing results for nearest-neighbor queries. As such, they are effective for performing rough clustering of multidimensional data in a machine-learning algorithm.
[1] A. Guttman, "R-Trees: A Dynamic Index Structure for Spatial Searching," Proceedings of the 1984 ACM SIGMOD International Conference on Management of Data—SIGMOD, New York: ACM, 1984 pp. 47–57. doi:10.1145/971697.602266.
[2] H. Samet, Foundations of Multidimensional and Metric Data Structures, San Francisco: Morgan Kaufmann, 2005.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2014 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+