Read("sshadam.gapdata"); N := Length(sshadam[1]) - 1; NUM := Length(sshadam) * (N+1); RequirePackage("grape"); ############################################### AdjacencyMatrices := function(M) local A, i, j, k, n, d; n := Length(M); d := Maximum(List(M, Maximum)); A := []; for i in [1..d+1] do A[i] := NullMat(n, n); od; for i in [1..n] do for j in [1..n] do A[M[i][j]+1][i][j] := 1; od; od; return A; end; ############################################### diagmat := function(L) local M, n, i; n := Length(L); M := NullMat(n, n); for i in [1..n] do M[i][i] := L[i]; od; return M; end; ############################################### sshm2as := function(H) local AS, H2, D, n, i, j, k, M, L, P; L := []; n := Length(H); for i in [1..n] do D := diagmat(H[i]); H2 := D * H * D; AS := NullMat(n-1,n-1); for j in [1..i-1] do for k in [1..i-1] do AS[j][k] := H2[j][k]; od; for k in [i..n-1] do AS[j][k] := H2[j][k+1]; od; od; for j in [i..n-1] do for k in [1..i-1] do AS[j][k] := H2[j+1][k]; od; for k in [i..n-1] do AS[j][k] := H2[j+1][k+1]; od; od; for j in [1..n-1] do for k in [1..n-1] do if AS[j][k] = -1 then AS[j][k] := 2; fi; if j = k then AS[j][k] := 0; fi; od; od; Add(L, AS); od; return L; end; ############################################### mkas := function(L) local ans, H, ASS; ans := []; for H in L do ASS := sshm2as(H); Append(ans, ASS); # ans := Set(ans); od; return ans; end; ############################################# as := mkas(sshadam); PrintTo("as.gapdata", "as :=\n", as, ";\n"); Print("# as list made\n"); #Read("as.gapdata"); ############################## CombL := Combinations([1..N], 3); mkcombindata := function(M) local ans, x, pd, i, n; n := Length(M); ans := []; for x in CombL do pd := 0; for i in [1..n] do pd := pd + M[x[1]][i]*M[x[2]][i]*M[x[3]][i]; od; Add(ans, pd); od; ans := Collected(ans); return ans; end; mkcombindata2 := function(R) local adj; adj := AdjacencyMatrices(R); return Set([mkcombindata(adj[2]),mkcombindata(adj[3])]); end; ############################## as2graph := function(R, i) local gr, x, y, n; n := Length(R); gr := Graph(Group(()), [1..n], OnPoints, function(x,y) return R[x][y]=i; end); return gr; end; ############################## asisom := function(R1, R2) if IsIsomorphicGraph(as2graph(R1, 1), as2graph(R2, 1)) then return true; fi; if IsIsomorphicGraph(as2graph(R1, 1), as2graph(R2, 2)) then return true; fi; return false; end; ############################## comb3data := List(as, mkcombindata2); Print("# combindata made\n"); PrintTo("comb3data.gapdata", "comb3data:=\n", comb3data, ";\n"); #Read("comb3data.gapdata"); makerep := function(L) local rep, i, isnew, x; isnew := function(x) local i; for i in rep do if comb3data[i] = comb3data[x] then if asisom(L[i], L[x]) then return false; fi; fi; od; return true; end; rep := []; for i in [1..NUM] do if isnew(i) then Add(rep, i); # Print([Length(rep), i], "\n"); fi; od; return rep; end; rep := makerep(as); PrintTo("rep.gapdata", "rep := \n", rep, ";\n"); #Print("rep completed\n");