nocad.annotation.annotate#
- nocad.annotation.annotate(adj, design=None, *, method='path_finding', drivers=None, sensors=None, labels=None, centrality=False, robustness=False)[source]#
Node and edge tables with the controllability and observability role of every element.
- Parameters:
- adj
network Adjacency matrix, sparse matrix,
networkx.DiGraphorpandas.DataFrame; node names of graphs and data frames become the labels.- design
InputOutputDesign,optional A fitted design; designed with
methodwhen omitted.- method
str, default=”path_finding” Design method if
designis None (seeInputOutputDesign).- drivers, sensorsarray_like
ofint,optional Configuration to annotate instead of the design’s nodes (for example the result of a
Placement); matchings and cacti still come from the design.- labels
listofstr,optional Node names (default: names of the input graph, else
x1, x2, ...).- centralitybool, default=False
Add
control_centralityandobserve_centrality(generic ranks).- robustnessbool, default=False
Add
control_critical/observe_critical: the loss of the node destroys structural controllability / observability of the configuration.
- adj
- Returns:
- result
Bunchwithnodesandedges(pandasDataFrames,columnsdescribedin NODE_COLUMNSandEDGE_COLUMNS),graph(dict of network-level values) anddesign.
- result
Examples
>>> from nocad.datasets import load_nocad_example >>> ann = annotate(load_nocad_example().adj) >>> ann.nodes.loc[ann.nodes.driver, ["label", "control_role", "driver_type"]].values.tolist() [['x8', 'critical', 'source']] >>> ann.edges.query("control_cactus == 'stem'")[["source", "target"]].values.tolist() [['x6', 'x7'], ['x7', 'x9'], ['x8', 'x6']]