문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top