intervaltree
intervaltree copied to clipboard
docs for envelop vs containsi vs in
Thanks for the great library.
I was looking for a method to check if an interval tree fully envelops some interval, and I couldn't figure out whether envelop(begin, end), interval_obj in tree (this is fastest, O(1)), or tree.containsi(begin, end, data) was the one to use without testing them in code. It would be great if the README could clarify their behavior.
What I ended up using was
def tree_envelops_interval(t, i):
return any(ti.contains_interval(i) for ti in interval_tree.overlap(i))