NetworkX

Previous topic

networkx.readwrite.gml.parse_gml

Next topic

Pickle

networkx.readwrite.gml.generate_gml

networkx.readwrite.gml.generate_gml(G)

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]"
]