Import and export#
Import and export of networks, systems and annotated configurations.
nocad works on the adjacency matrix of the network of state variables, but the
networks come from, and the results go to, other software. This module converts in
both directions:
Python objects: NetworkX digraphs (
from_networkx(),to_networkx()), igraph graphs (from_igraph(),to_igraph()), pandas edge lists (from_pandas_edgelist(),to_pandas()), state-space matrices (from_state_space()) and python-controlStateSpacesystems (from_control(),to_control());files (
read(),write(), chosen by the file extension):format
extension
read
write
typical use
GraphML
.graphmlyes
yes
yEd, Cytoscape, NetworkX, igraph
GEXF
.gexfyes
yes
Gephi, with role colors and positions
GML
.gmlyes
yes
igraph and other network tools
Cytoscape
.cyjsyes
yes
Cytoscape and Cytoscape.js (classes, positions)
node-link
.jsonyes
yes
D3.js and web applications
DOT
.dotno
yes
Graphviz; components of one level share a rank
Pajek
.netyes
yes
Pajek
edge list
.edgelistyes
yes
plain text with the node order in a header
CSV / TSV
.csvyes
yes
spreadsheets; node table in
*_nodes.csvExcel
.xlsxyes
yes
node, edge and summary sheets
MATLAB
.matyes
yes
the NOCAD MATLAB toolbox: A, B, C, D, labels
NumPy
.npzyes
yes
compact binary storage
Every export carries the annotations of nocad.annotation.annotate() as node and
edge attributes (driver and sensor nodes, roles, types, components, levels, depths,
regions, matched edges, edge classes, cactus parts, connection types), unless
annotate=False. Files written by nocad are read back with their configuration:
read() returns the driver and sensor nodes stored in the driver and
sensor attributes.
NetworkX, igraph, pandas, state-space and python-control conversions; GraphML, GEXF, GML, Cytoscape, DOT, Pajek, CSV, Excel, MATLAB and NumPy files.
Functions#
|
Network of state variables from a NetworkX graph. |
|
NetworkX digraph of a network, with the annotations as node and edge attributes. |
|
Network from a python-igraph graph (vertex attribute |
|
python-igraph graph with the annotations of |
|
Network from an edge-list DataFrame (one row per edge \(x_j\to x_i\)). |
|
Node and edge tables (pandas DataFrames) of |
|
Network of a state-space model: \(\mathbf{W}=\mathbf{A}^{\mathsf T}\). |
|
Network of a python-control |
|
python-control |
|
Read a network (and a stored configuration) from a file. |
|
Write a network, a design or an annotated configuration to a file. |
|
Read a MATLAB file: state-space matrices |
|
Write |
|
Graphviz DOT source of an annotated network. |
Constants#
File formats by extension: (name, readable, writable). |