RFC: Graph: Support 32-bit node IDs #427
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows NetworKit configurations that store adjacency lists consisting of 32-bit node IDs. In the best case, this should roughly half the memory required for
NetworKit::Graph
objects, at the cost of supporting fewer nodes.Because we expect some code in NetworKit to depend on 64-bit nodes, we do not change the
node
data type - this type is still auint64_t
. Instead, we change thestd::vector
s that store the adjacency lists to use a 32-bit integer and convert at theNetworKit::Graph
boundary.This requires some changes in the GraphBuilder (and in Curveball's clone of GraphBuilder). One thing to note is that
GraphBuilder::swapAdjacency
is much more expensive when 32-bit node IDs are used; however, I do not think that this is a bottleneck for existing algorithms (if you disagree, please comment!).Furthermore, the resulting NetworKit library is not ABI compatible with the default build. Users of the library are currently expected to pass
-DNETWORKIT_U32_NODES
when compiling programs that link against a 32-bit node ID build. This mechanism should probably be revisited (possibly in an update of this PR): instead of forcing the user to pass such a definition, we can install a configuration header for NetworKit.