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...
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...
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...