Skip to content

Commit

Permalink
io: fix DIGRAPHS_TournamentLineDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Sep 17, 2022
1 parent 9101cea commit 3fa1cbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions gap/io.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ BindGlobal("DIGRAPHS_TournamentLineDecoder",
function(func, s)
local out, pos, n, i, j;
pos := 0;
s := Chomp(s);
n := (Sqrt(8 * Length(s) + 1) + 1) / 2;
out := List([1 .. n], x -> []);
for i in [1 .. n - 1] do
Expand Down
6 changes: 6 additions & 0 deletions tst/standard/io.tst
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,12 @@ gap> OutNeighbours(gr);
[ [ 2, 4 ], [ ], [ 1, 2, 4 ], [ 2 ] ]
gap> gr := TournamentLineDecoder("");
<immutable empty digraph with 1 vertex>
gap> fname := Concatenation(DIGRAPHS_Dir(), "/data/tourn4.txt");;
gap> ReadDigraphs(fname, TournamentLineDecoder);
[ <immutable digraph with 4 vertices, 6 edges>,
<immutable digraph with 4 vertices, 6 edges>,
<immutable digraph with 4 vertices, 6 edges>,
<immutable digraph with 4 vertices, 6 edges> ]
# AdjacencyMatrixUpperTriangleLineDecoder
gap> gr := AdjacencyMatrixUpperTriangleLineDecoder("100101");
Expand Down

0 comments on commit 3fa1cbd

Please sign in to comment.