Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.readwrite.gexf.read_gexf

read_gexf(path, node_type=None, relabel=False, version='1.2draft')[source]

Read graph in GEXF format from path.

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

Parameters
  • path (file or string) – File or file name to write. File names ending in .gz or .bz2 will be compressed.

  • node_type (Python type (default: None)) – Convert node ids to this type if not None.

  • relabel (bool (default: False)) – If True relabel the nodes to use the GEXF node “label” attribute instead of the node “id” attribute as the NetworkX node label.

  • version (string (default: 1.2draft))

  • Version of GEFX File Format (see https (//gephi.org/gexf/format/schema.html)) – Supported values: “1.1draft”, “1.2draft”

Returns

graph – If no parallel edges are found a Graph or DiGraph is returned. Otherwise a MultiGraph or MultiDiGraph is returned.

Return type

NetworkX graph

Notes

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

References

1

GEXF File Format, https://gephi.org/gexf/format/