Commit 5b960a22 authored by Karim El Sheikh's avatar Karim El Sheikh
Browse files

Updated the project massively: documentation improved, cleaned up the testing...

Updated the project massively: documentation improved, cleaned up the testing code, and improved various parts in the batch files which made it more readable.
The batch file now writes the modified "gap.bat" in the temporary directory instead of the same directory, this might help in cases where the user does not have write access in the batch directory.
The spelling of some of the words was changed to the english spelling (color instead of colour) to be more in line with American academia.
parent a481e1ab
# k-dimensional Weisfeiler-Lehman for Group Isomorphism
An implementation of the k-dimensional Weisfeiler-Lehman method to test Group Isomorphism between 2 groups given by a list of generators.
The implementation is programmed in the Java language.
It is a 2-dimensional Weisfeiler-Lehman that considers every pair of elements. It is possible to extend it to any k and not very hard even, but it is not on my plans now.
Hopefully soon, I will try to package this project in a more proper manner while documenting the main class better...
A Java implementation of the k-dimensional Weisfeiler-Lehman method to test Group Isomorphism between 2 groups given by a list of generators with various tests to help analyze the method.
It is a 2-dimensional Weisfeiler-Lehman that considers every pair of elements. It is possible to extend it to any k and not very hard even, but it is not on our plans now.
## Information
* Eclipse project folder is "kWL".
* Test examples are available in the main method of the class "kWLClass" in the file "kWLClass.java". Others are in a main method that is commented out.
* This project is developed and tested using the Eclipse IDE for Java EE Developers.
* Test examples are available in the main method of the class "kWLClass". Others are available in the "Checking" class.
* This project is developed and tested using the Eclipse IDE for Java EE Developers, and is ran under Java SE Development Kit 8 for testing.
* Of the information gained from this project so far: 10 pairs of groups of the order 128 are undifferentiated by the 2-dimensional kWL method, and for order 256, for the first 8000 groups (Going by GAP numbering), there are over 150 pairs. The IDs of the pairs for order 128 are outlined in the report.
## k-dimensional Weisfeiler-Lehman
The k-dimensional Weisfeiler-Lehman method is a combinatorial method that is used to test graph isomorphism and has been widely studied in the literature for graph isomorphism. In most cases (informally speaking) it will detect a difference between 2 non-isomorphic graphs, this applies to even the 1-dimensional one. For group isomorphism, the same idea was applied with a sensible notion of an initial colour for every pair of the group (hence 2-dimensional).
## Technical...
Note that the file run.bat basically detects the installation directory of GAP, and copies the original "gap.bat" to the current directory, changes a few lines in it then it runs it.
The changes in "gap.bat" are as follows:
## To do
* It is possible to drastically reduce the memory usage if we index the the colors while we haven't still finalized the color set. It is on plan soon.
* Also on plan is to change the serialization of the information gathered by the algorithm to be more portable and future-proof for any class name changes, etc... . Probably, we will seek some text or binary format.
* Rest of the documentation in the classes: "Checking", "kWLclass", and "GroupInvariant".
It changes the line that sets the home directory to be instead the directory of the project "kWL" in the workspace "eclipse-workspace",
and then runs the file "1.g". If you want you can instead do the same (setting the home directory and run the file "1.g" in your own way).
## Notes about the usage of the batch files
About what the files "OutputGroupsStartingFromOrder*.bat" do:
* They detect the installation directory of GAP through registry<font><sup>[1](#footnote1)</sup></font>, and copy the original "gap.bat" (from gap-4.11.0\bin\ under Windows) to a temporary file in the working directory, then change 2 specific lines in it then run the resulting batch file.
* The changes done to "gap.bat" (effective in temporary file only): Now it changes the working directory to "C:\Users\<User name>\eclipse-workspace\kWL" where we assumed the directory of the Java project will be. And additionally modifies the line that starts GAP ("mintty.exe") to load the respective "OutputGroupsStartingFromOrder*.g" file from the working directory.
* Now it runs the modified and temporary batch file to launch GAP then deletes it immediately.
* You may want do set the working directory and run the files "OutputGroupsStartingFromOrder*.g" in your own way.
<font size="-1"><a name="footnote1">1</a>: Hence, these files only work if you use Windows and installed GAP (not merely extracted the archive or built it from the source).</font>
# License
This project is licensed under [GNU Lesser GPL](https://www.gnu.org/licenses/lgpl-3.0.html). The Indexed TreeSet and TreeMap data structures by "Vitaly Sazanovich" are under the same license, the code
for these data structures is exactly the same except for the package name changes as well as the access modifier changes outlined in the beginning of the file "IndexedTreeMap.java".
\ No newline at end of file
This project is licensed under [GNU GPL](https://www.gnu.org/licenses/gpl-3.0.html). The Indexed TreeSet and TreeMap [data structures](https://code.google.com/archive/p/indexed-tree-map/) by "Vitaly Sazanovich" are under the [GNU Lesser GPL license](https://www.gnu.org/licenses/lgpl-3.0.html).
\ No newline at end of file
LoadPackage("sonata");
f := function()
local s, a, b, x, o, G, L, fileName, order, numberHavingOrder, testInt;
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-4] }, "Stream.txt"));
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-4] }, "Stream2.txt"));
fileName := Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-4] }, "Stream2.txt");
s := InputTextFile(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-4] }, "Stream.txt"));
#o := OutputTextFile(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-4] }, "Stream2.txt"), true);
order := 256;
numberHavingOrder := 56092;
Print("Order: ", 256, "\n");
while true do
if s <> fail then
a := ReadAll(s);
if a <> fail then
b := SplitString(a, "\n");
for x in b do
if x <> "" and Int(x) <= numberHavingOrder then
Print(x, "\n");
#if o <> fail then
G := AsPermGroup(SmallGroup(order, Int(x)));
L := MinimalGeneratingSet(G);
PrintTo(fileName, L{[1..Length(L)]}, "\n");
#Print(L{[1..Length(L)]}, "\nDone\n");
#fi;
else
order := order + 1;
Print("\nOrder: ", order, "\n");
numberHavingOrder := NumberSmallGroups(order);
PrintTo(fileName, numberHavingOrder, "\n");
break;
fi;
od;
fi;
fi;
od;
end;
f();
\ No newline at end of file
This diff is collapsed.
@Echo off
REM This file's main purpose is to run GAP with the correct working Directory,
REM and open OutputGroupsStartingFromOrder.g that's located in the working Directory.
REM All it does is copy your default gap.bat, modify lines
REM numbered #6 and #7 in the copied version and then run it.
REM In the next line, set the working directory you'll be using to run the java classes (kWLClass and Checking), and GAP
REM will launch with the working directory specified here so that they're both able to communicate with each other.
Set "GAPandJavaWorkingDir=%HOMEDRIVE%%HOMEPATH%\eclipse-workspace\kWL"
Set "gap49026Temp=%TEMP%.\gap49026.tmp.bat"
for /F "usebackq skip=2 tokens=2* eol= " %%a in (`REG QUERY HKEY_CURRENT_USER\Software\GAP /ve 2^>nul`) do (
Set "gap49026Inst=%%b"
)
SetLocal EnableDelayedExpansion EnableExtensions
Set "TempFile=%gap49026Temp%"
Set "InstallDirectory=%gap49026Inst%"
Echo( 2>"%TempFile%"
REM Special for loop options parameter which is unquoted with every delimiter escaped, to allow for no delims and no eol
REM (i.e., Just read the whole line).
for /F usebackq^ tokens^=*^ delims^=^ eol^= %%a in ("%InstallDirectory%\bin\gap.bat") do (
Set "Line=%%a"
Set "Test=!Line:~0,9!"
REM This next line replaces all double quotes from the string Test by 2 double quotes
Set Test=!Test:"=""!
if "!Test!"=="cd %%HOME%%" (
>>"%TempFile%" (
Echo cd %GAPandJavaWorkingDir%
)
) else if "!Test!" == "start ""GA" (
>>"%TempFile%" (
Echo !Line! OutputGroupsStartingFromOrder128.g
)
) else (
>>"%TempFile%" (
Echo !Line!
)
)
)
EndLocal
Start /D "%gap49026Inst%" /Wait %ComSpec% /c "%gap49026Temp%"
Del %gap49026Temp%
Set GAPandJavaWorkingDir=
Set gap49026Temp=
Set gap49026Inst=
\ No newline at end of file
LoadPackage("sonata");
f := function()
local a, b, s, G, L, streamFile1, streamFile2, integerFromStream1, curOrder, numberOfGroupsHavingOrder;
# Under Windows by default GAPInfo.UserGapRoot is the directory C:/Users/<username>/_gap
# Our launcher batch file, changes the home directory
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamJavaToGAP.txt"));
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamGAPToJava.txt"));
streamFile1 := InputTextFile(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamJavaToGAP.txt"));
streamFile2 := Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamGAPToJava.txt");
curOrder := 128; # The starting oder of Groups, change it to match the java call of generateInvariants() in the class "kWLClass"
numberOfGroupsHavingOrder := NumberSmallGroups(curOrder);
# Print("Order: ", curOrder, "\n");
Print("Order: ", curOrder, " (", numberOfGroupsHavingOrder, " groups)\n");
while true do
if streamFile1 <> fail then
a := ReadAll(streamFile1);
if a <> fail then
b := SplitString(a, "\n");
for integerFromStream1 in b do
if integerFromStream1 <> "" and Int(integerFromStream1) <= numberOfGroupsHavingOrder then
Print(integerFromStream1, "\n");
#if o <> fail then
G := AsPermGroup(SmallGroup(curOrder, Int(integerFromStream1)));
L := MinimalGeneratingSet(G);
PrintTo(streamFile2, L{[1..Length(L)]}, "\n");
#Print(L{[1..Length(L)]}, "\nDone\n");
#fi;
else
curOrder := curOrder + 1;
Print("\nOrder: ", curOrder, "\n");
numberOfGroupsHavingOrder := NumberSmallGroups(curOrder);
PrintTo(streamFile2, numberOfGroupsHavingOrder, "\n");
break;
fi;
od;
fi;
fi;
od;
end;
Print(IO_getcwd(), "\n");
f();
\ No newline at end of file
@Echo off
REM This file's main purpose is to run GAP with the correct working Directory,
REM and open OutputGroupsStartingFromOrder.g that's located in the working Directory.
REM All it does is copy your default gap.bat, modify lines
REM numbered #6 and #7 in the copied version and then run it.
REM In the next line, set the working directory you'll be using to run the java classes (kWLClass and Checking), and GAP
REM will launch with the working directory specified here so that they're both able to communicate with each other.
Set "GAPandJavaWorkingDir=%HOMEDRIVE%%HOMEPATH%\eclipse-workspace\kWL"
Set "gap49026Temp=%TEMP%.\gap49026.tmp.bat"
for /F "usebackq skip=2 tokens=2* eol= " %%a in (`REG QUERY HKEY_CURRENT_USER\Software\GAP /ve 2^>nul`) do (
Set "gap49026Inst=%%b"
)
SetLocal EnableDelayedExpansion EnableExtensions
Set "TempFile=%gap49026Temp%"
Set "InstallDirectory=%gap49026Inst%"
Echo( 2>"%TempFile%"
REM Special for loop options parameter which is unquoted with every delimiter escaped, to allow for no delims and no eol
REM (i.e., Just read the whole line).
for /F usebackq^ tokens^=*^ delims^=^ eol^= %%a in ("%InstallDirectory%\bin\gap.bat") do (
Set "Line=%%a"
Set "Test=!Line:~0,9!"
REM This next line replaces all double quotes from the string Test by 2 double quotes
Set Test=!Test:"=""!
if "!Test!"=="cd %%HOME%%" (
>>"%TempFile%" (
Echo cd %GAPandJavaWorkingDir%
)
) else if "!Test!" == "start ""GA" (
>>"%TempFile%" (
Echo !Line! OutputGroupsStartingFromOrder3.g
)
) else (
>>"%TempFile%" (
Echo !Line!
)
)
)
EndLocal
Start /D "%gap49026Inst%" /Wait %ComSpec% /c "%gap49026Temp%"
Del %gap49026Temp%
Set GAPandJavaWorkingDir=
Set gap49026Temp=
Set gap49026Inst=
\ No newline at end of file
LoadPackage("sonata");
f := function()
local a, b, s, G, L, streamFile1, streamFile2, integerFromStream1, curOrder, numberOfGroupsHavingOrder;
# Under Windows by default GAPInfo.UserGapRoot is the directory C:/Users/<username>/_gap
# Our launcher batch file, changes the home directory
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamJavaToGAP.txt"));
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamGAPToJava.txt"));
streamFile1 := InputTextFile(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamJavaToGAP.txt"));
streamFile2 := Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamGAPToJava.txt");
curOrder := 3; # The starting oder of Groups, change it to match the java call of generateInvariants() in the class "kWLClass"
numberOfGroupsHavingOrder := NumberSmallGroups(curOrder);
# Print("Order: ", curOrder, "\n");
Print("Order: ", curOrder, " (", numberOfGroupsHavingOrder, " groups)\n");
while true do
if streamFile1 <> fail then
a := ReadAll(streamFile1);
if a <> fail then
b := SplitString(a, "\n");
for integerFromStream1 in b do
if integerFromStream1 <> "" and Int(integerFromStream1) <= numberOfGroupsHavingOrder then
Print(integerFromStream1, "\n");
#if o <> fail then
G := AsPermGroup(SmallGroup(curOrder, Int(integerFromStream1)));
L := MinimalGeneratingSet(G);
PrintTo(streamFile2, L{[1..Length(L)]}, "\n");
#Print(L{[1..Length(L)]}, "\nDone\n");
#fi;
else
curOrder := curOrder + 1;
Print("\nOrder: ", curOrder, "\n");
numberOfGroupsHavingOrder := NumberSmallGroups(curOrder);
PrintTo(streamFile2, numberOfGroupsHavingOrder, "\n");
break;
fi;
od;
fi;
fi;
od;
end;
Print(IO_getcwd(), "\n");
f();
\ No newline at end of file
@Echo off
REM This file's main purpose is to run GAP with the correct working Directory,
REM and open OutputGroupsStartingFromOrder.g that's located in the working Directory.
REM All it does is copy your default gap.bat, modify lines
REM numbered #6 and #7 in the copied version and then run it.
REM In the next line, set the working directory you'll be using to run the java classes (kWLClass and Checking), and GAP
REM will launch with the working directory specified here so that they're both able to communicate with each other.
Set "GAPandJavaWorkingDir=%HOMEDRIVE%%HOMEPATH%\eclipse-workspace\kWL"
Set "gap49026Temp=%TEMP%.\gap49026.tmp.bat"
for /F "usebackq skip=2 tokens=2* eol= " %%a in (`REG QUERY HKEY_CURRENT_USER\Software\GAP /ve 2^>nul`) do (
Set "gap49026Inst=%%b"
)
SetLocal EnableDelayedExpansion EnableExtensions
Set "TempFile=%gap49026Temp%"
Set "InstallDirectory=%gap49026Inst%"
Echo( 2>"%TempFile%"
REM Special for loop options parameter which is unquoted with every delimiter escaped, to allow for no delims and no eol
REM (i.e., Just read the whole line).
for /F usebackq^ tokens^=*^ delims^=^ eol^= %%a in ("%InstallDirectory%\bin\gap.bat") do (
Set "Line=%%a"
Set "Test=!Line:~0,9!"
REM This next line replaces all double quotes from the string Test by 2 double quotes
Set Test=!Test:"=""!
if "!Test!"=="cd %%HOME%%" (
>>"%TempFile%" (
Echo cd %GAPandJavaWorkingDir%
)
) else if "!Test!" == "start ""GA" (
>>"%TempFile%" (
Echo !Line! OutputGroupsStartingFromOrder33.g
)
) else (
>>"%TempFile%" (
Echo !Line!
)
)
)
EndLocal
Start /D "%gap49026Inst%" /Wait %ComSpec% /c "%gap49026Temp%"
Del %gap49026Temp%
Set GAPandJavaWorkingDir=
Set gap49026Temp=
Set gap49026Inst=
\ No newline at end of file
LoadPackage("sonata");
f := function()
local a, b, s, G, L, streamFile1, streamFile2, integerFromStream1, curOrder, numberOfGroupsHavingOrder;
# Under Windows by default GAPInfo.UserGapRoot is the directory C:/Users/<username>/_gap
# Our launcher batch file, changes the home directory
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamJavaToGAP.txt"));
PrintTo(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamGAPToJava.txt"));
streamFile1 := InputTextFile(Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamJavaToGAP.txt"));
streamFile2 := Concatenation(GAPInfo.UserGapRoot{ [1..Length(GAPInfo.UserGapRoot)-5] }, "/eclipse-workspace/kWL/StreamGAPToJava.txt");
curOrder := 33; # The starting oder of Groups, change it to match the java call of generateInvariants() in the class "kWLClass"
numberOfGroupsHavingOrder := NumberSmallGroups(curOrder);
# Print("Order: ", curOrder, "\n");
Print("Order: ", curOrder, " (", numberOfGroupsHavingOrder, " groups)\n");
while true do
if streamFile1 <> fail then
a := ReadAll(streamFile1);
if a <> fail then
b := SplitString(a, "\n");
for integerFromStream1 in b do
if integerFromStream1 <> "" and Int(integerFromStream1) <= numberOfGroupsHavingOrder then
Print(integerFromStream1, "\n");
#if o <> fail then
G := AsPermGroup(SmallGroup(curOrder, Int(integerFromStream1)));
L := MinimalGeneratingSet(G);
PrintTo(streamFile2, L{[1..Length(L)]}, "\n");
#Print(L{[1..Length(L)]}, "\nDone\n");
#fi;
else
curOrder := curOrder + 1;
Print("\nOrder: ", curOrder, "\n");
numberOfGroupsHavingOrder := NumberSmallGroups(curOrder);
PrintTo(streamFile2, numberOfGroupsHavingOrder, "\n");
break;
fi;
od;
fi;
fi;
od;
end;
Print(IO_getcwd(), "\n");
f();
\ No newline at end of file
karim
elsheikh
cs.uni
gmail.com
vitaly
sazanovich
scrappy
cormen
leiserson
behavior
bloch
josh
int
filepath
subfolder
ids
multiset
weisfeiler
lehman
ith
arg
shortlex
multisets
csv
whitespaces
dihedral
abelian
quaternion
positionally
serializable
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment