Implementing an ever-increasing numbering system

87 views Asked by At

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

1

There are 1 answers

5
jakob On BEST ANSWER

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.