Inconsistent id
types
#338
Labels
core
something about core
enhancement
New feature or request
good first issue
Good for newcomers
Priority:High
Priority Label for high priority issue
There are sections of code where we use
unsigned long
forid
s, some where we usestd::size_t
, and some we useunsigned long long
. For example:Node.hpp
CXXGraph/include/Node/Node.hpp
Line 36 in 7c03e1a
Here we're declaring
std::size_t id = 0
Edge.hpp
CXXGraph/include/Edge/Edge.hpp
Line 49 in 7c03e1a
Here we're declaring
unsigned long long id = 0;
DirectedEdge.hpp
CXXGraph/include/Edge/DirectedEdge.hpp
Line 48 in 7c03e1a
Here we declare a constructor using
const unsigned long id
Discussion
We should probably land on a concrete type that's declared in
namespace CXXGraph
and used universally throughout the library for id types.Generally, I think 64 bits is more than enough for most use-cases, with a good tradeoff with performance/reduced hash collision when comparing ids. Lower bit values could squeeze out more performance - but it's highly use-case dependent.
Perhaps wherever we declare the id type, we should give the user the chance to redefine the type so that smaller or larger bit values can be used across the library. Perhaps with a documented macro.
What are your thoughts @sbaldu @ZigRazor ?
The text was updated successfully, but these errors were encountered: