Skip to content

Refactor hierarchical nodes and links allocation #84

@boxdot

Description

@boxdot

The idea is to store nodes and links respectively in one vector. Since nodes are never deleted, the strategy here is straight forward. For links:

https://github.com/M4rtinK/monav-light/blob/master/plugins/contractionhierarchies/dynamicgraph.h

Given nodes and links between them, we want to delete links and add some. And further, we want to
add/delete many of them. The above code implements an idea of storing all links in one big vector.
Each node points to begin/end range in this vector. One element before begin, and after end is
normally not used (marked as empty). So if we want to add a new link, we can put it in the beginning
or in the end. If there is no empty space anymore, we move the whole range to the end of the array.
This frees the space in the middle of the array, and restores the property (for the range) of having
free space in the beginning and end of the range.

Would be nice also to see the improvement by using e.g.:
http://milianw.de/blog/heaptrack-a-heap-memory-profiler-for-linux

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