The R*-Tree1 is the star of multidimensional indexing. Nevertheless, I found its implementations complex or lacking features. Thus, I wrote my own, while also providing features like batch insertion and STR bulk loading.
- Insertion: Insert a single object in R* fashion (e.g., trigger reinsertions).
- Batch Insertion: Insert multiple objects by grouping them in leaves.
- Bulk Loading: Use STR2 to construct the tree from a set of objects.
- Range Queries: Retrieve objects overlapping a query rectangle.
- Dimensionality: The index supports any dimension.
- Statistics: Retrieve tree information (e.g., height, number of nodes, and size in MB).
$ ./run.sh
run.sh
compiles and executes main.cpp
which benchmarks R*-Tree operations, including:
- R* insertions
- Batch insertions
- Bulk loading
- Range queries with validation against linear scan
- Time and memory usage measurements
-
Rectangle
: A bounding box with utility methods (e.g.,area()
,overlap()
, andcombine()
). -
Node
: A tree node, which is eitherleaf
orinternal
, holds pointers to its children and their rectangles. -
RStarTree
: The tree structure and its operations (e.g.,insert()
, andquery()
).
- No deletion.
- No disk-based storage.
- No nearest neighbor queries.
Contributions are welcome. Feel free to submit pull requests or open issues for discussions.
Footnotes
-
N. Beckmann, H. P. Kriegel, R. Schneider, and B. Seeger, "The R*-tree: an efficient and robust access method for points and rectangles", SIGMOD, 1990 https://doi.org/10.1145/93597.98741 ↩
-
S. T. Leutenegger, M. A. Lopez, and J. Edgington, "STR: a simple and efficient algorithm for R-tree packing," Proceedings 13th International Conference on Data Engineering, 1997, doi: 10.1109/ICDE.1997.582015 ↩