Cost of Memory

Cost of Memory

Well, how much space does such a graph of numbers occupy in memory? It contains numbers starting with zero up to 64.

I did some calculations and found that each number consumes approximately 6 items in a graph. An item may be either a vertex or an edge. In this architecture they both have an equal length of 6 ints. An int consists of 4 bytes. So, it gives 144 bytes (1152 bits).

NumbersGraph LengthRatio
0 - 10.00057.7085,77
0 - 20.000115.4205,77
0 - 30.000169.1485,64
0 - 40.000230.8445,77
0 - 50.000298.3005,97
0 - 60.000338.3005,64
0 - 70.000391.6925,60
0 - 80.000461.6925,77
0 - 90.000531.6925,91
0 - 100.000596.6045,97

I agree, the entrance into such kind of artificial intelligence has its costs. The ticket is not cheap. On the positive side we have idempotency. When writing texts we repeat same words multiple times. In these graphs we find the same vertex each time we need a number. The property means good chances for caching to speed-up search.