CANA icon indicating copy to clipboard operation
CANA copied to clipboard

wrong attractors for networks with constants

Open stas-g opened this issue 3 years ago • 0 comments

as per the title, i get wrong attractors with any constants in the network. consider two simple networks, L and N, respectively:

x *= 1
y *= x
z *= y

and

x *= x
y *= x
z *= y

read in:

#constant setup: 1 -> x -> y -> z    
L = boolean_network.BooleanNetwork.from_file("xxx.txt", type = 'logical', name = "test", keep_constants = True)
#self-feeding setup: x -> x -> y -> z
N = boolean_network.BooleanNetwork.from_file("yyy.txt", type = 'logical', name = "test", keep_constants = True)  

now, L has only one attractor, "111", whilst N has two, "111" and "000". however

att_L = L.attractors()    
att_N = N.attractors()    
    
att_L
Out[11]: [[3]]

att_N
Out[12]: [[0], [7]]

cutils.statenum_to_binstate(att_L[0][0], len(L.nodes))
Out[14]: '011'  

[cutils.statenum_to_binstate(att_N[i][0], len(N.nodes)) for i in range(len(att_N))]
Out[15]: ['000', '111']

to get the correct (kind of, assuming value of 1 is implied for x) attractor for L, one needs to account for constants:

cutils.statenum_to_binstate(att_L[0][0], len(L.nodes) - 1)
Out[16]: '11'

one can get the correct trajectory to an attractor though + correct attractor:

L.trajectory_to_attractor('000', return_attractor = True)    
Out[19]: (['000', '100', '110', '111'], [3])

stas-g avatar Jul 05 '22 10:07 stas-g