Skip to content

Build overlap tree #113

Description

@FantasticMrFux

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions