Synchronous Network Analysis¶
The neet.synchronous
module provides a host of functions for computing
properties of the dynamics of synchronously updated networks. This includes
The disadvantage of these functions is that they cannot share any
information. If you wish to compute a number of them, then many values will be
repeatedly computed. For this reason, we created the Landscape
class
to simultaneously compute and several of these properties. This provides much
better performance overall.
API Documentation¶
Time Series Generation¶

neet.synchronous.
trajectory
(net, state, timesteps=1, encode=False)[source]¶ Generate the trajectory of length
timesteps+1
through the statespace, as determined by the network rule, beginning atstate
.Examples
>>> trajectory(ECA(30), [0, 1, 0], timesteps=3) [[0, 1, 0], [1, 1, 1], [0, 0, 0], [0, 0, 0]] >>> trajectory(ECA(30), [0, 1, 0], timesteps=3, encode=True) [2, 7, 0, 0] >>> trajectory(s_pombe, [0, 0, 0, 0, 1, 0, 0, 0, 0], timesteps=3, ... encode=True) [16, 256, 78, 128]
Parameters:  net – the network
 state – the network state
 timesteps – the number of steps in the trajectory
 encode – encode the states as integers
Returns: the trajectory as a list
Raises:  TypeError – if net is not a network
 ValueError – if
timesteps < 1

neet.synchronous.
transitions
(net, size=None, encode=False)[source]¶ Generate the onestep state transitions for a network over its state space.
Examples
>>> transitions(ECA(30), size=3) [[0, 0, 0], [1, 1, 1], [1, 1, 1], [1, 0, 0], [1, 1, 1], [0, 0, 1], [0, 1, 0], [0, 0, 0]] >>> transitions(ECA(30), size=3, encode=True) [0, 7, 7, 1, 7, 4, 2, 0] >>> len(transitions(s_pombe, encode=True)) 512
Parameters:  net – the network
 size – the size of the network (
None
if fixed sized)  encode – encode the states as integers
Returns: the onestate transitions as an array
Raises:  TypeError – if
net
is not a network  ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone

neet.synchronous.
timeseries
(net, timesteps, size=None)[source]¶ Return the timeseries for the network. The result will be a \(3D\) array with shape \(N \times V \times t\) where \(N\) is the number of nodes in the network, \(V\) is the volume of the state space (total number of network states), and \(t\) is
timesteps + 1
.>>> net = WTNetwork([[1,1],[1,0]]) >>> timeseries(net, 5) array([[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1]], [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]])
Parameters:  net – the network
 timesteps – the number of timesteps in the timeseries
 size – the size of the network (
None
if fixed sized)
Returns: a numpy array
Raises:  TypeError – if
net
is not a network  ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone
 ValueError – if
timesteps < 1
Synchronous Landscape Analysis Functions¶

neet.synchronous.
transition_graph
(net, size=None)[source]¶ Construct the state transition graph for the network.
Examples
>>> g = transition_graph(s_pombe) >>> g.number_of_nodes(), g.number_of_edges() (512, 512) >>> g = transition_graph(ECA(30), size=6) >>> g.number_of_nodes(), g.number_of_edges() (64, 64)
Parameters:  net – the network (if already a networkx.DiGraph, does nothing and returns it)
 size – the size of the network (
None
if fixed sized)  encode – encode the states as integers
Returns: a
networkx.DiGraph
of the network’s transition graphRaises:  TypeError – if
net
is not a network  ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone

neet.synchronous.
attractors
(net, size=None)[source]¶ Find the attractor states of a network. A generator of the attractors is returned with each attractor represented as a
list
of “encoded” states.Examples
>>> attractors(s_pombe) [[76], [4], [8], [12], [144, 110, 384], [68], [72], [132], [136], [140], [196], [200], [204]] >>> attractors(ECA(30), size=5) [[0], [14, 25, 7, 28, 19]]
Parameters:  net – the network or the transition graph
 size – the size of the network (
None
if fixed sized)
Returns: a list of attractor cycles
Raises:  TypeError – if
net
is not a network or anetworkx.DiGraph
 ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is a transition graph andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone

