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:
pathfile or string

File or file name to read. File names ending in .gz or .bz2 will be decompressed.

node_type: Python type (default: None)

Convert node ids to this type if not None.

relabelbool (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.

versionstring (default: 1.2draft)
Version of GEFX File Format (see http://gexf.net/schema.html)

Supported values: “1.1draft”, “1.2draft”

Returns:
graph: NetworkX graph

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

Notes

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

References

[1]

GEXF File Format, http://gexf.net/