intervaltree
intervaltree copied to clipboard
Include and exclude interval ends
Looks like interval ends are always excluded. May i control this behaviour? See no such parameters in Interval docstring
it.Interval(1, 2).overlaps(2,3), it.Interval(1, 2).overlaps(1,1), it.Interval(1, 2).overlaps(2,2)
# (False, False, False)
Not quite. In an interval, the begin is part of the interval, but not the end (like slice notation for a string). A zero-length interval is the null interval and intersects with nothing.
Oh, I thought about it in terms of sets, and mathematics allows us to have set of one element. Like string of one letter.
Pulling one letter out of a string would be like "hello"[1:2], so Interval(1,2) has length 1.
Mathematically, IntervalTree uses half-open intervals.