nocad.io.write#

nocad.io.write(obj, path, format=None, *, labels=None, annotate=True, layout='hierarchy', **kwargs)[source]#

Write a network, a design or an annotated configuration to a file.

Parameters:
objnetwork (adjacency, sparse, networkx, DataFrame), InputOutputDesign or a Bunch

with adj (and labels) such as the result of read()

pathstr or pathlib.Path

Output file; the format follows the extension (see FORMATS).

formatstr, optional

Override the format name ("graphml", "gexf", "gml", "cytoscape", "node_link", "dot", "pajek", "edgelist", "csv", "excel", "matlab", "npz").

annotatebool, default=True

Include the role annotations of nocad.annotation.annotate().

layoutstr or ndarray, default=”hierarchy”

Node positions stored in GEXF, Cytoscape and GraphML files (None for none).

**kwargs

Passed to to_networkx() / nocad.annotation.annotate() (design, method, drivers, sensors, centrality, robustness).

Returns:
pathslist of pathlib.Path

The files written (CSV writes a node file beside the edge file).