diff --git a/gap/io.gi b/gap/io.gi index e29ba45f8..90d7caa80 100644 --- a/gap/io.gi +++ b/gap/io.gi @@ -2222,11 +2222,13 @@ 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,"); - fi; + 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 := []; adj := OutNeighbours(D); @@ -2285,6 +2287,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 +2348,13 @@ 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..23be86e20 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 Digra\ +ph6 or Disparse6, gap> Sparse6String(CompleteDigraph(1)); ":@" gap> gr := Digraph([[1], []]);; @@ -659,8 +660,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);