Represents the network of interest. This is the primary object of PyPhi and the context of all \(\varphi\) and \(\Phi\) computation.
Network(tpm, connectivity_matrix=None, node_labels=None, purview_cache=None)¶
A network of nodes.
Represents the network we’re analyzing and holds auxilary data about it.
tpm (np.ndarray) –
The transition probability matrix of the network.
The TPM can be provided in either state-by-node (either 2-dimensional or n-dimensional) or state-by-state form. In either form, row indices must follow the LOLI convention (see Transition probability matrix conventions). In state-by-state form column indices must also follow the LOLI convention.
If given in state-by-node form, the TPM can be either 2-dimensional, so that
tpm[i]gives the probabilities of each node being on if the past state is encoded by \(i\) according to LOLI, or in n-dimensional form, so that
tpm[(0, 0, 1)]gives the probabilities of each node being on if the past state is \((n_0 = 0, n_1 = 0, n_2 = 1)\).
The shape of the 2-dimensional form of a state-by-node TPM must be
(S, N), and the shape of the n-dimensional form of the TPM must be
 * N + [N], where
Sis the number of states and
Nis the number of nodes in the network.
- connectivity_matrix (np.ndarray) – A square binary adjacency matrix
indicating the connections between nodes in the network.
connectivity_matrix[i][j] == 1means that node \(i\) is connected to node \(j\). If no connectivity matrix is given, every node is connected to every node (including itself).
- node_labels (tuple[str]) – Human-readable labels for each node in the network.
In a 3-node network,
a_network.tpm[(0, 0, 1)]gives the transition probabilities for each node at \(t\) given that state at \(t-1\) was \((n_0 = 0, n_1 = 0, n_2 = 1)\).
np.ndarray – The network’s transition probability matrix, in n-dimensional form.
np.ndarray – The network’s connectivity matrix.
A square binary adjacency matrix indicating the connections between nodes in the network.
np.ndarray – Alias for
int – The number of nodes in the network.
int – The number of possible states of the network.
tuple[int] – The indices of nodes in the network.
This is equivalent to
tuple[str] – The labels of nodes in the network.
Convert a tuple of node labels to node indices.
Convert a tuple of node indices to node labels.
Returns the nodes indices for nodes, where
nodesis either already integer indices or node labels.
All purviews which are not clearly reducible for mechanism.
All purviews which are irreducible over
Return whether this network equals the other object.
Networks are equal if they have the same TPM and CM.
Return a JSON-serializable representation.
- connectivity_matrix (np.ndarray) – A square binary adjacency matrix indicating the connections between nodes in the network.
irreducible_purviews(cm, direction, mechanism, purviews)¶
Returns all purview which are irreducible for the mechanism.
All purviews in
purviewswhich are not reducible over