networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
write_graphml_lxml(G, path, encoding='utf-8', prettyprint=True, infer_numeric_types=False, named_key_ids=False, edge_id_from_attribute=None)

This function uses the LXML framework and should be faster than the version using the xml library.

Notes

This implementation does not support mixed graphs (directed and unidirected edges together) hyperedges, nested graphs, or ports.

Parameters

G : graph

A networkx graph

path : file or string

File or filename to write. Filenames ending in .gz or .bz2 will be compressed.

encoding : string (optional)

Encoding for text data.

prettyprint : bool (optional)

If True use line breaks and indenting in output XML.

infer_numeric_types : boolean

Determine if numeric types should be generalized. For example, if edges have both int and float 'weight' attributes, we infer in GraphML that both are floats.

named_key_ids : bool (optional)

If True use attr.name as value for key elements' id attribute.

edge_id_from_attribute : dict key (optional)

If provided, the graphml edge id is set by looking up the corresponding edge data attribute keyed by this parameter. If :None:None:`None` or the key does not exist in edge data, the edge id is set by the edge key if G is a MultiGraph, else the edge id is left unset.

Write G in GraphML XML format to path

Examples

>>> G = nx.path_graph(4)
... nx.write_graphml_lxml(G, "fourpath.graphml")
See :

Back References

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

networkx.readwrite.graphml.write_graphml_lxml networkx.readwrite.graphml.write_graphml_xml

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/graphml.py#117
type: <class 'function'>
Commit: