14.5.5. networkx.readwrite.gml.generate_gml

networkx.readwrite.gml.generate_gml(G, stringizer=None)[source]

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

Parameters:

G : NetworkX graph

The graph to be converted to GML.

stringizer : callable, optional

A stringizer which converts non-int/float/dict values into strings. If it cannot convert a value into a string, it should raise a ValueError raised to indicate that. Default value: None.

Returns:

lines: generator of strings

Lines of GML data. Newlines are not appended.

Raises:

NetworkXError

If stringizer cannot convert a value into a string, or the value to convert is not a string while stringizer is None.

Notes

Graph attributes named ‘directed’, ‘multigraph’, ‘node’ or ‘edge’,node attributes named ‘id’ or ‘label’, edge attributes named ‘source’ or ‘target’ (or ‘key’ if G is a multigraph) are ignored because these attribute names are used to encode the graph structure.