generate_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 – Lines of GML data. Newlines are not appended.
Return type: generator of strings
Raises: NetworkXError
– Ifstringizer
cannot convert a value into a string, or the value to convert is not a string whilestringizer
isNone
.Notes
Graph attributes named
'directed'
,'multigraph'
,'node'
or'edge'
,node attributes named'id'
or'label'
, edge attributes named'source'
or'target'
(or'key'
ifG
is a multigraph) are ignored because these attribute names are used to encode the graph structure.