networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
parse_gml(lines, label='label', destringizer=None)

Notes

This stores nested GML attributes as dictionaries in the NetworkX graph, node, and edge attribute structures.

GML files are stored using a 7-bit ASCII encoding with any extended ASCII characters (iso8859-1) appearing as HTML character entities. Without specifying a :None:None:`stringizer`/destringizer , the code is capable of writing :None:None:`int`/:None:None:`float`/:None:None:`str`/:None:None:`dict`/:None:None:`list` data as required by the GML specification. For writing other data types, and for reading data other than :None:None:`str` you need to explicitly supply a :None:None:`stringizer`/destringizer .

For additional documentation on the GML file format, please see the GML url.

See the module docstring networkx.readwrite.gml for more details.

Parameters

lines : string or iterable of strings

Data in GML format.

label : string, optional

If not None, the parsed nodes will be renamed according to node attributes indicated by :None:None:`label`. Default value: 'label'.

destringizer : callable, optional

A destringizer that recovers values stored as strings in GML. If it cannot convert a string to a value, a :None:None:`ValueError` is raised. Default value : None.

Raises

NetworkXError

If the input cannot be parsed.

Returns

G : NetworkX graph

The parsed graph.

Parse GML graph from a string or iterable.

See Also

read_gml
write_gml

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.readwrite.gml.read_gml

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/readwrite/gml.py#199
type: <class 'function'>
Commit: