Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include and exclude interval ends #142

Open
satyrmipt opened this issue Aug 30, 2024 · 3 comments
Open

Include and exclude interval ends #142

satyrmipt opened this issue Aug 30, 2024 · 3 comments

Comments

@satyrmipt
Copy link

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)
@chaimleib
Copy link
Owner

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.

@satyrmipt
Copy link
Author

Oh, I thought about it in terms of sets, and mathematics allows us to have set of one element. Like string of one letter.

@chaimleib
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants