write_gexf¶
-
write_gexf
(G, path, encoding='utf-8', prettyprint=True, version='1.1draft')[source]¶ Write G in GEXF format to path.
“GEXF (Graph Exchange XML Format) is a language for describing complex networks structures, their associated data and dynamics” [1].
Parameters: Examples
>>> G=nx.path_graph(4) >>> nx.write_gexf(G, "test.gexf")
Notes
This implementation does not support mixed graphs (directed and undirected edges together).
The node id attribute is set to be the string of the node label. If you want to specify an id use set it as node data, e.g. node[‘a’][‘id’]=1 to set the id of node ‘a’ to 1.
References
[1] GEXF graph format, http://gexf.net/format/