Skip to main content

Cython-wrapped C++ red-black interval tree implementation

Project description

# Interval Tree for Python #

This is a Cython-wrapped red-black interval tree from [IvanPinezhaninov/IntervalTree/](https://github.com/IvanPinezhaninov/IntervalTree).

To install:

pip3 install rbi-tree

Example usage:

>>> from rbi_tree.tree import Tree
>>> t = Tree()
>>> t.insert(60, 80, value=10) # start stop and value are ints
>>> t.insert(20, 40, value=20)
>>> t.find(10, 30)
[20]
>>> t.find(40, 50) # half open so it should give nothing
[]
>>> t.remove(20, 40, value=20) # start,stop,value tuple identifies
...                            # the interval
>>> t.find(10, 30) # now it finds nothing
[]
>>> t.find_at(70) # search at point
[10]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rbi_tree-0.1.1.tar.gz (36.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page