Skip to main content

Build Quality Gate Status codecov

KDTree

Implementation of a multidimensional binary search tree for associative searching

References

Jon Louis Bentley. Multidimensional binary search tree used for associative searching. September 1975.

Usage

from kdtree import BinSearchTree, Bound, Node, Region


# Create a new tree
tree = BinSearchTree(dimension=2)

# Insert some nodes into the tree
tree.insert(Node((50, 50)))
tree.insert(Node((10, 70)))
tree.insert(Node((80, 85)))
tree.insert(Node((25, 20)))
tree.insert(Node((40, 85)))
tree.insert(Node((70, 85)))
tree.insert(Node((10, 60)))

# Create rectangle from a bound array as described in the article
# Element 2*j is lower bound and element (2*j)+1 is upper bound of dimension j
rectangle_1 = Region.from_bounds_array(69, 71, 84, 86)

# Create rectangles as a list of Bound object
rectangle_2 = Region(Bound(69, 71), Bound(84, 86))

# Search
nodes = tree.regional_search(rectangle_1)
print("Nodes within region:", nodes)

Metadata

Release files for kdtree-python 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kdtree-python 0.2.2
File Size Uploaded
kdtree-python-0.2.2.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kdtree-python 0.2.2
File Interpreter ABI Platform
kdtree_python-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / kdtree-python-0.2.2.tar.gz

Download URL kdtree-python-0.2.2.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dca85692b990bde28c2117c9a86349af463b21c9687832022d0781f937761652
BLAKE2b-256 checksum
How to use checksums
1a2182bb8fc0d5dfbd6bdf468610dbfb1d10f2ba28096995021cf1790bb80b52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / kdtree_python-0.2.2-py3-none-any.whl

Download URL kdtree_python-0.2.2-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9d514d0afc4c53d451d50947738a71e5f5e6e88eb1d80e08af0069f5214910c
BLAKE2b-256 checksum
How to use checksums
009222a36d2b78cd57fc5e796dd89fef10ce08eb04ec51dbac20b925c83241bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.0

1 release file

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page