Network-Based Controllability and Observability Analysis in PythonThe nocad toolbox

Appendix B
Migration from the MATLAB toolbox

The MATLAB/Octave NOCAD toolbox [19] is organized in three modules. Every function maps onto nocad as listed below. Node indices are 0-based in Python; matchedBy becomes matched_by with −1 for unmatched nodes. As in MATLAB, functions of a network take the adjacency matrix and functions of a system the state matrix 𝐀= 𝐖𝖳.

Module 1: network mapping

MATLAB

nocad

components

nocad.components.components, condensation

maximumMatching

nocad.maximum_matching

maximumMatchingPF

nocad.maximum_matching_pf

maximumMatchingSS

nocad.maximum_matching_ss

—

nocad.maximum_matching_min (exact minimum, new)

generateMatricesPF

nocad.generate_matrices_pf / generate_matrices(adj, "path_finding")

generateMatricesSS

nocad.generate_matrices_ss / generate_matrices(adj, "signal_sharing")

Module 2: system characterization

MATLAB

nocad

numOfNodes, numOfEdges, density

nocad.measures.num_nodes, num_edges, density

allShortestPaths, diam

nocad.distances.all_shortest_paths, diameter

degreeIn, degreeOut, degree

nocad.measures.degree_in, degree_out, degree

degreeScott, degreeVariance

nocad.measures.degree_scott, degree_variance

degreeFreeman

nocad.measures.degree_freeman

pearsonDir, sumSq

nocad.measures.pearson_dir

degreeCorrel

nocad.measures.degree_correlation

percentLoopSym

nocad.measures.percent_loop_sym

closenessCentrality

nocad.measures.closeness_centrality

nBetweenness, betweenness

nocad.measures.node_betweenness, edge_betweenness

pageRank

nocad.measures.pagerank

isControllable, isObservable

nocad.is_controllable, nocad.is_observable

degreeRel

nocad.relative_degree

controlCentrality, observeCentrality

nocad.control_centrality, observe_centrality

driverNodes, sensorNodes

non-zero rows of B / columns of C

driverType, sensorType

nocad.driver_types, sensor_types

clusterControl, clusterObserve

nocad.distances.control_distance_matrix, observation_distance_matrix

driverSimilarity, sensorSimilarity

nocad.measures.driver_similarity, sensor_similarity

jaccard, simWeighting

nocad.measures.jaccard, sim_weighting

reachC, reachO, reachability

nocad.measures.reach_c, reach_o, reachability

endpointSim, similarity

nocad.measures.endpoint_similarity, edge_similarity

getNumNodes

nocad.n_driver_nodes, nocad.sensor_nodes

addEdges

nocad.connection.add_edges

heatmaps

nocad.dynamics_heatmap + nocad.viz.plot_dynamics_heatmap

getConfig, matricesToStruct

nocad.measures.get_config, system_measures / measures_tables

Module 3: improvement and robustness

MATLAB

nocad

setCover, setCoverExcept

nocad.placement.set_cover, set_cover_except

greedyscp

nocad.placement.greedy_set_cover

analyseComponents, measures

nocad.placement.centrality_retrofit

mCLASArMax, mCLASAaddMax

Placement(method="mclasa", r_max=...) / n_add=...

GDFCMSArMax, GDFCMSAaddMax

Placement(method="gdfcmsa", r_max=...) / n_add=...

getCost

nocad.placement_cost

getSensors

nocad.driver_nodes / nocad.sensor_nodes

isCont, isObs

nocad.is_structurally_controllable with a dedicated B

evolveOperability, extendData

nocad.placement.improve_configuration

robust

nocad.node_removal_robustness, robustness_table

Exchanging data with the MATLAB toolbox

The function nocad.io.write_mat, also called by write_network for a file name ending in .mat, stores 𝐀, 𝐁, 𝐂, 𝐃, the adjacency matrix adj, the node labels and the 1-based drivers and sensors for MATLAB; nocad.io.read_mat reads a file with A (and optionally B, C, D) as a state-space model, or any square matrix as a network.

Differences