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 1879929
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/tourn4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
000000
000101
100010
100100
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 1879929

Please sign in to comment.