connectivity¶
Functions for determining network connectivity properties.
-
pyphi.connectivity.apply_boundary_conditions_to_cm(external_indices, cm)¶ Remove connections to or from external nodes.
-
pyphi.connectivity.get_inputs_from_cm(index, cm)¶ Return indices of inputs to the node with the given index.
-
pyphi.connectivity.get_outputs_from_cm(index, cm)¶ Return indices of the outputs of node with the given index.
-
pyphi.connectivity.causally_significant_nodes(cm)¶ Return indices of nodes that have both inputs and outputs.
-
pyphi.connectivity.relevant_connections(n, _from, to)¶ Construct a connectivity matrix.
- Parameters
n (int) – The dimensions of the matrix
_from (tuple[int]) – Nodes with outgoing connections to
toto (tuple[int]) – Nodes with incoming connections from
_from
- Returns
An \(N \times N\) connectivity matrix with the \((i,j)^{\textrm{th}}\) entry is
1if \(i\) is in_fromand \(j\) is into, and 0 otherwise.- Return type
np.ndarray
-
pyphi.connectivity.block_cm(cm)¶ Return whether
cmcan be arranged as a block connectivity matrix.If so, the corresponding mechanism/purview is trivially reducible. Technically, only square matrices are “block diagonal”, but the notion of connectivity carries over.
We test for block connectivity by trying to grow a block of nodes such that:
‘source’ nodes only input to nodes in the block
‘sink’ nodes only receive inputs from source nodes in the block
For example, the following connectivity matrix represents connections from
nodes1 = A, B, Ctonodes2 = D, E, F, G(without loss of generality, note thatnodes1andnodes2may share elements):D E F G A [1, 1, 0, 0] B [1, 1, 0, 0] C [0, 0, 1, 1]
Since nodes \(AB\) only connect to nodes \(DE\), and node \(C\) only connects to nodes \(FG\), the subgraph is reducible, because the cut
A,B C ─── ✕ ─── D,E F,G
does not change the structure of the graph.
-
pyphi.connectivity.block_reducible(cm, nodes1, nodes2)¶ Return whether connections from
nodes1tonodes2are reducible.- Parameters
cm (np.ndarray) – The network’s connectivity matrix.
nodes1 (tuple[int]) – Source nodes
nodes2 (tuple[int]) – Sink nodes
-
pyphi.connectivity.is_strong(cm, nodes=None)¶ Return whether the connectivity matrix is strongly connected.
Remember that a singleton graph is strongly connected.
- Parameters
cm (np.ndarray) – A square connectivity matrix.
- Keyword Arguments
nodes (tuple[int]) – A subset of nodes to consider.
-
pyphi.connectivity.is_weak(cm, nodes=None)¶ Return whether the connectivity matrix is weakly connected.
- Parameters
cm (np.ndarray) – A square connectivity matrix.
- Keyword Arguments
nodes (tuple[int]) – A subset of nodes to consider.
-
pyphi.connectivity.is_full(cm, nodes1, nodes2)¶ Test connectivity of one set of nodes to another.
- Parameters
cm (
np.ndarrray) – The connectivity matrixnodes1 (tuple[int]) – The nodes whose outputs to
nodes2will be tested.nodes2 (tuple[int]) – The nodes whose inputs from
nodes1will be tested.
- Returns
Trueif all elements innodes1output to some element innodes2and all elements innodes2have an input from some element innodes1, or if either set of nodes is empty;Falseotherwise.- Return type
bool