neet.synchronous.
basins
(net, size=None)[source]¶ Find the attractor basins of a network. A generator of the attractor basins is returned with each basin represented as a
networkx.DiGraph
whose nodes are the “encoded” network states.Examples
>>> b = basins(s_pombe) >>> [len(basin) for basin in b] [378, 2, 2, 2, 104, 6, 6, 2, 2, 2, 2, 2, 2] >>> b = basins(ECA(30), size=5) >>> [len(basin) for basin in b] [2, 30]
Parameters:  net – the network or landscape transition_graph
 size – the size of the network (
None
if fixed sized)
Returns: generator of basin subgraphs
Raises:  TypeError – if
net
is not a network or anetworkx.DiGraph
 ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is a transition graph andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone

neet.synchronous.
basin_entropy
(net, size=None, base=2)[source]¶ Calculate the basin entropy [Krawitz2007].
Examples
>>> basin_entropy(s_pombe) 1.221888833884975 >>> basin_entropy(s_pombe, base=10) 0.36782519036626105 >>> basin_entropy(ECA(30), size=5) 0.3372900666170139
Parameters:  net – the network or landscape transition_graph
 size – the size of the network (
None
if fixed sized)  base – base of logarithm used to calculate entropy (2 for bits)
Returns: value of basin entropy
Raises:  TypeError – if
net
is not a network or anetworkx.DiGraph
 ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is a transition graph andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone
Attractor Landscape¶

class
neet.synchronous.
Landscape
(net, size=None, index=None, pin=None, values=None)[source]¶ The
Landscape
class represents the structure and topology of the “landscape” of state transitions. That is, it is the state space together with information about state transitions and the topology of the state transition graph.
__init__
(net, size=None, index=None, pin=None, values=None)[source]¶ Construct the landscape for a network.
Examples
>>> Landscape(s_pombe) <neet.synchronous.Landscape object at 0x...> >>> Landscape(ECA(30), size=5) <neet.synchronous.Landscape object at 0x...>
Parameters:  net – the network
 size – the size of the network (
None
if fixed sized)  index – the index to update (or None)
 pin – the indices to pin during update (or None)
 values – a dictionary of indexvalue pairs to set after update
Raises:  TypeError – if
net
is not a network  ValueError – if
net
is fixed sized andsize
is notNone
 ValueError – if
net
is not fixed sized andsize
isNone

network
¶ The landscape’s dynamical network
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.network <neet.boolean.wtnetwork.WTNetwork object at 0x...>

size
¶ The number of nodes in the landscape’s dynamical network
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.size 9

transitions
¶ The state transitions array
The transitions array is an array, indexed by states, whose values are the subsequent state of the indexing state.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.transitions array([ 2, 2, 130, 130, 4, 0, 128, 128, 8, 0, 128, 128, 12, 0, 128, 128, 256, 256, 384, 384, 260, 256, 384, 384, 264, 256, ... 208, 208, 336, 336, 464, 464, 340, 336, 464, 464, 344, 336, 464, 464, 348, 336, 464, 464])

attractors
¶ The array of attractor cycles.
Each element of the array is an array of states in an attractor cycle.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.attractors array([array([76]), array([4]), array([8]), array([12]), array([144, 110, 384]), array([68]), array([72]), array([132]), array([136]), array([140]), array([196]), array([200]), array([204])], dtype=object)

attractor_lengths
¶ The length of each attractor cycle as an array, indexed by the attractor.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.attractor_lengths array([1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1])

