networkx.readwrite.nx_yaml.write_yaml¶
-
write_yaml
(G_to_be_yaml, path_for_yaml_output, **kwds)[source]¶ Write graph G in YAML format to path.
YAML is a data serialization format designed for human readability and interaction with scripting languages 1.
- Parameters
G (graph) – A NetworkX graph
path (file or string) – File or filename to write. Filenames ending in .gz or .bz2 will be compressed.
Notes
To use encoding on the output file include e.g.
encoding='utf-8'
in the keyword arguments.Examples
>>> G=nx.path_graph(4) >>> nx.write_yaml(G,'test.yaml')
References