I'd like to make a feature request that comes up in a project I'm working on, which is a Rust port of SSHash.
Specifically, there are several times we need the following functionality — find the first element greater than or equal to (or less than), a given query q, then immediately also retrieve the immediate predecessor or successor of this value.
This comes up in our index in particular where we have the position of a k-mer, and we want to find, e.g. the starting boundary of the string in which it is contained, and then also the ending boundary of this string (where the boundary positions between strings is stored in an Elias Fano sequence).
Currently, in sux-rs, I can't see a way to do this with less than two "de novo" method calls, where the second call is not taking advantage of the state obtained by the first. That is, one can do a pred or succ query, get and index i, and then call the index method on i + 1. However, accessing adjacent elements can be made more efficient.
For this purpose, I ended up turning to cseq for the time being, due to this interface. Essentially, there is a variant of what, in sux would be the pred and succ methods, that returns a cursor, that can then be used to cheaply walk backward or forward from the returned element (index, value) pair.
Would you be willing to (and interested in) adding such a feature to sux-rs? I think there are several cases in which it would be useful functionality to have.
Thanks!
Rob
cc @RagnarGrootKoerkamp, who may also be interested in this.
I'd like to make a feature request that comes up in a project I'm working on, which is a Rust port of SSHash.
Specifically, there are several times we need the following functionality — find the first element greater than or equal to (or less than), a given query q, then immediately also retrieve the immediate predecessor or successor of this value.
This comes up in our index in particular where we have the position of a k-mer, and we want to find, e.g. the starting boundary of the string in which it is contained, and then also the ending boundary of this string (where the boundary positions between strings is stored in an Elias Fano sequence).
Currently, in
sux-rs, I can't see a way to do this with less than two "de novo" method calls, where the second call is not taking advantage of the state obtained by the first. That is, one can do apredorsuccquery, get and indexi, and then call the index method oni + 1. However, accessing adjacent elements can be made more efficient.For this purpose, I ended up turning to
cseqfor the time being, due to this interface. Essentially, there is a variant of what, insuxwould be thepredandsuccmethods, that returns a cursor, that can then be used to cheaply walk backward or forward from the returned element(index, value)pair.Would you be willing to (and interested in) adding such a feature to
sux-rs? I think there are several cases in which it would be useful functionality to have.Thanks!
Rob
cc @RagnarGrootKoerkamp, who may also be interested in this.