NetworkX

Previous topic

networkx.readwrite.nx_yaml.read_yaml

Next topic

SparseGraph6

networkx.readwrite.nx_yaml.write_yaml

networkx.readwrite.nx_yaml.write_yaml(G, path, encoding='UTF-8', **kwds)

Write graph G in YAML format to path.

YAML is a data serialization format designed for human readability and interaction with scripting languages [R199].

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 :

Specify which encoding to use when writing file.

References

[R199](1, 2) http://www.yaml.org

Examples

>>> G=nx.path_graph(4)
>>> nx.write_yaml(G,'test.yaml')