Computing Boolean networks dynamics with minibn

Computing Boolean networks dynamics with minibn#

The module minibn implements update modes for computing dynamics of minibn.BooleanNetwork objects. It is returned as networkx.DiGraph object.

from colomoto import minibn

Let us first define a simple Boolean network.

bn = minibn.BooleanNetwork({
    "a": "c",
    "b": "!a",
    "c": "!b"
})

By default the .dynamics method computes the dynamics according to the (fully) asynchronous update mode.

adyn = bn.dynamics()
adyn
# computing graph layout...
../../_images/65e8786eeb2d5c454e09abf665e31cfd478aa76f6c3ba8731fca4e7c207a3b73.svg

The networkx module implements a wide range of graph algorithms, such as computing strongly connected components:

import networkx as nx
list(nx.strongly_connected_components(adyn))
[{'010'}, {'101'}, {'000', '001', '011', '100', '110', '111'}]

The update mode can be specified as first argument. It can be either "asynchronous" (or equivalently "fully-asynchronous"), "general", or "synchronous". Custom update modes can also be implemented by inheriting from the minibn.UpdateModeDynamics.

bn.dynamics("synchronous")
# computing graph layout...
../../_images/5caf2f45a560a893bb55509b34095dd1d4bf1f71aa8127ed6d3eee652bcf5302.svg

Finally, one can also compute the dynamics only reachable from a specified initial state, specified with the init keyword:

bn.dynamics("synchronous", init={"a": 1, "b": 1, "c": 1})
# computing graph layout...
../../_images/2f555bf18320a16157e8002ce8c6b823232d52d0e5fba600441bb494ddbd7f1c.svg