nocad.profiles.driver_types#

nocad.profiles.driver_types(A, B)[source]#

Type of every driver node (MATLAB driverType).

Parameters:
Aarray_like or sparse, shape (N, N)

State-transition matrix.

Barray_like or sparse, shape (N, M)

Input matrix; its non-zero rows are the driver nodes.

Returns:
typesdict of bool masks, keys "source" (no incoming edge), "external"

(no outgoing edge), "internal" (a set of parents with more children than parents contains it: an internal dilation) and "inaccessible" (the rest).

Notes

For a driver node \(x_i\) that is neither a source nor a sink, the parents \(P\) and children \(Q\) are grown alternately (children of the parents, parents of the children) until they no longer change; \(|Q|>|P|\) is a dilation (the MATLAB test). The closure is the connected component of \(x_i^-\) in the bipartite graph, which can be balanced as a whole while containing a dilation, so the node is also classified as internal if some maximum matching leaves it unmatched (by König’s theorem it then lies in a set of states with fewer parents than members). The remaining drivers exist for accessibility only: inaccessible.

Examples

>>> A = [[0, 0, 0], [1, 0, 0], [1, 0, 0]]
>>> t = driver_types(A, [[1, 0], [0, 1], [0, 0]])
>>> t["source"], t["external"]
(array([ True, False, False]), array([False,  True, False]))