node

Represents a node in a network. Each node has a unique index, its position in the network’s list of nodes.

class pyphi.node.Node(tpm, cm, index, state, label)

A node in a subsystem.

Parameters:
  • tpm (np.ndarray) – The TPM of the subsystem.
  • cm (np.ndarray) – The CM of the subsystem.
  • index (int) – The node’s index in the network.
  • state (int) – The state of this node.
  • label (str) – An optional label for the node.
tpm

np.ndarray – The node TPM is a 2^(n_inputs)-by-2 matrix, where node.tpm[i][j] gives the marginal probability that the node is in state j at t+1 if the state of its inputs is i at t. If the node is a single element with a cut selfloop, (i.e. it has no inputs), the tpm is simply its unconstrained effect repertoire.

tpm_off

The TPM of this node containing only the ‘OFF’ probabilities.

tpm_on

The TPM of this node containing only the ‘ON’ probabilities.

inputs

The set of nodes with connections to this node.

outputs

The set of nodes this node has connections to.

__eq__(other)

Return whether this node equals the other object.

Two nodes are equal if they belong to the same subsystem and have the same index (their TPMs must be the same in that case, so this method doesn’t need to check TPM equality).

Labels are for display only, so two equal nodes may have different labels.

to_json()

Return a JSON-serializable representation.

pyphi.node.default_label(index)

Default label for a node.

pyphi.node.default_labels(indices)

Default labels for serveral nodes.

pyphi.node.generate_nodes(tpm, cm, network_state, indices, labels=None)

Generate Node objects for a subsystem.

Parameters:
  • tpm (np.ndarray) – The system’s TPM
  • cm (np.ndarray) – The corresponding CM.
  • network_state (tuple) – The state of the network.
  • indices (tuple[int]) – Indices to generate nodes for.
Keyword Arguments:
 

labels (tuple[str]) – Textual labels for each node.

Returns:

The nodes of the system.

Return type:

tuple[Node]

pyphi.node.expand_node_tpm(tpm)

Broadcast a node TPM over the full network.

This is different from broadcasting the TPM of a full system since the last dimension (containing the state of the node) contains only the probability of this node being on, rather than the probabilities for each node.