Read and write graphs in GEXF format.


This parser uses the standard xml library present in Python, which is insecure - see xml for additional information. Only parse GEFX files you trust.

GEXF (Graph Exchange XML Format) is a language for describing complex network structures, their associated data and dynamics.

This implementation does not support mixed graphs (directed and undirected edges together).


GEXF is an XML format. See for the specification and for examples.

read_gexf(path[, node_type, relabel, version])

Read graph in GEXF format from path.

write_gexf(G, path[, encoding, prettyprint, ...])

Write G in GEXF format to path.

generate_gexf(G[, encoding, prettyprint, ...])

Generate lines of GEXF format representation of G.


Relabel graph using "label" node keyword for node label.