diff --git a/gap/io.gi b/gap/io.gi index e29ba45f8..3aff5665e 100644 --- a/gap/io.gi +++ b/gap/io.gi @@ -2222,10 +2222,15 @@ InstallMethod(Graph6String, "for a digraph by out-neighbours", [IsDigraphByOutNeighboursRep], function(D) local list, adj, n, lenlist, tablen, blist, i, j, pos, block; - if (IsMultiDigraph(D) or not IsSymmetricDigraph(D) - or DigraphHasLoops(D)) then - ErrorNoReturn("the argument must be a symmetric digraph ", - "with no loops or multiple edges,"); + if IsMultiDigraph(D) then + ErrorNoReturn("the argument must not have multiple edges; ", + "consider encoding in Disparse6 or Digraph6"); + elif not IsSymmetricDigraph(D) then + ErrorNoReturn("the argument must be a symmetric digraph; ", + "consider encoding in Sparse6 or Disparse6"); + elif DigraphHasLoops(D) then + ErrorNoReturn("the argument must not have loops; ", + "consider encoding in Sparse6 or Disparse6"); fi; list := []; @@ -2285,6 +2290,15 @@ function(D) adj := OutNeighbours(D); n := Length(DigraphVertices(D)); + if IsMultiDigraph(D) then + if IsSymmetricDigraph(D) then + ErrorNoReturn("the argument must not have multiple edges ", + "consider encoding in Sparse6 or Disparse6, "); + fi; + ErrorNoReturn("the argument must not have multiple edges ", + "consider encoding in Disparse6, "); + fi; + # First write the special character '&' Add(list, -25); @@ -2337,8 +2351,15 @@ InstallMethod(Sparse6String, "for a digraph by out-neighbours", function(D) local list, n, lenlist, adj, nredges, k, blist, v, nextbit, i, j, bitstopad, pos, block; + if not IsSymmetricDigraph(D) then - ErrorNoReturn("the argument must be a symmetric digraph,"); + if IsMultiDigraph(D) then + ErrorNoReturn("the argument must be a symmetric digraph; ", + "consider encoding in Disparse6"); + else + ErrorNoReturn("the argument must be a symmetric digraph; ", + "consider encoding in Digraph6 or Disparse6"); + fi; fi; list := []; diff --git a/tst/standard/io.tst b/tst/standard/io.tst index 5c606a349..245465aa1 100644 --- a/tst/standard/io.tst +++ b/tst/standard/io.tst @@ -283,8 +283,8 @@ true gap> gr[3] := Digraph([[1, 2], [1, 2]]); gap> WriteDigraphs(filename, Digraph([[2], []]), Graph6String); -Error, the argument must be a symmetric digraph with no loops or multiple \ -edges, +Error, the argument must be a symmetric digraph; consider encoding in Spar\ +se6 or Disparse6 gap> OnBreak := oldOnBreak;; gap> IO_Close(IO.OpenFiles[Length(IO.OpenFiles)]);; gap> filename := Concatenation(DIGRAPHS_Dir(), "/tst/out/test.s6.bz2");; @@ -320,8 +320,8 @@ gap> ReadDigraphs(f); gap> IO_Close(f);; gap> f := DigraphFile(filename, "a");; gap> WriteDigraphs(f, CycleDigraph(5)); -Error, the argument must be a symmetric digraph with no loops or multiple \ -edges, +Error, the argument must be a symmetric digraph; consider encoding in Spar\ +se6 or Disparse6 gap> WriteDigraphs(f, JohnsonDigraph(6, 3)); IO_OK gap> IO_Close(f);; @@ -546,7 +546,8 @@ Error, the 2nd argument is not a valid disparse6 string, # Special format characters gap> Sparse6String(ChainDigraph(3)); -Error, the argument must be a symmetric digraph, +Error, the argument must be a symmetric digraph; consider encoding in Digr\ +aph6 or Disparse6 gap> Sparse6String(CompleteDigraph(1)); ":@" gap> gr := Digraph([[1], []]);; @@ -559,6 +560,24 @@ gap> DigraphFromSparse6String(":TdBkJ`Kq?x"); gap> Sparse6String(last); ":TdBkJ`Kq?" +# Multiple Edges Digraph6 +gap> gr := Digraph([[1, 1], [2]]);; +gap> Digraph6String(gr); +Error, the argument must not have multiple edges consider encoding in Spar\ +se6 or Disparse6, + +# Non-symmetric Digraph in Sparse6 +gap> gr := Digraph([[2], []]);; +gap> Sparse6String(gr); +Error, the argument must be a symmetric digraph; consider encoding in Digr\ +aph6 or Disparse6 + +# Digraph with loops in Sparse6 +gap> gr := Digraph([[1], [2]]);; +gap> Graph6String(gr); +Error, the argument must not have loops; consider encoding in Sparse6 or D\ +isparse6 + # DigraphPlainTextLineDecoder: bad input gap> DigraphPlainTextLineDecoder(" ", " ", 1, "."); Error, no method found! For debugging hints type ?Recovery from NoMethodFound @@ -659,8 +678,8 @@ Error, cannot open the file given as the 1st argument , # DigraphPlainTextLineDecoder: bad input gap> Graph6String(ChainDigraph(4)); -Error, the argument must be a symmetric digraph with no loops or multiple \ -edges, +Error, the argument must be a symmetric digraph; consider encoding in Spar\ +se6 or Disparse6 gap> DIGRAPHS_Graph6Length(-1); fail gap> DIGRAPHS_Graph6Length(68719476737);