Warning

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

generate_gml

generate_gml(G)[source]

Generate a single entry of the graph G in GML format.

Parameters:

G : NetworkX graph

Returns:

lines: string

Lines in GML format.

Notes

This implementation does not support all Python data types as GML data. Nodes, node attributes, edge attributes, and graph attributes must be either dictionaries or single stings or numbers. If they are not an attempt is made to represent them as strings. For example, a list as edge data G[1][2][‘somedata’]=[1,2,3], will be represented in the GML file as:

edge [
  source 1
  target 2
  somedata "[1, 2, 3]"
]