I hadn't heard of the Kauffman automata before, but if it's an XOR cellular automata on a graph, then this shouldn't be too hard to construct. All updates are simultaneous and there is no propagation delay. If that is desired instead then you'd could randomly pick an order to update the cells.
SeedRandom[1];
g = RandomGraph[{30, 55}, DirectedEdges -> True];
(*don't care about disconnected components,choose the largest graph*)
g = First[MaximalBy[ConnectedGraphComponents[g], VertexCount]];
nodes = VertexList[g];
state = AssociationThread[nodes, RandomInteger[1, Length[nodes]]];
newstate = state;
colour[s_] := If[s == 1, Green, Red]
inputs[node_] :=
Cases[IncidenceList[g, node], DirectedEdge[x_, node]][[All, 1]]
xor[node_] := BitXor @@ (state[#] & /@ inputs[node])
iterations = 50;
results = Reap[Do[Scan[Set[newstate[#], xor[#]] &, nodes];
state = newstate;
Sow[Graph[EdgeList[g],
VertexStyle -> KeyValueMap[#1 -> colour[#2] &, state]]];,
iterations]][[2, 1]];
ListAnimate[results]
We can find the period of the above network by recording the states and using FindRepeat
. Clear your kernel with Remove["Global`*"]
to reset the state and execute the first two paragraphs of the code. Instead of that last paragraph of the code execute the following:
iterations = 2000;
statelist = Reap[Do[Scan[Set[newstate[#], xor[#]] &, nodes];
state = newstate;
Sow[state];
, iterations]][[2, 1]];
FindRepeat[statelist] // Length
(* result: 254 *)
Here's a different network with a $\tanh(\sum{x_i})$ update function instead of XOR:
SeedRandom[123456];
g = RandomGraph[{115, 250}, DirectedEdges -> True];
(* don't care about disconnected components, choose the largest graph *)
g = First[MaximalBy[ConnectedGraphComponents[g], VertexCount]];
nodes = VertexList[g];
state = AssociationThread[nodes, RandomReal[{-1, 1}, Length[nodes]]];
newstate = state;
colour[s_] := Rescale[s, {-1, 1}] // Hue
inputs[node_] :=
Cases[IncidenceList[g, node], DirectedEdge[x_, node]][[All, 1]]
tanhupdate[node_] :=
Tanh[Total[(state[#] & /@ inputs[node])]]
iterations = 25;
results = Reap[Do[
Scan[Set[newstate[#], tanhupdate[#]] &, nodes];
state = newstate;
Sow[Graph[EdgeList[g],
VertexStyle -> KeyValueMap[#1 -> colour[#2] &, state],
VertexSize -> 1]];
, iterations]][[2, 1]];
ListAnimate[results]