(* Basic format: {{v1, {p1L, p1R}}, {v2, {p2L, p2R}}, ....} Rule: valnum -> {vp, {dexlist1, dexlist2}} (* rearrange connections *) valnum -> {{}, {dexlist}} (* delete node *) valnum -> {{vp0, vp1}, {dexlistold}, {dexlistnew}} *) GetValues[list_List] := (FromDigits[{First[list[[First[Last[#]]]]], First[#], First[list[[Last[Last[#]]]]]}, 2]& /@ list) GoPath[list_, i_, dexes_List] := Fold[(list[[#1]][[#2]])&, i, dexes] ApplyRule[{vp_Integer, {dex1_List, dex2_List}}, list_List, i_Integer] := {vp, {GoPath[list, i, dex1], GoPath[list, i, dex2]}} (*** ApplyRule[{{}, {dex_List}}, list_List, i_Integer] := (* deletion requires back pointers *) ****) (******* GetNeighborsList[list_, i_Integer, n_Integer] := NestList[ Union[Flatten[list[[#]]]]&, list[[i]], n] GoPath[list_, i_, dexes_List] := Fold[(list[[#1]][[#2]])&, i, dexes] RandomNet[tot_, valence_:2] := Table[Random[Integer, {1, tot}], {tot}, {valence}] CyclicNet[tot_] := RotateRight[ Table[Mod[{i-1, i+1}, tot] + 1, {i, tot}] ] (* eqtest[list_, dex1_, dex2_] := Count[Table[GoPath[list, i, dex1] == GoPath[list, i, dex2], {i, Length[list]}], True] *) (* simpleupdate[rule_, list_] := Table[GoPath[list, i, #]& /@ rule, {i, Length[list]}] *) NetGraphic[history_] := Graphics[ Table[Table[{Line[{{x, -y}, {history[[y, x, 1]], -y-1}}], Line[{{x, -y}, {history[[y, x, 2]], -y-1}}]}, {x, Length[First[history]]}], {y, Length[history]}], AspectRatio->Automatic] *******)