On 22.03.2013, at 19:53, Mathieu Dutour wrote:

> The basic strategy in that case is that you write a perl
> script that reads as input the file from Spence web page
> and then write as output in a format that GAP can read.
> 
> You can of course use Python or any other language that
> has good text capabilities.

Actually, it would be rather easy to read the files with GAP itself, there is 
no need to involve Perl or Python. The adjacency matrices just consist of a 

Indeed, if you wanted to be really fancy, you could even write a GAP program 
which downloads those files directly from the website (e.g. using the IO 
packages). Although that would probably overkill for this purpose ;-).

Here is an example for parsing one of the files (the one named 64-18-2-6):

adj_mats := [];
stream := InputTextFile("64-18-2-6");

# Read first line, containing data like
#   dim = 64, degree = 18, lambda = 2, mu = 6
# We could parse it, but to keep things simple, let's just skip it and the empty
# line after it.
ReadLine(stream);
ReadLine(stream);

# Now start parsing
while not IsEndOfStream(stream) do
    # Read in next matrix
    adj := [];
    while not IsEndOfStream(stream) do
        line := Chomp(ReadLine(stream));
        if line = fail or IsEmpty(line) then
            if not IsEmpty(adj) then
                Add(adj_mats, adj);
            fi;
            break;
        fi;
        
        if not ForAll(line, x -> x in "01") then
            break; # "garbage", e.g. a line with text
        fi;
        
        Add(adj, List(line, x -> Position("01", x)-1));
    od;
od;

CloseStream(stream);




Cheers,
Max
_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to