Rule Signatures
Rule Signatures
A rule signature can be specified as:
{{{multiplicity,arity},{multiplicity,arity},...}{...},...}
RuleSignatureForm
RuleSignatureForm
In[]:=
RuleSignatureForm[s:({{_Integer,_Integer}...}->{{_Integer,_Integer}...})]:=RSF0/@s
In[]:=
RuleSignatureForm[s_List]:=RuleSignatureForm/@s
Note reverse sorting by arity:
In[]:=
RSF0[s:{{_Integer,_Integer}...}]:=Row[Subscript[#1,#2]&@@@ReverseSortBy[s,Last]]
In[]:=
RuleSignatureForm[{{1,3}}{{4,3}}]
Out[]=
1
3
4
3
In[]:=
RuleSignatureForm[{{1,3},{2,2}}{{4,3},{5,2}}]
Out[]=
1
3
2
2
4
3
5
2
Also to be specified is the number of symbols, all of which are interchangeable.
Functions Needs\bed
Functions Needs\bed
RuleSignatureCount
RuleSignatureCount
Count the total number of distinct rules with a given signature
RuleSignatureEnumerate
RuleSignatureEnumerate
Enumerate distinct rules with a given signature
RuleSignatureRandom
RuleSignatureRandom
Generate a random rule with a given signature
AllRuleSignatures
AllRuleSignatures
A list of the first n possible signatures in some reasonable enumeration order
2ary Edge Enumeration [ old code ]
2ary Edge Enumeration [ old code ]
(Using a different notation for the signature)
In[]:=
RuleShapeToCases[lr:{_,_},s_Integer]:=Union[mincase[#,s]&/@rcases[lr,s]]
In[]:=
RuleShapeListToCases[llr_List,s_Integer]:=DeleteDuplicates[Map[Sort,Flatten[Apply[Outer[List,##,2]&,RuleShapeToCases[#,s]&/@llr],1],{2}]]
In[]:=
rcases[lr:{_,_},s_Integer]:=Apply[Rule,(Partition[#,2]&/@TakeList[#,2lr])&/@Tuples[Range[s],2Total[lr]],{1}]
Find the minimal representative based on relabeling symbols and permuting edges:
In[]:=
mincase[rule_,s_Integer]:=First[Sort[Map[Sort,(rule/.#)&/@(Thread[Range[s]#]&/@Permutations[Range[s]]),{2}]]]
This corresponds to signature:
In[]:=
{{1,2}}{{2,2}}//RuleSignatureForm
Out[]=
1
2
2
2
In[]:=
Union[RuleShapeListToCases[{{1,2}},2]]
Out[]=
Results
Results
Counts for 2 symbols: [ should be confirmed ]
In[]:=
Grid[Table[{RuleSignatureForm[{{i,2}}{{j,2}}],Length[Union[RuleShapeListToCases[{{i,j}},2]]]},{j,4},{i,4}],FrameAll]
Out[]=
The Enumeration Setup
The Enumeration Setup
A typical instance of might be:
2
2
3
2
{{1,1},{2,1}}{{2,1},{2,2},{2,2}}
The ordering inside the outer list doesn’t matter.
The ordering within each sublist does matter.
The names of the symbols don’t matter.
Formulas for the total counts would be nice, but are not essential.