Read/Write NetworkX Graph Object

后端 未结 3 1112
北荒
北荒 2021-02-01 09:46

I am trying to deal with a super-massive NetworkX Graph object with hundreds of millions of nodes. I\'d like to be able to write it to file as to not consume all my computer mem

3条回答
  •  不要未来只要你来
    2021-02-01 10:03

    If you've built this as a NetworkX graph, then it will already be in memory. For this large of a graph, my guess is you'll have to do something similar to what you suggested with separate files. But, instead of using separate files, I'd use a database to store each node with many-to-many connections between nodes. In other words you'd have a table of nodes, and a table of edges, then to query for the neighbors of a particular node you could just query for any edges that have that particular node on either end. This should be fast, though I'm not sure if you'll be able to take advantage of NetworkX's analysis functions without first building the whole network in memory.

提交回复
热议问题