Open chananshgong opened 7 years ago
That's a different interpretation of intersection. The set operations implemented in this library on interval trees treat them simply as sets of interval objects, and those interval objects either compare equal or do not compare equal.
So if there are three unequal intervals, a
, b
, and c
(no matter what their bounds are or if they overlap), then IntervalTree([b, c]) & IntervalTree([b, a]) == IntervalTree([b])
Part of the reason I didn't implement range intersection is that it was ambiguous what should happen if intervals within one or both of the input trees overlapped each other:
data
fields differently from the intersections between the input trees?N
intervals in tree A with the M
intervals of tree B to produce up to N*M
result intervals in the result tree?Rather than impose my idea of what to do in these cases, I decided to leave this up to users to implement.
would not you expect to get
IntervalTree(Interval(5,10))
?