0

My graph has 8400+ nodes for which I want to get all pairs shortest path for all the nodes. I tried using by networkx, it is resulting in Memory Error.

Traceback (most recent call last):
File "C:\Users\Asif\pythonworkspace\Formally\src\lastlast.py", line 19, in <module>
mynewgraph = nx.all_pairs_shortest_path(myGraph)
File "C:\Python27\lib\site-packages\networkx\algorithms\shortest_paths\unweighted.py", line 290, in all_pairs_shortest_path
paths[n]=single_source_shortest_path(G,n,cutoff=cutoff)
File "C:\Python27\lib\site-packages\networkx\algorithms\shortest_paths\unweighted.py", line 254, in single_source_shortest_path
paths[w]=paths[v]+[w]
MemoryError

I have just tried this mynewgraph = nx.all_pairs_shortest_path(myGraph)

All are my nodes have string data type and every edge has a weight associated to it.

Please provide your suggestions

phaigeim
  • 729
  • 13
  • 34
  • Change the names of your nodes to be ints. – Joel Mar 16 '15 at 17:11
  • I'm curious, why did you call it `mytree`? `all_pairs_shortest_path` won't return a tree, so I'm wondering if the command you're doing does what you expect. – Joel Mar 16 '15 at 17:13
  • joel, I modified the program... I was earlier making a tree with that Graph, so I was a bit careless about the variable names as they do not matter much :P – phaigeim Mar 16 '15 at 21:02

0 Answers0