Chapter 4
Visualizing controllability and observability
A force-directed drawing of a network shows its density and its clusters, but it does not show whether the network is controllable, where its inputs must go, or why a given design works. This chapter develops drawings in which the geometry carries the theory: a layered layout of the strongly connected components that turns accessibility into height, a bipartite layout that turns a matching into horizontal lines, a decomposition of a design into Lin’s cacti with a tree layout that makes the proof of controllability readable, a block-triangular view of the system matrix, and depth maps and an operability plane that show how far the states are from the inputs and outputs. Each view is introduced with the condition it certifies and the algorithm that produces it.
4.1 Problem and idea
General-purpose layouts place nodes so that edges have similar lengths and few crossings: spring embedders [34] and stress minimization [35] are the defaults of network software. They are good at showing clusters and poor at showing direction: whether a node can be reached from another, which nodes have no predecessors, and which edges a matching uses are invisible in them. The questions an engineer asks about an input–output configuration are of exactly this kind:
- 1.
- Where must the inputs and outputs go? Every source component needs a driver node and every sink component a sensor node (accessibility, condition (i) of Lin’s theorem).
- 2.
- Why is a configuration sufficient? A matching assigns a parent to every state and the cacti of Lin’s theorem cover the network; a reader should be able to check this certificate on the picture.
- 3.
- How well does it work? The relative degree of a state with respect to an input is the length of the shortest path plus one; long paths mean slow, poorly conditioned control [18, 20].
- 4.
- How robust is it? Which edges and nodes are indispensable, and which are interchangeable (chapter 5).
The idea of the chapter is to let each question decide the layout, and to encode the answer in the most effective visual channel, position [36]: accessibility becomes height in a layered drawing, a matching becomes a set of horizontal lines, a cactus becomes a tree, a block-triangular structure becomes a staircase, and the depth of a state becomes its color and its coordinate in a plane (fig. 4.1). The same colors are used in every view and throughout the book: driver nodes blue, sensor nodes vermilion, nodes that are both purple, matched edges green, from the colorblind-safe palette of Okabe and Ito [37].
4.2 Theory
4.2.1 The SCC hierarchy
The condensation of is acyclic, so its components can be drawn on horizontal levels with all edges pointing downward, as in the layered drawing method of Sugiyama, Tagawa and Toda [38]. Three choices adapt the method to controllability.
Layering. Component is put on level if it has no predecessor and on level otherwise (longest-path layering [39]). The top level then consists of exactly the source components: every component drawn on top needs a driver node, every component below receives the influence of some component above it. For observability the levels are counted upward from the sink components, which then form the bottom level and need the sensor nodes. The level of a component is the number of components on the longest chain above it; it bounds how many component boundaries a signal has to cross, not the length of the shortest path, which the depth maps of section 4.2.5 show.
Order within the levels. The components of a level are reordered by alternating downward and upward barycenter sweeps [38, 40]: a component moves to the mean position of its neighbors on the previous level. Horizontal coordinates are then assigned by packing the components with their widths and pulling each toward the barycenter of all its neighbors under separation constraints, a simple variant of the priority method of Sugiyama et al.; Brandes and Köpf [41] give a more elaborate linear-time alternative.
Components as circles. A nontrivial component is drawn as a circle of radius growing with the square root of its size, its nodes in the order of a greedy walk along its edges, so that consecutive nodes on the circle are mostly joined by edges and the cycles that make the component strongly connected show as arcs. The vertical gap between two levels adapts to the largest circles on them, so that circles of adjacent levels never overlap. Algorithm 4.1 summarizes the layout; with Tarjan’s algorithm for the components [42] it takes time plus for sweeps over the edges of the condensation.
4.2.2 The bipartite view
In the bipartite representation (section 3.2.1) the out-copies are drawn in a left column, the in-copies in a right column. The out-copies keep the natural order; the in-copy of every matched node is placed level with the out-copy of its matching partner, and the in-copies of the unmatched nodes fill the remaining rows. Because a matching pairs distinct out-copies with distinct in-copies, this is a valid placement, and it makes every matched edge horizontal: the matching reads as a stack of parallel lines, and the unmatched in-copies, the driver nodes, are the right-hand ends without a horizontal line. A dilation, a set of states with fewer distinct parents than members, appears as a fan: few out-copies joined to many in-copies, at least of which stay unmatched by Hall’s theorem. Edges are colored by their class (critical, ordinary, redundant; section 5.2.2), so the view also shows which horizontal lines could be exchanged for others.
4.2.3 Control cacti
Lin’s proof of his theorem constructs a spanning subgraph of a special shape [5]. A stem is a directed path that starts at an input; a bud is a directed cycle together with one extra edge, the distinguished edge, that enters the cycle; a cactus is a stem to which buds are attached recursively, the distinguished edge of every bud starting at a node of the stem (other than its last node) or of a bud attached earlier. A system is structurally controllable iff its graph is spanned by a disjoint union of cacti. A design matching provides almost all of this: the matched edges form paths that start at the driver nodes (the stems) and cycles (the buds without their distinguished edges). What is missing is the choice of the distinguished edges. Algorithm 4.2 chooses them by a breadth-first search over the cycles.
Proposition 4.1. Let be a matching of , its unmatched nodes and the nodes that receive a shared input. Algorithm 4.2 attaches every bud iff every node of is reachable from . The attached stems and buds then form a spanning set of disjoint cacti, and the depth of every bud is the smallest number of buds through which it can be reached from a stem or a shared input.
Proof. If all buds are attached, every node lies on a stem or on a bud that is reached through a chain of distinguished edges from a stem or from a shared input, so it is reachable. Conversely, suppose the algorithm stops with a nonempty set of nodes on unattached buds. No edge leads from an attached node into , otherwise the loop would continue; all nodes outside are attached, because stems are attached from the start. Hence no edge enters from outside, and contains no node of (stems are attached) and no node of (buds with a shared node are attached first): the nodes of are not reachable. For the depths, the depths of the anchors chosen in successive steps never decrease: an anchor of smaller depth that was available earlier would have been chosen earlier, because the bud it leads to was unattached then. The search is therefore a breadth-first search on the graph of buds, which assigns shortest distances. □
For a design that makes the system controllable (every source component contains a driver node or a shared node), every node is reachable, so the decomposition always succeeds and the picture of the cacti is a certificate of controllability that a reader can check edge by edge. Buds left unattached by an arbitrary matching mark exactly the inaccessible part of the network. Observation cacti are the control cacti of the reversed network; drawn mirrored, their stems end at the sensors.
Cactus layout. Every cactus is drawn as a horizontal tree (fig. 4.2). The input is the root, at the left; the stem is the spine, one node per step to the right. The children of a stem node are the next stem node and the buds whose distinguished edges start at it; the children of a bud are the buds attached to any of its nodes. The first child continues the row of its parent, further children are stacked alternately above and below. Every subtree is measured first (the height it needs above and below its row), and every child is given its own horizontal band, so siblings never overlap; this is a banded simplification of the tidy-tree algorithms of Reingold and Tilford [43] and Walker [44], sufficient because cacti are shallow. A bud is drawn as a circle whose node on the distinguished edge faces the anchor, the others following along the cycle. The cacti of different inputs are stacked vertically, buds fed by a shared input hang below the first cactus, and unattached buds go to the bottom row. The layout takes time after the decomposition.
4.2.4 The structure matrix
The same conditions read in matrix language. Write the zero pattern of the system matrix with rows for the equations and columns for the states ; the non-zero is the edge . Ordering the states by a topological order of the strongly connected components, source components first, makes block lower triangular: an edge between components runs from an earlier to a later component, so its entry lies below the diagonal blocks, which are the components themselves (the Frobenius normal form; the Dulmage–Mendelsohn decomposition refines it [8, 29, 30]). The rows of a source block have non-zeros only inside the block, so at least one of them needs a non-zero in : this is accessibility. The entries of the control matching are a transversal, non-zeros in distinct rows and columns; the rows they leave uncovered are the rows of the driver nodes, which the entries of cover, so has full generic rank. Dually, the columns of a sink block have non-zeros only inside the block, so needs a non-zero in one of them.
4.2.5 Depth maps and regions
For a set of driver nodes, the control depth of state is its distance from the nearest driver node and its control region is that driver,
| (4.1) |
with ties broken in favor of the smaller index. Both follow from one breadth-first search started from all driver nodes at once, in time; the regions are the cells of the graph Voronoi diagram of the driver nodes [45]. The observation depth and region are the same quantities for the sensor nodes on the reversed network. For generic parameters, a state at distance from the driver node of input has relative degree with respect to [18]: the input appears in the -th time derivative of and not earlier. The largest depth is the relative order of the configuration used by the placement methods of chapter 8. A depth map colors every state by its depth on a discrete sequential scale (blues for control, oranges for observation), outlines the regions by padded convex hulls of their nodes, and marks states that no driver reaches with an empty vermilion circle. The same numbers in matrix form, states sorted by region and depth against the configured nodes, give the distance matrix (the controlling and observing matrices of the MATLAB toolbox).
4.2.6 The operability plane
The operability plane places every state at the point . Because the minima in eq. (4.1) separate,
| (4.2) |
the length of the shortest walk from a driver node to a sensor node through ; the dotted anti-diagonals of the plane are its level lines. States in the lower left corner are close to both an input and an output; states to the right are slow to steer, states at the top slow to see, and the largest coordinates are the relative orders of the input and the output configuration. Marginal bar charts count the states at each depth. Many states share integer coordinates, so coincident points are spread on a small sunflower spiral [46], which separates them deterministically without moving any point across a cell boundary. The plane compares configurations at a glance: adding drivers moves the cloud to the left, adding sensors moves it down.
In a nutshell: Views of controllability and observability
- SCC hierarchy: longest-path layering of the condensation; the top level is exactly the set of source components (the bottom level the sinks in the observation view).
- Bipartite view: matched edges horizontal; the free in-copies are the driver nodes, dilations are fans.
- Control cacti: stems from the matching, buds attached by breadth-first search; succeeds iff every node is reachable from the inputs, giving a checkable certificate of controllability with buds as shallow as possible.
- Structure matrix: block-triangular order; source blocks need , sink blocks need , the matching is a transversal.
- Depth maps and the operability plane: distances from the nearest driver and to the nearest sensor (relative degree minus one), regions as graph Voronoi cells.
4.3 Using it in nocad
All views live in nocad.viz; each plotting function takes the network and optionally the driver and sensor nodes or a matching, designs them with InputOutputDesign when they are omitted, draws into a given ax and returns it.
layouts in nocad.viz
hierarchy_layout(adj, direction) returns pos, level, center, radius, levels and the condensation; bipartite_layout(adj, matching) returns out_pos and in_pos; control_cacti(adj, method, matching, shared) returns stems, buds, attach, owner, depth, unattached; cactus_layout(cacti, n_states) returns pos, inputs, bud_center, bud_radius.
plots in nocad.viz
plot_scc_hierarchy, plot_bipartite_matching, plot_control_cacti(kind="control"|"observation"), plot_structure_matrix(order="scc"|"natural"), plot_depth_map(adj, nodes, kind), plot_distance_matrix, plot_operability_plane(adj, drivers, sensors, r_max), plot_operability_summary(adj, method), and plot_annotation(adj, column), which colors the nodes by any column of the annotation table (section 2.3.1); the role and robustness maps of chapter 5 complete the set. Every view accepts NetworkX graphs, whose node names become the labels, and NetworkX pos dictionaries; nocad.plotting.as_pos_dict turns the layouts of this chapter into such dictionaries, and nocad.io.to_dot hands the hierarchy to Graphviz.
The hierarchy of the nine-state example of the NOCAD manual:
adj = load_nocad_example().adj design = nocad.InputOutputDesign().fit(adj) layout = hierarchy_layout(adj, direction="control") print("components per level:", [[(layout.condensation.members[c] + 1).tolist() for c in lv] for lv in layout.levels]) ax = plot_scc_hierarchy(adj, design.driver_nodes_, design.sensor_nodes_, matching=design.control_matching_)
Its control cactus, as lists:
cacti = control_cacti(adj, method="path_finding") for k, stem in enumerate(cacti.stems): print(f"u{k + 1}: stem", [f"x{v + 1}" for v in stem]) for bud, (u, v), owner in zip(cacti.buds, cacti.attach, cacti.owner, strict=True): print("bud", [f"x{w + 1}" for w in bud], f"attached by x{u + 1}->x{v + 1} to the cactus of u{owner + 1}")
Depths and regions:
rho_c = nocad.control_depth(adj, design.driver_nodes_) rho_o = nocad.observation_depth(adj, design.sensor_nodes_) print("control depth ", rho_c.astype(int)) print("observation depth", rho_o.astype(int)) print("regions of the sensors", nocad.observation_regions(adj, design.sensor_nodes_) + 1)
The block-triangular matrix, the operability plane and the four-panel summary are one call each:
plot_structure_matrix(adj, order="scc", ax=axes[1], title="SCC (block-triangular) order")
axes = plot_operability_plane(hen.adj, design.driver_nodes_, design.sensor_nodes_, labels=hen.labels)
fig = plot_operability_summary(net.adj, method="path_finding", title="scale-free network, 40 states")
4.4 Examples
4.4.1 The SCC hierarchy
The nine-state example has five components (fig. 4.3): the source on top, the cycle below it, the cycle and the node on the third level and the sink at the bottom. The single driver node sits on the only source component; the green matched edges run from it down through all levels. The observation view (fig. 4.4) counts the levels from the sinks, and , which carry the two sensor nodes and .
Open in ColabExample plot_01_scc_hierarchy.py in the gallery
A sparse random network with 30 nodes and mean degree 1.4 decomposes into 28 components on nine levels (fig. 4.5); its nine source and eleven sink components explain most of the twelve driver and twelve sensor nodes, the rest come from dilations. The parameter study of fig. 4.6 shows how the condensation of random networks changes with the density: the share of components and of source components falls steeply once a giant strongly connected component forms, and the number of levels peaks near mean degree one, where long chains of small components are most frequent.
4.4.2 The bipartite view
In the bipartite view of the NOCAD example (fig. 4.7) eight of the nine rows carry a horizontal matched edge; the remaining in-copy has no edge at all, because has no parent. The edge classes on the network show which matched edges are indispensable: , , , , and are critical, , , and ordinary, and the remaining five edges redundant. A star is the smallest dilation (fig. 4.8): one out-copy and three in-copies form a fan, two leaves stay unmatched, and since any leaf may be the matched one, all three edges are ordinary. Across random networks (fig. 4.9) critical edges are frequent only in very sparse networks, redundant edges peak at intermediate densities, and dense networks consist almost entirely of ordinary, interchangeable edges.
Open in ColabExample plot_02_bipartite_view.py in the gallery
4.4.3 Control cacti
The control cactus of the NOCAD example (fig. 4.10) has the stem and two buds: , attached by , and , attached by to the first bud, at depth two, because no edge leads to it from the stem. The observation cacti (fig. 4.11) mirror the picture: two stems end at the sensors, and , and the bud is seen through the edge .
Open in ColabExample plot_03_control_cacti.py in the gallery
The two designs of the cycle with a tail differ visibly (fig. 4.12): with signal sharing the cycle stays a bud fed directly by the shared input, with path finding it has been opened into the stem. In the heat exchanger network of chapter 9 every exchanger contributes a two-node cycle and every unit a self-loop; one input controls the whole network through one stem carrying 21 buds, the deepest of them seven buds away from the stem (fig. 4.13). Path finding and the exact minimum give the same cactus structure here.
4.4.4 The structure matrix
In natural order the non-zeros of the NOCAD example are scattered (fig. 4.14, left); in SCC order (right) they form a block lower triangular pattern whose diagonal blocks are the five components. The single non-zero of lies in the row of the source block , the two non-zeros of in columns of the sink blocks, and the matched entries (green rings) cover every row except that of . For the heat exchanger network (fig. 4.15) the design methods differ in : path finding uses three outputs, one per sink component, signal sharing one output that reads the three sinks together.
Open in ColabExample plot_04_structure_matrix.py in the gallery
4.4.5 Depth maps and the distance matrix
With the single driver the control depths of the NOCAD example are for (fig. 4.16): the states of the cycle are reached only after four edges, so their relative degree is five. The observation depths are ; the sensor is responsible for , the sensor for . The distance matrix (fig. 4.17) shows the same numbers per driver; adding the driver takes over all states except and lowers the largest depth from four to two.
On the heat exchanger network (fig. 4.18) the single driver E9.h controls all 22 states, but the farthest only after seven edges (mean depth 3.95). Two drivers added by the GDFCMSA placement of chapter 8 lower the largest depth to four (mean 1.82), four added drivers to three (mean 1.14); the regions show which driver serves which part of the network.
4.4.6 The operability plane and the dashboard
The minimal design of the heat exchanger network, one driver and three sensors, spreads the states over the whole plane (fig. 4.19): control depths reach seven, observation depths six, and the longest shortest input–output walk through a state has nine edges. Requiring control and observation depths of at most two (dashed lines) needs six drivers and seven sensors; the cloud then collapses into the lower left corner (fig. 4.20).
Open in ColabExample plot_06_operability_plane.py in the gallery
The dashboard combines the views for a scale-free network with 40 states (fig. 4.21). The network has 38 components, 14 of them sources and 8 sinks. Path finding needs 14 driver and 11 sensor nodes: the hierarchy shows that every driver node sits on a source component and eight of the sensor nodes on sink components, the depth maps and the plane that all but two states lie within two edges of a driver node and of a sensor node.
4.5 Further reading
Layered drawing goes back to Sugiyama, Tagawa and Toda [38]; Gansner and co-authors [39] refined layering and coordinate assignment, Eades and Wormald [40] analyzed the barycenter and median heuristics, and Brandes and Köpf [41] gave a fast coordinate assignment. Tidy trees are due to Reingold and Tilford [43] and Walker [44]; the textbook of Di Battista, Eades, Tamassia and Tollis [47] covers all of these. Graph Voronoi diagrams were introduced by Erwig [45]. Lin’s cacti are in [5]; Liu, Slotine and Barabási [10] used them to explain the minimum input theorem, and the relation between distances and relative degrees is due to Daoutidis and Kravaris [18]. Munzner [36] discusses the effectiveness of visual channels that guided the design of the views.