Sorry for being late :), but I recently ran into the same problem and I modeled it using hashes. I agree with Tom Clarkson that (almost) everything should be loaded into local memory, and I will add that an efficient way from a space point of view is to use hashes and store your graph information as follows:
Graph = { node1 : { nodeX : edge_weight, nodeY : edge_weight, other_info: bla..}, node2 : { nodeZ : edge_weight, nodeE : edge_weight, other_info: bla..}, bla bla... }
If you need more space and efficiency, compress each value (which may be a JSON string ...) and unpack / import / deserialize your client code.
source share