Question

I need your suggestions on how I should go about implementing an ever-increasing numbering system for my application. My application builds a graph in which its vertices are uniquely enumerated with integer. The problem I'm currently facing is the largest number representable by int or long, which poses an upper limit for the number of vertices a graph can accommodate.

All opinions are welcome here.

Thanks

Was it helpful?

Solution

Use 64 Bit Integers (java: long, c/c++: long long).

You probably have not enough memory to store 2^63 graph nodes anyway, so you won't need more.

Remember: if every node stores its own index, using a 32 Bit index variable will require 16 gigabyte memory before you get your first collision.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top