Networkx graph memory usage?

2019-07-11 02:54发布

问题:

How to check the amount of memory used by networkx graph ?

There is method to check the number of nodes and edges, but I could not find one for memory usage ?

回答1:

You can get an estimate by adding up the size of the edge list and the size of the node list:

 sys.getsizeof(G.edge) + sys.getsizeof(G.node)