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

pyphi.network.
from_json
(filename)¶ Convert a JSON representation of a network to a PyPhi network.
Parameters: filename (str) – A path to a JSON file representing a network. Returns: network – The corresponding PyPhi network object. Return type: Network

class
pyphi.network.
Network
(tpm, connectivity_matrix=None, perturb_vector=None, purview_cache=None)¶ A network of nodes.
Represents the network we’re analyzing and holds auxilary data about it.
Example
In a 3node network,
a_network.tpm[(0, 0, 1)]
gives the transition probabilities for each node at \(t_0\) given that state at \(t_{1}\) was \(\{N_0 = 0, N_1 = 0, N_2 = 1\}\).Parameters: tpm (np.ndarray) – See the corresponding attribute. Keyword Arguments: connectivity_matrix (array or sequence) – A square binary adjacency matrix indicating the connections between nodes in the network. connectivity_matrix[i][j] == 1
means that node \(i\) is connected to node \(j\). If no connectivity matrix is given, every node is connected to every node (including itself).
tpm
¶ np.ndarray – The network’s transition probability matrix. It can be provided in either statebynode (either 2D or ND) or statebystate form. In either form, row indices must follow the LOLI convention (see discussion in the
examples
module), and in statebystate form, so must column indices. If given in statebynode form, it can be either 2dimensional, so thattpm[i]
gives the probabilities of each node being on if the past state is encoded by \(i\) according to LOLI, or in ND form, so thattpm[(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 2dimensional form of a statebynode TPM must be(S, N)
, and the shape of the ND form of the TPM must be[2] * N + [N]
, whereS
is the number of states andN
is the number of nodes in the network.

connectivity_matrix
¶ np.ndarray – A square binary adjacency matrix indicating the connections between nodes in the network.

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

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

size

num_states

node_indices
¶

tpm

connectivity_matrix

perturb_vector
¶

__eq__
(other)¶ Return whether this network equals the other object.
Two networks are equal if they have the same TPM, connectivity matrix, and perturbation vector.

to_json
()¶
