In[]:=
VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{"AB"<->"B"},2,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule]
Out[]=
{ABB,AABB,ABAB,BB,AAAABB,AAABAB,AAABB,AABAAB,ABAAAB,ABAAB,BAAB,BAB}
In[]:=
VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{"AB"<->"B"},1,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule]
Out[]=
{ABB,AABB,ABAB,BB}
[[ Should be SC etc. ]]
In[]:=
AccumulativeTokenEventGraph[{"AB"<->"B"},2,"S","TokenLabeling"->True]
Out[]=
This does not work:
In[]:=
AccumulativeTokenEventGraph[{"AB"<->"B"},2,"SC"]
In[]:=
allrules=Union[Sort[Flatten[ResourceFunction["EnumerateSubstitutionSystemRules"][{Rule@@#},2]&/@Union[Sort/@Catenate[Table[{i,j},{i,1,3},{j,1,3}]]]]/.Rule->TwoWayRule]]
Out[]=
{AA,AAA,AAAA,AAAB,AAB,AABA,AABB,AB,ABAB,ABB,ABBB,AAAA,AAAAA,AAAAB,AAAB,AAABA,AAABB,AABAB,AABB,AABBB,AAAAAA,AAAAAB,AAAABA,AAAABB,AAABAB,AAABBB,AABAAA,AABAAB,AABABA,AABABB,AABBAA,AABBAB,AABBBA,AABBBB,ABAA,ABAAA,ABAAB,ABAB,ABABA,ABBA,ABBAA,ABAAAA,ABAAAB,ABAABA,ABAABB,ABABAB,ABABBB}
In[]:=
VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{"AB"<->"B"},2,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule]
Out[]=
{ABB,AABB,ABAB,BB,AAAABB,AAABAB,AAABB,AABAAB,ABAAAB,ABAAB,BAAB,BAB}
In[]:=
Inconsistencies[list_]:=Intersection[Sort/@list,Sort/@Map[StringReplace[#,{"A"->"B","B"->"A"}]&,list,{2}]]
In[]:=
Inconsistencies/@Table[VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{"AB"<->"B"},t,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule],{t,3}]
Out[]=
{{},{},{}}
In[]:=
Map[Function[ru,ru->TimeConstrained[(Inconsistencies/@Table[VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{ru},t,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule],{t,3}]),10]],RandomSample[allrules,10]]
Out[]=
{ABAAAA{{},{},{}},AAAAB{{},{},{}},AAAABB{{},{},{}},ABBA{{ABAB,ABBA,BABA},{ABAB,ABBA,BABA},{ABAB,ABBA,BABA}},AABBAB{{},{},{}},ABB{{},{},{}},ABAB{{},{},{}},ABAABB{{},{},{}},AAAB{{},{},{}},ABBAA{{},{},{}}}
In[]:=
ParallelMap[Function[ru,ru->TimeConstrained[(Inconsistencies/@Table[VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{ru},t,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule],{t,3}]),10]],RandomSample[allrules,10]]
Out[]=
{AAABAB{{},{},{}},AABBBA{{AABAAB,AABBBA,BBABBA},{AABAAB,AABBBA,BBABBA},{AABAAB,AABBBA,BBABBA}},ABAB{{},{},{}},ABAA{{},{},{}},AABBAB{{},{},{}},ABAAA{{},{},{}},AAABBB{{AAAAAA,AAABBB,BBBBBB},{AAAAAA,AAABBB,BBBBBB},{AAAAAA,AAABBB,BBBBBB}},ABAAAB{{},{},{}},ABAABB{{},{},{}},AAAA{{},{},{}}}
In[]:=
ParallelMap[Function[ru,ru->TimeConstrained[(Inconsistencies/@Table[VertexList[ResourceFunction["TokenEventGraph"][{{r1_,r2_}:>StringApply[r1,r2]},{ru},t,"TokenMultiplicity"->Automatic,"EventDeduplication"->True,"TokenLabeling"->False,GraphLayout->"LayeredDigraphEmbedding",AspectRatio->.5],_TwoWayRule],{t,3}]),10]],allrules]
Out[]=
{AA{{},{},{}},AAA{{},{},{}},AAAA{{},{},{}},AAAB{{},{},{}},AAB{{},{},{}},AABA{{},{},{}},AABB{{},{},{}},AB{{AA,AB,BB},{AA,AB,BB},{AA,AB,BB}},ABAB{{},{},{}},ABB{{},{},{}},ABBB{{},{},{}},AAAA{{},{},{}},AAAAA{{},{},{}},AAAAB{{},{},{}},AAAB{{},{},{}},AAABA{{},{},{}},AAABB{{},{},{}},AABAB{{},{},{}},AABB{{AAAA,AABB,BBBB},{AAAA,AABB,BBBB},{AAAA,AABB,BBBB}},AABBB{{},{},{}},AAAAAA{{},{},{}},AAAAAB{{},{},{}},AAAABA{{},{},{}},AAAABB{{},{},{}},AAABAB{{},{},{}},AAABBB{{AAAAAA,AAABBB,BBBBBB},{AAAAAA,AAABBB,BBBBBB},{AAAAAA,AAABBB,BBBBBB}},AABAAA{{},{},{}},AABAAB{{},{},{}},AABABA{{},{},{}},AABABB{{},{},{}},AABBAA{{},{},{}},AABBAB{{},{},{}},AABBBA{{AABAAB,AABBBA,BBABBA},{AABAAB,AABBBA,BBABBA},{AABAAB,AABBBA,BBABBA}},AABBBB{{},{},{}},ABAA{{},{},{}},ABAAA{{},{},{}},ABAAB{{},{},{}},ABAB{{},{},{}},ABABA{{},{},{}},ABBA{{ABAB,ABBA,BABA},{ABAB,ABBA,BABA},{ABAB,ABBA,BABA}},ABBAA{{},{},{}},ABAAAA{{},{},{}},ABAAAB{{},{},{}},ABAABA{{},{},{}},ABAABB{{},{},{}},ABABAB{{ABAABA,ABABAB,BABBAB},{ABAABA,ABABAB,BABBAB},{ABAABA,ABABAB,BABBAB}},ABABBB{{},{},{}}}
In[]:=
Select[%,Flatten[Last[#]]=!={}&]
Out[]=
{AB{{AA,AB,BB},{AA,AB,BB},{AA,AB,BB}},AABB{{AAAA,AABB,BBBB},{AAAA,AABB,BBBB},{AAAA,AABB,BBBB}},AAABBB{{AAAAAA,AAABBB,BBBBBB},{AAAAAA,AAABBB,BBBBBB},{AAAAAA,AAABBB,BBBBBB}},AABBBA{{AABAAB,AABBBA,BBABBA},{AABAAB,AABBBA,BBABBA},{AABAAB,AABBBA,BBABBA}},ABBA{{ABAB,ABBA,BABA},{ABAB,ABBA,BABA},{ABAB,ABBA,BABA}},ABABAB{{ABAABA,ABABAB,BABBAB},{ABAABA,ABABAB,BABBAB},{ABAABA,ABABAB,BABBAB}}}