NetworkX

Previous topic

networkx.write_gml

Next topic

Pickle

networkx.parse_gml

parse_gml(lines)

Parse GML graph from a string or iterable.

Parameters:

lines : string or iterable

Data in GML format.

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 dicts in the NetworkX Graph attribute structures.

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

References

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

Examples

>>> G=nx.path_graph(4)
>>> nx.write_gml(G,'test.gml')
>>> fh=open('test.gml')
>>> H=nx.read_gml(fh)