Skip to content

Commit

Permalink
More fixes for loading grape after digraphs
Browse files Browse the repository at this point in the history
When loading digraphs before grape, then some code kept printing a warning
saying "Grape is not loaded", even though grape was loaded. This patch fixes
that.
  • Loading branch information
fingolfin authored and wilfwilson committed Mar 30, 2022
1 parent eaf60ce commit bdd00fe
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gap/grape.gi
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function(D)
"the Grape graph will have fewer\n#I edges than the original,");
fi;

if not DIGRAPHS_IsGrapeLoaded then
if not DIGRAPHS_IsGrapeLoaded() then
Info(InfoWarning, 1, "Grape is not loaded,");
fi;

Expand Down
2 changes: 1 addition & 1 deletion init.g
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if not IsBound(DIGRAPH_OUT_NBS) and
fi;

BindGlobal("DIGRAPHS_IsGrapeLoaded",
IsPackageMarkedForLoading("grape", "4.8.1"));
{} -> IsPackageMarkedForLoading("grape", "4.8.1"));

# To avoid warnings when GRAPE is not loaded
if not IsBound(IsGraph) then
Expand Down
2 changes: 1 addition & 1 deletion read.g
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#############################################################################
##

if not DIGRAPHS_IsGrapeLoaded then
if not DIGRAPHS_IsGrapeLoaded() then
Add(DIGRAPHS_OmitFromTests, "Graph(");
fi;

Expand Down
4 changes: 2 additions & 2 deletions tst/standard/digraph.tst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ gap> DigraphRange(gr);
[ 2, 3, 2 ]
gap> gr;
<immutable digraph with 3 vertices, 3 edges>
gap> if DIGRAPHS_IsGrapeLoaded then
gap> if DIGRAPHS_IsGrapeLoaded() then
> g := Graph(gr);
> if not Digraph(g) = gr then
> Print("fail");
Expand Down Expand Up @@ -1627,7 +1627,7 @@ gap> MakeImmutable(D);
#
gap> D := NullDigraph(10);
<immutable empty digraph with 10 vertices>
gap> if DIGRAPHS_IsGrapeLoaded then
gap> if DIGRAPHS_IsGrapeLoaded() then
> D := Graph(D);
> if D <> rec(
> adjacencies := [[]],
Expand Down
8 changes: 4 additions & 4 deletions tst/standard/grape.tst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ rec( adjacencies := [ [ 2, 4 ] ], group := Group([ (1,3), (1,2)(3,4) ]),
schreierVector := [ -1, 2, 1, 2 ] )

# Digraph: copying group from Grape
gap> if DIGRAPHS_IsGrapeLoaded then
gap> if DIGRAPHS_IsGrapeLoaded() then
> gr := Digraph(JohnsonGraph(5, 3));
> else
> gr := JohnsonDigraph(5, 3);
Expand All @@ -140,7 +140,7 @@ gap> HasDigraphGroup(gr);
true
gap> DigraphGroup(gr);
Group([ (1,7,10,6,3)(2,8,4,9,5), (4,7)(5,8)(6,9) ])
gap> if DIGRAPHS_IsGrapeLoaded then
gap> if DIGRAPHS_IsGrapeLoaded() then
> gr := Digraph(CompleteGraph(Group((1, 2, 3), (1, 2))));
> else
> gr := Digraph([[2, 3], [1, 3], [1, 2]]);
Expand All @@ -150,7 +150,7 @@ gap> HasDigraphGroup(gr);
true
gap> DigraphGroup(gr);
Group([ (1,2,3), (1,2) ])
gap> if DIGRAPHS_IsGrapeLoaded then
gap> if DIGRAPHS_IsGrapeLoaded() then
> gr := Digraph(Graph(Group([()]),
> [1, 2, 3],
> OnPoints,
Expand Down Expand Up @@ -252,7 +252,7 @@ true
# Graph
gap> gr := Digraph([[2, 2], []]);
<immutable multidigraph with 2 vertices, 2 edges>
gap> if DIGRAPHS_IsGrapeLoaded then
gap> if DIGRAPHS_IsGrapeLoaded() then
> Graph(gr);
> fi;

Expand Down
12 changes: 6 additions & 6 deletions tst/testinstall.tst
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ gap> OutNeighbours(gr);
[ [ 8 ], [ 4, 5, 6, 8, 9 ], [ 2, 4, 5, 7, 10 ], [ 9 ], [ 1, 4, 6, 7, 9 ],
[ 2, 3, 6, 7, 10 ], [ 3, 4, 5, 8, 9 ], [ 3, 4, 9, 10 ],
[ 1, 2, 3, 5, 6, 9, 10 ], [ 2, 4, 5, 6, 9 ] ]
gap> not DIGRAPHS_IsGrapeLoaded
> or (DIGRAPHS_IsGrapeLoaded and Digraph(Graph(gr)) = gr);
gap> not DIGRAPHS_IsGrapeLoaded()
> or (DIGRAPHS_IsGrapeLoaded() and Digraph(Graph(gr)) = gr);
true
gap> not DIGRAPHS_IsGrapeLoaded
> or (DIGRAPHS_IsGrapeLoaded and Graph(Digraph(Graph(gr))).adjacencies =
gap> not DIGRAPHS_IsGrapeLoaded()
> or (DIGRAPHS_IsGrapeLoaded() and Graph(Digraph(Graph(gr))).adjacencies =
> Graph(gr).adjacencies);
true
gap> adj := [
Expand All @@ -38,8 +38,8 @@ gap> adj := [
> [1, 6, 8, 9, 11, 12, 13, 14], [2, 4, 7, 9, 10, 11, 13, 15, 16]];;
gap> func := function(x, y) return y in adj[x]; end;
function( x, y ) ... end
gap> not DIGRAPHS_IsGrapeLoaded or
> (DIGRAPHS_IsGrapeLoaded and
gap> not DIGRAPHS_IsGrapeLoaded() or
> (DIGRAPHS_IsGrapeLoaded() and
> Digraph(Graph(Group(()), [1 .. 20], OnPoints, func, true)) = Digraph(adj));
true

Expand Down

0 comments on commit bdd00fe

Please sign in to comment.