Indexicon for Python
Indexicon provides NumPy-native Python bindings for high-performance R-trees, Quad-trees, Oct-trees, and KD-trees backed by C++.
Installation
Indexicon requires Python 3.10 or newer.
pip install indexicon
Example
Every index supports bulk_load, insert, remove, query, knn, and statistics.
import numpy as np
import indexicon as idx
tree = idx.RTree(data="point", dims=2)
coords = np.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]])
tree.bulk_load(coords)
tree.insert(np.array([3.0, 3.0]))
hits = tree.query(np.array([0.5, 0.5]), np.array([2.5, 2.5]))
near = tree.knn(np.array([0.1, 0.1]), k=2)
print(hits)
print(near)
print(tree.statistics())
More examples are available in the python/examples directory.
Supported Indexes
| Index | Data | Dimensions | Constructor |
|---|---|---|---|
| R-tree | Points | 2D / 3D | RTree(data="point", dims=2) |
| R-tree | Boxes | 2D / 3D | RTree(data="box", dims=2) |
| Quad-tree | Points | 2D | QuadTree(split="pr") |
| MX-CIF Quad-tree | Boxes | 2D | MXCIFQuadTree() |
| Oct-tree | Points | 3D | OctTree() |
| KD-tree | Points | 2D / 3D | KDTree(dims=2) |
Quad-tree splitting strategies are "pr", "pseudo_median", and "longest_axis". KD-tree splitting strategies are "longest_axis", "adaptive", and "round_robin".
Python bindings use float64 coordinates, int64 IDs, and a fixed node or bucket capacity of 128. Capacity and other template parameters can be customized through the C++ API.
Object IDs
Use custom IDs by passing an (N,) NumPy array of int64 values to bulk_load(..., ids=ids) or an integer to insert(..., id=100). When IDs are omitted, Indexicon assigns them automatically. Automatic IDs advance past nonnegative custom IDs and are not recycled after removal.
Citation
If you use Indexicon in a project, paper, benchmark, or product, please cite the Indexicon paper.
License
Indexicon is distributed under the MIT License.
Metadata
Release files for indexicon 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| indexicon-1.1.0.tar.gz | 4.9 MB | Without provenance | Details for indexicon-1.1.0.tar.gz |
Release files / indexicon-1.1.0.tar.gz
| Download URL | indexicon-1.1.0.tar.gz |
|---|---|
| Size | 4.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4202ff351e69c841e81886de193044b3a9ae2e3d85215424ea0a541f511b72a1
|
|
BLAKE2b-256 checksum How to use checksums |
4ba32ddcb150f0d7df1f7c576cee8787c16b4899fbbdfbed6bb44f47a37ec21d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for indexicon 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.