HelpM:=proc(): print(`V(A,k), G(A,k) , Assemble(P)`): print(`DeB(A,k), AssembleE, DEBE(a,k), DeBEfast(A,k)`): end: read HAMILTON: read EULER: #V(A,k): all the k-letter words in the alphabet A V:=proc(A,k) local V1: if k=0 then RETURN({[]}): fi: V1:=V(A,k-1): {seq(seq([op(V1[i]), A[j]],j=1..nops(A)),i=1..nops(V1))}: end: #G(A,k): given an alphabet A and a pos. integer k #constructs the graph [V,E] whose set of vertices V #are all the k-letter words in A, and [u,v] is #an edge iff op(2..k,u)=op(1..k-1,v) # G:=proc(A,k) local V1,E1,i,j,v1: V1:=V(A,k): E1:={}: for i from 1 to nops(V1) do v1:=V1[i]: E1:=E1 union {seq([v1, [op(2..k,v1),A[j]]],j=1..nops(A))}: od: [V1,E1]: end: Assemble:=proc(P) local i,k: k:=nops(P[1]): [op(P[1]),seq(P[i][k],i=2..nops(P))]: end: #DeB(A,k): inputs an alphabet A and a pos. integer k #outputs all the words of length 2^nops(A)+k-1 #such that all the 2^(nops(A)) k-windows give #the set of all words. For example DeB({0,1},3); DeB:=proc(A,k) local G1,S,i: G1:=G(A,k): S:=Ham(G1): {seq(Assemble(S[i]),i=1..nops(S))}: end: AssembleE:=proc(P) local i,k: k:=nops(P[1][1])+1: [op(P[1][1]),seq(P[i][2][k-1],i=1..nops(P))]: #Assemble(Assemble(P)): end: #DeBE(A,k): inputs an alphabet A and a pos. integer k #outputs all the words of length 2^nops(A)+k-1 #such that all the 2^(nops(A)) k-windows give #the set of all words. For example DeB({0,1},3); DeBE:=proc(A,k) local G1,S,i: G1:=G(A,k-1): S:=EulerB(G1): {seq(AssembleE(S[i]),i=1..nops(S))}: end: #DeBEfast(A,k): inputs an alphabet A and a pos. integer k #outputs all the words of length 2^nops(A)+k-1 #such that all the 2^(nops(A)) k-windows give #the set of all words. For example DeB({0,1},3); DeBEfast:=proc(A,k) local G1,S,i,w: G1:=G(A,k-1): w:=Fleury(G1,[0$(k-1)]): [op(w[1]),seq(w[i][nops(w[i])],i=2..nops(w))]: end: