8000 Implement hinted/cached rank/select for subsequent calls · Issue #58 · tinygraph/tinygraph · GitHub
[go: up one dir, main page]

Skip to content

Implement hinted/cached rank/select for subsequent calls #58

@daniel-j-h

Description

@daniel-j-h

In #14 we're going to implement a first rank/select data structure.

Based on this data structure we will built a succinct graph, where the edge target sub-ranges will be delimited by a rank/select bit vector

targets: [0, 1, 0, 2, 3, 1, ..]
offsets:  ^     ^        ^

The offsets bit vector will then delimit the start and end of sub-sequences, above: [0, 1], [0, 2, 3], [1, ..], ..

For graph traversal, for a node n we can get the out targets with [select(n), select(n + 1)].

For use cases like this we are repeatedly calling select, often to simply find the very next set bit.

We therefore should look into caching or hinting select, such that e.g. select(n + 1) can directly jump to the select(n) position and go from there. Especially because we assume the offsets bit vector to be dense anyway it could make sense to start a linear scan for the n+1 set bit from the position of the previous nth set bit.

Note: depending on how we implement our rank/select data structure this could spare us costly index lookups or linear scans. We need to look into this a bit more in detail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0