basins
¶ The array of basin numbers, indexed by states.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.basins array([ 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0, 4, 4, 4, 4, ... 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

basin_sizes
¶ The basin sizes as an array indexed by the basin number.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.basin_sizes array([378, 2, 2, 2, 104, 6, 6, 2, 2, 2, 2, 2, 2])

in_degrees
¶ The indegree of each state as an array.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.in_degrees array([ 6, 0, 4, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 12, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

heights
¶ The height of each state as an array.
The height of a state is the number of time steps from that state to a state in it’s attractor cycle.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.heights array([7, 7, 6, 6, 0, 8, 6, 6, 0, 8, 6, 6, 0, 8, 6, 6, 8, 8, 1, 1, 2, 8, 1, 1, 2, 8, 1, 1, 2, 8, 1, 1, 2, 2, 2, 2, 9, 9, 1, 1, 9, 9, 1, 1, ... 3, 9, 9, 9, 3, 9, 9, 9, 3, 9, 9, 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])

recurrence_times
¶ The recurrence time of each state as an array.
The recurrence time is the number of time steps from that state until a state is repeated.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.recurrence_times array([7, 7, 6, 6, 0, 8, 6, 6, 0, 8, 6, 6, 0, 8, 6, 6, 8, 8, 3, 3, 2, 8, 3, 3, 2, 8, 3, 3, 2, 8, 3, 3, 4, 4, 4, 4, 9, 9, 3, 3, 9, 9, 3, 3, ... 3, 9, 9, 9, 3, 9, 9, 9, 3, 9, 9, 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])

trajectory
(init, timesteps=None, encode=None)[source]¶ Compute the trajectory of a state.
This method computes a trajectory from
init
to the last before the trajectory begins to repeat. Iftimesteps
is provided, then the trajectory will have a length oftimesteps + 1
regardless of repeated states. Theencode
argument forces the states in the trajectory to be either encoded or not. Whenencode is None
, whether or not the states of the trajectory are encoded is determined by whether or not the initial state (init
) is provided in encoded form.Note that when
timesteps is None
, the length of the resulting trajectory should be one greater than the recurrence time of the state.Examples
>>> landscape = Landscape(s_pombe) >>> landscape.trajectory([1,0,0,1,0,1,1,0,1]) [[1, 0, 0, 1, 0, 1, 1, 0, 1], ... [0, 0, 1, 1, 0, 0, 1, 0, 0]] >>> landscape.trajectory([1,0,0,1,0,1,1,0,1], encode=True) [361, 80, 320, 78, 128, 162, 178, 400, 332, 76] >>> landscape.trajectory(361) [361, 80, 320, 78, 128, 162, 178, 400, 332, 76] >>> landscape.trajectory(361, encode=False) [[1, 0, 0, 1, 0, 1, 1, 0, 1], ... [0, 0, 1, 1, 0, 0, 1, 0, 0]] >>> landscape.trajectory(361, timesteps=5) [361, 80, 320, 78, 128, 162] >>> landscape.trajectory(361, timesteps=10) [361, 80, 320, 78, 128, 162, 178, 400, 332, 76, 76]
Parameters:  init (
int
or an iterable) – the initial state  timesteps (
int
orNone
) – the number of time steps to include in the trajectory  encode (
bool
orNone
) – whether to encode the states in the trajectory
Returns: a list whose elements are subsequent states of the trajectory
Raises:  ValueError – if
init
an empty array  ValueError – if
timesteps
is less than \(1\)
 init (

timeseries
(timesteps)[source]¶ Compute the full time series of the landscape.
This method computes a 3dimensional array elements are the states of each node in the network. The dimensions of the array are indexed by, in order, the node, the initial state and the time step.
Examples
>>> landscape = Landscape(s_pombe) >>> landscape.timeseries(5) array([[[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], ..., [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0]], [[0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 0], ..., [0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0]], ... [[0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0], ..., [1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1], ..., [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0]]])
Parameters: timesteps ( int
) – the number of timesteps to evolve the systemReturns: a 3D array of node states Raises: ValueError – if timesteps
is less than \(1\)

basin_entropy
(base=2.0)[source]¶ Compute the basin entropy of the landscape [Krawitz2007].
This method computes the Shannon entropy of the distribution of basin sizes. The base of the logarithm is chosen to be the number of basins so that the result is \(0 \leq h \leq 1\). If there is fewer than \(2\) basins, then the base is taken to be \(2\) so that the result is never NaN. The base can be forcibly overridden with the
base
keyword argument.Examples
>>> landscape = Landscape(s_pombe) >>> landscape.basin_entropy() 1.221888833884975 >>> landscape.basin_entropy(base=2) 1.221888833884975 >>> landscape.basin_entropy(base=10) 0.36782519036626105 >>> landscape.basin_entropy(base=e) 0.8469488001650497
Parameters: base (a number or None
) – the base of the logarithmReturns: the basin entropy of the landscape of type float
