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


Read graphs in GML format.

“GML, the G>raph Modelling Language, is our proposal for a portable file format for graphs. GML’s key features are portability, simple syntax, extensibility and flexibility. A GML file consists of a hierarchical key-value lists. Graphs can be annotated with arbitrary data structures. The idea for a common file format was born at the GD‘95; this proposal is the outcome of many discussions. GML is the standard file format in the Graphlet graph editor system. It has been overtaken and adapted by several other systems for drawing graphs.”

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

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

read_gml(path[, relabel]) Read graph in GML format from path.
write_gml(G, path) Write the graph G in GML format to the file or file handle path.
parse_gml(lines[, relabel]) Parse GML graph from a string or iterable.
generate_gml(G) Generate a single entry of the graph G in GML format.