-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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