network
¶
Represents the network of interest. This is the primary object of PyPhi and the context of all \(\varphi\) and \(\Phi\) computation.

class
pyphi.network.
Network
(tpm, cm=None, node_labels=None, purview_cache=None)¶ A network of nodes.
Represents the network under analysis and holds auxilary data about it.
Parameters: tpm (np.ndarray) –
The transition probability matrix of the network.
The TPM can be provided in any of three forms: statebystate, statebynode, or multidimensional statebynode form. In the statebynode forms, row indices must follow the littleendian convention (see Littleendian convention). In statebystate form, column indices must also follow the littleendian convention.
If the TPM is given in statebynode form, it can be either 2dimensional, so that
tpm[i]
gives the probabilities of each node being ON if the previous state is encoded by \(i\) according to the littleendian convention, or in multidimensional form, so thattpm[(0, 0, 1)]
gives the probabilities of each node being ON if the previous state is \(N_0 = 0, N_1 = 0, N_2 = 1\).The shape of the 2dimensional form of a statebynode TPM must be
(s, n)
, and the shape of the multidimensional form of the TPM must be[2] * n + [n]
, wheres
is the number of states andn
is the number of nodes in the network.Keyword Arguments:  cm (np.ndarray) – A square binary adjacency matrix indicating the
connections between nodes in the network.
cm[i][j] == 1
means that node \(i\) is connected to node \(j\) (see Connectivity matrix conventions). If no connectivity matrix is given, PyPhi assumes that every node is connected to every node (including itself).  node_labels (tuple[str]) – Humanreadable labels for each node in the network.
Example
In a 3node network,
the_network.tpm[(0, 0, 1)]
gives the transition probabilities for each node at \(t\) given that state at \(t1\) was \(N_0 = 0, N_1 = 0, N_2 = 1\).
tpm
¶ np.ndarray – The network’s transition probability matrix, in multidimensional form.

cm
¶ np.ndarray – The network’s connectivity matrix.
A square binary adjacency matrix indicating the connections between nodes in the network.

connectivity_matrix
¶ np.ndarray – Alias for
cm
.

causally_significant_nodes
¶

size
¶ int – The number of nodes in the network.

num_states
¶ int – The number of possible states of the network.

node_indices
¶ tuple[int] – The indices of nodes in the network.
This is equivalent to
tuple(range(network.size))
.

node_labels
¶ tuple[str] – The labels of nodes in the network.

labels2indices
(labels)¶ Convert a tuple of node labels to node indices.

indices2labels
(indices)¶ Convert a tuple of node indices to node labels.

parse_node_indices
(nodes)¶ Return the nodes indices for nodes, where
nodes
is either already integer indices or node labels.

potential_purviews
(direction, mechanism)¶ All purviews which are not clearly reducible for mechanism.
Parameters: Returns: All purviews which are irreducible over
mechanism
.Return type: list[tuple[int]]

__eq__
(other)¶ Return whether this network equals the other object.
Networks are equal if they have the same TPM and CM.

to_json
()¶ Return a JSONserializable representation.
 cm (np.ndarray) – A square binary adjacency matrix indicating the
connections between nodes in the network.

pyphi.network.
irreducible_purviews
(cm, direction, mechanism, purviews)¶ Return all purviews which are irreducible for the mechanism.
Parameters: Returns: All purviews in
purviews
which are not reducible overmechanism
.Return type: list[tuple[int]]
Raises: ValueError
– Ifdirection
is invalid.