The format for finite automaton rules used here is a list of entries of the form {s0, a0}{s1,a1}, where the si are states and the ai are symbols. (This ordering is consistent with NKS Turing machine usage. As for Turing machines, the states should be numbered starting at 1.)
The automaton for the lamplighter group is then:
lamp={{1,0}{1,1},{1,1}{2,0},{2,1}{1,1},{2,0}{2,0}};
FAStep::usage="FAStep[rule, init, list] applies the finite automaton represented by rule to list, starting with state init.";
FAStep[rule_,init_,list_]:=FoldList[{First[#1],#2}/.rule&,{init},list]
FAMap::usage="FAMap[rule, init, n] generates the mapping corresponding to finite automaton rule for sequences of length n.";
FAMap[rule_,init_,n_]:=With[{k=1+Max[#[[1,2]]&/@rule]},Table[{i,FromDigits[Last/@Rest[FAStep[rule,init,IntegerDigits[i,k,n]]],k]},{i,0,k^n-1}]]
This corresponds to a graph for a group.
The following produces a matrix version of the map. This can also be produced directly, using a 2D substitution system operating on matrices.
FAMapMatrix[rule_,init_,n_]:=With[{k=1+Max[#[[1,2]]&/@rule]},Normal[SparseArray[((#+1)1)&/@FAMap[rule,init,n],{k^n,k^n}]]]
FAMapSparseMatrix[rule_,init_,n_]:=With[{k=1+Max[#[[1,2]]&/@rule]},SparseArray[((#+1)1)&/@FAMap[rule,init,n],{k^n,k^n}]]
NOTE: It's not clear what to do if the matrix is singular... Ah .... these are the rules that are not invertible, and don't correspond to groups.
FAMapSparseLaplacian[rule_,n_]:=With[{s=Max[#[[1,1]]&/@rule]},Sum[(#+If[Det[#]0,Throw[sing],Inverse[#]])&[FAMapSparseMatrix[rule,i,n]],{i,s}]]
FAMapSpectrum[rule_,n_]:=Catch[{First[#],Length[#]}&/@Split[Sort[Eigenvalues[FAMapSparseLaplacian[rule,n]],Less]]]
FAMapSpectrum[lamp,5]
-2
3
,1,-1-5
,1,-22
,2,{-2,5},1-5
,1,{0,11},-1+5
,1,{2,5},22
,2,1+5
,1,23
,1,{4,1}FAMapSpectrum[lamp,6]
{Root[-8-8#1+2+&,1],1},-2+&,1],1},{-2,9},1-+&,2],1},{0,21},{Root[8-8#1-2+&,2],1},-1++&,3],1},2+&,3],1},{4,1}
2
#1
3
#1
3
,1,-1-5
,2,-22
,4,{Root[8-8#1-22
#1
3
#1
5
,2,{Root[-8-8#1+22
#1
3
#1
2
#1
3
#1
5
,2,{2,9},{Root[-8-8#1+22
#1
3
#1
2
,4,1+5
,2,23
,1,{Root[8-8#1-22
#1
3
#1
Note: it does not work to numericalize the matrices first. It prevents the distinct eigenvalues from readily be identified.
Tuples[list_,n_]:=Flatten[Outer[List,##,1]&@@Table[list,{n}],n-1]
AllFAs[s_,k_]:=With[{lhs=Flatten[Outer[List,Range[s],Range[0,k-1],1],1]},Thread[lhs#]&/@(Partition[#,2]&/@Flatten[Outer[List,##,1]&@@Flatten[Table[{Range[s],Range[0,k-1]},{sk}],1],2sk-1])]
Length[AllFAs[2,2]]
256
FAMapGraphic[rule_,init_,n_]:=With[{u=FAMap[rule,init,n]},Graphics[{AbsolutePointSize[1],Point/@u},AspectRatioAutomatic,FrameTrue,FrameTicksNone,PlotRange{{0,Length[u]-1},{0,Length[u]-1}}]]
Show[GraphicsArray[Partition[FAMapGraphic[#,1,6]&/@AllFAs[2,2],8]]];