Skip to content

Commit 1a1fc00

Browse files
committed
Fix: faulty encoding without faithfulness
1 parent b596022 commit 1a1fc00

2 files changed

Lines changed: 30 additions & 11 deletions

File tree

gap/io.gi

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,11 +2222,13 @@ InstallMethod(Graph6String, "for a digraph by out-neighbours",
22222222
[IsDigraphByOutNeighboursRep],
22232223
function(D)
22242224
local list, adj, n, lenlist, tablen, blist, i, j, pos, block;
2225-
if (IsMultiDigraph(D) or not IsSymmetricDigraph(D)
2226-
or DigraphHasLoops(D)) then
2227-
ErrorNoReturn("the argument <D> must be a symmetric digraph ",
2228-
"with no loops or multiple edges,");
2229-
fi;
2225+
if IsMultiDigraph(D) then
2226+
ErrorNoReturn("the argument <D> must not have multiple edges; consider encoding in Disparse6 or Digraph6");
2227+
elif not IsSymmetricDigraph(D) then
2228+
ErrorNoReturn("the argument <D> must be a symmetric digraph; consider encoding in Sparse6 or Disparse6");
2229+
elif DigraphHasLoops(D) then
2230+
ErrorNoReturn("the argument <D> must not have loops; consider encoding in Sparse6 or Disparse6");
2231+
fi;
22302232

22312233
list := [];
22322234
adj := OutNeighbours(D);
@@ -2294,6 +2296,15 @@ function(D)
22942296
adj := OutNeighbours(D);
22952297
n := Length(DigraphVertices(D));
22962298

2299+
if IsMultiDigraph(D) then
2300+
if IsSymmetricDigraph(D) then
2301+
ErrorNoReturn("the argument <D> must not have multiple edges ",
2302+
"consider encoding in Sparse6 or Disparse6, ");
2303+
fi;
2304+
ErrorNoReturn("the argument <D> must not have multiple edges ",
2305+
"consider encoding in Disparse6, ");
2306+
fi;
2307+
22972308
# First write the special character '&'
22982309
Add(list, -25);
22992310

@@ -2354,6 +2365,14 @@ function(D)
23542365
ErrorNoReturn("the argument <D> must be a symmetric digraph consider encoding in Digraph6 or Disparse6,");
23552366
fi;
23562367

2368+
if not IsSymmetricDigraph(D) then
2369+
if IsMultiDigraph(D) then
2370+
ErrorNoReturn("the argument <D> must be a symmetric digraph consider encoding in Disparse6,");
2371+
else
2372+
ErrorNoReturn("the argument <D> must be a symmetric digraph consider encoding in Digraph6 or Disparse6,");
2373+
fi;
2374+
fi;
2375+
23572376
list := [];
23582377
n := Length(DigraphVertices(D));
23592378

tst/standard/io.tst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ true
283283
gap> gr[3] := Digraph([[1, 2], [1, 2]]);
284284
<immutable digraph with 2 vertices, 4 edges>
285285
gap> WriteDigraphs(filename, Digraph([[2], []]), Graph6String);
286-
Error, the argument <D> must be a symmetric digraph with no loops or multiple \
287-
edges,
286+
Error, the argument <D> must be a symmetric digraph; consider encoding in Spar\
287+
se6 or Disparse6
288288
gap> OnBreak := oldOnBreak;;
289289
gap> IO_Close(IO.OpenFiles[Length(IO.OpenFiles)]);;
290290
gap> filename := Concatenation(DIGRAPHS_Dir(), "/tst/out/test.s6.bz2");;
@@ -320,8 +320,8 @@ gap> ReadDigraphs(f);
320320
gap> IO_Close(f);;
321321
gap> f := DigraphFile(filename, "a");;
322322
gap> WriteDigraphs(f, CycleDigraph(5));
323-
Error, the argument <D> must be a symmetric digraph with no loops or multiple \
324-
edges,
323+
Error, the argument <D> must be a symmetric digraph; consider encoding in Spar\
324+
se6 or Disparse6
325325
gap> WriteDigraphs(f, JohnsonDigraph(6, 3));
326326
IO_OK
327327
gap> IO_Close(f);;
@@ -659,8 +659,8 @@ Error, cannot open the file given as the 1st argument <name>,
659659
660660
# DigraphPlainTextLineDecoder: bad input
661661
gap> Graph6String(ChainDigraph(4));
662-
Error, the argument <D> must be a symmetric digraph with no loops or multiple \
663-
edges,
662+
Error, the argument <D> must be a symmetric digraph; consider encoding in Spar\
663+
se6 or Disparse6
664664
gap> DIGRAPHS_Graph6Length(-1);
665665
fail
666666
gap> DIGRAPHS_Graph6Length(68719476737);

0 commit comments

Comments
 (0)