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
I forgot what problem I came to StackOverflow to solve originally, but I stumbled on this question and (nearly a decade too late!) can recommend Grand, a networkx-like library we wrote to solve exactly this problem:
Before
import networkx as nx
g = nx.DiGraph()
g.add_edge("A", "B")
print(len(g.edges()))
After
import grand
from grand.backends import SQLBackend # or choose another!
g = grand.Graph(backend=SQLBackend())
g.nx.add_edge("A", "B")
print(len(g.nx.edges()))
The API is the same as NetworkX, but the data live in SQL, DynamoDB, etc.