Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to save a networkx graph so it can be read in python

Take this MWE that is to be run in sage:

import networkx as nx
G = nx.DiGraph()                                                          
G.add_edge(0,1)                                                           
G.nodes[0]['weight'] = 23                                                 
nx.write_gml(G, "test.gml")

This gives me a long list of errors ending with:

NetworkXError: 0 is not a string

The same code works without error in Python.

What can I do?