Warning

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

parse_gml

parse_gml(lines, relabel=True)[source]

Parse GML graph from a string or iterable.

Parameters:

lines : string or iterable

Data in GML format.

relabel : bool, optional

If True use the GML node label attribute for node names otherwise use the node id.

Returns:

G : MultiGraph or MultiDiGraph

Raises:

ImportError

If the pyparsing module is not available.

See also

write_gml, read_gml

Notes

This stores nested GML attributes as dictionaries in the NetworkX graph, node, and edge attribute structures.

Requires pyparsing: http://pyparsing.wikispaces.com/

References

GML specification: http://www.infosun.fim.uni-passau.de/Graphlet/GML/gml-tr.html