On Fri, 2014-10-03 at 22:58 -0400, Spencer Kimball wrote:
> Where would I add the adjusttree call btw?
You only need to call AdjustRanges() before calls to Get or DoMatching|
DoMatchingReverse if you have inserted (theoretically when fast=true -
but now until I've fixed this). For my use cases (large sets of genomic
data), I stuff a whole heap of intervals in a tree, AdjustRanges() and
then use it to handle queries - this is probably why it has never come
up before (though I probably would not have noticed, so thank you for
raising it). For batch loads, this is much faster since we only do the
range adjustments once, at the end of the tree construction.
> In any case, I chose biogo.store for this task mainly because you're
> the only game in town for a go-based interval tree. But also because
> I've already used your llrb implementation and judged it superior to
> others based on unittests. But also because this implementation is
> well tested. What about this bug allowed it to slip through the
> cracks? I confess that I haven't taken the time to really understand
> the algorithm. Maybe I should.
Always a good idea. My implementation of the LLRB algorithm was actually
for teaching/learning, so it is written to closely match the description
given by Sedgewick.
> I'd like to avoid really putting my brain to work on the interval tree
> data structure of possible. Do you think it's solid, or does this bug
> make you nervous about anything fundamental?
There is nothing fundamentally wrong with it AFAIK, but the order of
balancing operations is probably what got me here. With your test case I
can follow the rotations and see how they interact with the range
adjustments. That is probably what is going wrong here.
Dan