Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Huge Graph Structure

I'm developing an application in which I need a structure to represent a huge graph (between 1000000 and 6000000 nodes and 100 or 600 edges per node) in memory. The edges representation will contain some attributes of the relation.

I have tried a memory map representation, arrays, dictionaries and strings to represent that structure in memory, but these always crash because of the memory limit.

I would like to get an advice of how I can represent this, or something similar.

By the way, I'm using python.

like image 359
Harph Avatar asked May 10 '10 22:05

Harph


1 Answers

The scipy.sparse.csgraph package may be able to handle this -- 5 million nodes * 100 edges on average is 500 million pairs, at 8 bytes per pair (two integer IDs) is just about 4GB. I think csgraph uses compression so it will use less memory than that; this could work on your laptop.

csgraph doesn't have as many features as networkx but it uses waaay less memory.

like image 153
amwinter Avatar answered Nov 09 '22 03:11

amwinter