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

Build overlap tree #113

Open
FantasticMrFux opened this issue Dec 3, 2021 · 0 comments
Open

Build overlap tree #113

FantasticMrFux opened this issue Dec 3, 2021 · 0 comments

Comments

@FantasticMrFux
Copy link

Consider this script:

from intervaltree import IntervalTree

t1 = IntervalTree()
t2 = IntervalTree()
t1[1:3] = "a"
t2[2:3] = "b"

t3 = IntervalTree()
for interval in t1.items():
    for overlap_interval in t2.overlap(interval):
        t3.add(overlap_interval)

Is this the most efficient way to get an interval tree that only contains intervals that overlap between two interval trees?

Also I would suggest that it should be also possible too use this statment instead of the last loop.

t3.add(t2.overlap(interval)
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

1 participant