Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- stable-4.15
- v4.14
- v4.13
- v4.12
mode:
- onlyneeded
- default
Expand All @@ -41,11 +40,6 @@ jobs:
pkgs-to-clone: https://github.com/digraphs/graphviz.git https://github.com/gap-packages/NautyTracesInterface.git
pkgs-to-build: io orb datastructures profiling grape NautyTracesInterface

- gap-version: v4.11 # Note: NautyTracesInterface requires GAP 4.12
mode: default # There wouldn't be much point testing GAP v4.11 with only needed packages. The only difference is whether Grape is loaded.
pkgs-to-clone: https://github.com/digraphs/graphviz.git
pkgs-to-build: io* orb* datastructures* profiling* grape*

steps:
- uses: actions/checkout@v7
- name: Output g++ version . . .
Expand Down
38 changes: 10 additions & 28 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ _STANDREWSMATHS := Concatenation(["Mathematical Institute, North Haugh, ",
_STANDREWSCS := Concatenation(["Jack Cole Building, North Haugh, ",
"St Andrews, Fife, KY16 9SX, Scotland"]);

if not CompareVersionNumbers(GAPInfo.Version, "4.12") then
IsKernelExtensionAvailable := fail;
fi;

SetPackageInfo(rec(
PackageName := "Digraphs",
Subtitle := "Graphs, digraphs, and multidigraphs in GAP",
Expand Down Expand Up @@ -568,7 +564,7 @@ PackageDoc := rec(
),

Dependencies := rec(
GAP := ">=4.11.0",
GAP := ">=4.13.0",
NeededOtherPackages := [["IO", ">=4.5.1"],
["orb", ">=4.8.2"],
["datastructures", ">=0.2.5"]],
Expand Down Expand Up @@ -607,26 +603,16 @@ BannerString := Concatenation(
"-----------------------------------------------------------------------",
"------\n"),

Extensions := [
rec(needed := [["NautyTracesInterface", ">=0.2"]],
filename := "gap/nauty.g")],

AvailabilityTest := function()
local digraphs_so;

if CompareVersionNumbers(GAPInfo.Version, "4.12") then
if not IsKernelExtensionAvailable("digraphs") then
LogPackageLoadingMessage(PACKAGE_WARNING,
["the kernel module is not compiled, ",
"the package cannot be loaded."]);
return fail;
fi;
else
# TODO this clause can be removed once Digraphs requires GAP>=4.12.1
digraphs_so := Filename(DirectoriesPackagePrograms("digraphs"),
"digraphs.so");
if (not "digraphs" in SHOW_STAT()) and digraphs_so = fail then
LogPackageLoadingMessage(PACKAGE_WARNING,
["the kernel module is not compiled, ",
"the package cannot be loaded."]);
return fail;
fi;
if not IsKernelExtensionAvailable("digraphs") then
LogPackageLoadingMessage(PACKAGE_WARNING,
["the kernel module is not compiled, ",
"the package cannot be loaded."]);
return fail;
fi;
return true;
end,
Expand Down Expand Up @@ -665,10 +651,6 @@ AutoDoc := rec(
"&Digraphs;", "<Strong>Digraphs</Strong>"),
"&GAP;", "<Strong>GAP</Strong>")));

if not CompareVersionNumbers(GAPInfo.Version, "4.12") then
Unbind(IsKernelExtensionAvailable);
fi;

MakeReadWriteGlobal("_RecogsFunnyWWWURLFunction");
MakeReadWriteGlobal("_RecogsFunnyNameFormatterFunction");
Unbind(_RecogsFunnyWWWURLFunction);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For questions, remarks, suggestions, and issues please use the
## Installation

It is assumed that you have a working copy of [GAP][] with version number
4.11.0 or higher. The most up-to-date version of GAP, and instructions on how
4.13.0 or higher. The most up-to-date version of GAP, and instructions on how
to install it, can be obtained from the
[main GAP webpage](https://www.gap-system.org).

Expand Down
9 changes: 5 additions & 4 deletions gap/digraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,13 @@ end);
InstallMethod(DigraphCons, "for IsMutableDigraph and a record",
[IsMutableDigraph, IsRecord],
function(_, record)
local D, cmp, labels, i;
local D, cmp, labels, i, adj;

if IsGraph(record) then
if DIGRAPHS_IsGrapeGraph(record) then
# IsGraph is a function not a filter, so we cannot have a separate method
adj := ValueGlobal("Adjacency");
D := DigraphNC(IsMutableDigraph,
List(Vertices(record), x -> Adjacency(record, x)));
List(ValueGlobal("Vertices")(record), x -> adj(record, x)));
if IsBound(record.names) then
SetDigraphVertexLabels(D, StructuralCopy(record.names));
fi;
Expand Down Expand Up @@ -382,7 +383,7 @@ InstallMethod(DigraphCons, "for IsImmutableDigraph and a record",
function(_, record)
local D;
D := MakeImmutable(DigraphCons(IsMutableDigraph, record));
if IsGraph(record) then
if DIGRAPHS_IsGrapeGraph(record) then
# IsGraph is a function not a filter, so we cannot have a separate method
# for this.
if not IsTrivial(record.group) then
Expand Down
35 changes: 3 additions & 32 deletions gap/isomorph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -130,38 +130,9 @@ end);

BindGlobal("BLISS_DATA_NO_COLORS", D -> BLISS_DATA(D, fail, fail));

if DIGRAPHS_NautyAvailable then
BindGlobal("NAUTY_DATA",
function(D, colors)
local data;
if colors <> false then
colors := DIGRAPHS_ValidateVertexColouring(DigraphNrVertices(D),
colors);
colors := NautyColorData(colors);
fi;
if DigraphHasNoVertices(D) then
# This circumvents Issue #17 in NautyTracesInterface, whereby a graph
# with 0 vertices causes a seg fault.
return [Group(()), ()];
fi;
data := NautyDense(DigraphSource(D),
DigraphRange(D),
DigraphNrVertices(D),
not IsSymmetricDigraph(D),
colors);
if IsEmpty(data[1]) then
data[1] := [()];
fi;
data[1] := Group(data[1]);
data[2] := data[2] ^ -1;
return data;
end);

BindGlobal("NAUTY_DATA_NO_COLORS", D -> NAUTY_DATA(D, false));
else
BindGlobal("NAUTY_DATA", ReturnFail);
BindGlobal("NAUTY_DATA_NO_COLORS", ReturnFail);
fi;
# replaced by gap/nauty.g once NautyTracesInterface is loaded
BindGlobal("NAUTY_DATA", ReturnFail);
BindGlobal("NAUTY_DATA_NO_COLORS", D -> NAUTY_DATA(D, false));

# Canonical labellings

Expand Down
43 changes: 43 additions & 0 deletions gap/nauty.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#############################################################################
##
## nauty.g
## Copyright (C) 2014-19 James D. Mitchell
## Wilf A. Wilson
##
## Licensing information can be found in the README file of this package.
##
#############################################################################
##

# Package extension, read by GAP once NautyTracesInterface is loaded.

MakeReadWriteGlobal("NAUTY_DATA");
NAUTY_DATA := function(D, colors)
local data;
if colors <> false then
colors := DIGRAPHS_ValidateVertexColouring(DigraphNrVertices(D),
colors);
colors := NautyColorData(colors);
fi;
if DigraphHasNoVertices(D) then
# This circumvents Issue #17 in NautyTracesInterface, whereby a graph
# with 0 vertices causes a seg fault.
return [Group(()), ()];
fi;
data := NautyDense(DigraphSource(D),
DigraphRange(D),
DigraphNrVertices(D),
not IsSymmetricDigraph(D),
colors);
if IsEmpty(data[1]) then
data[1] := [()];
fi;
data[1] := Group(data[1]);
data[2] := data[2] ^ -1;
return data;
end;
MakeReadOnlyGlobal("NAUTY_DATA");

MakeReadWriteGlobal("DIGRAPHS_NautyAvailable");
DIGRAPHS_NautyAvailable := true;
MakeReadOnlyGlobal("DIGRAPHS_NautyAvailable");
11 changes: 2 additions & 9 deletions gap/oper.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ InstallMethod(DigraphCycleBasis, "for a digraph",
[IsDigraph],
function(G)
local OutNbr, InNbr, n, partialSum, m, visited, unusedEdges, i, c, s, stack,
z, u, v, p, B;
u, v, p, B;

# Check for loops
if DigraphHasLoops(G) then
Expand Down Expand Up @@ -2631,14 +2631,7 @@ function(G)
# - unusedEdges : The list of unused edges to be converted to a basis vector
# - visited : The result of the depth first search above

# TODO : In the case the Digraph package requires GAP 4.12 or over,
# remove the following if statement.
if CompareVersionNumbers(GAPInfo.Version, "4.12") then
B := List([1 .. c], i -> NewZeroVector(IsGF2VectorRep, GF(2), m));
else
z := List([1 .. m], i -> Zero(GF(2)));
B := List([1 .. c], i -> Vector(GF(2), z));
fi;
B := List([1 .. c], i -> NewZeroVector(IsGF2VectorRep, GF(2), m));

for i in [1 .. c] do
u := unusedEdges[i][1];
Expand Down
37 changes: 5 additions & 32 deletions init.g
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,16 @@
#############################################################################
##

# load a method for UserHomeExpand if necessary
if not IsBound(UserHomeExpand) then
BindGlobal("UserHomeExpand", USER_HOME_EXPAND);
fi;

if CompareVersionNumbers(GAPInfo.Version, "4.12") then
if not LoadKernelExtension("digraphs") then
Error("failed to load the Digraphs package kernel extension");
fi;
else
# TODO this clause can be removed once Digraphs requires GAP>=4.12.1
# load kernel function if it is installed:
if not IsBound(DIGRAPH_OUT_NBS) and "digraphs" in SHOW_STAT() then
# try static module
LoadStaticModule("digraphs");
fi;
if not IsBound(DIGRAPH_OUT_NBS) and
Filename(DirectoriesPackagePrograms("digraphs"),
"digraphs.so") <> fail then
LoadDynamicModule(Filename(DirectoriesPackagePrograms("digraphs"),
"digraphs.so"));
fi;
if not LoadKernelExtension("digraphs") then
Error("failed to load the Digraphs package kernel extension");
fi;

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

# To avoid warnings when GRAPE is not loaded
if not IsBound(IsGraph) then
IsGraph := ReturnFalse;
fi;
if not IsBound(Vertices) then
DeclareOperation("Vertices", [IsRecord]);
fi;
if not IsBound(Adjacency) then
Adjacency := IdFunc;
fi;
# IsGraph belongs to GRAPE, which need not be loaded
BindGlobal("DIGRAPHS_IsGrapeGraph",
x -> DIGRAPHS_IsGrapeLoaded() and ValueGlobal("IsGraph")(x));

ReadPackage("digraphs", "gap/digraph.gd");
ReadPackage("digraphs", "gap/digraphs.g");
Expand Down
11 changes: 2 additions & 9 deletions read.g
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,8 @@ function()
return omit;
end);

_NautyTracesInterfaceVersion :=
First(PackageInfo("digraphs")[1].Dependencies.SuggestedOtherPackages,
x -> x[1] = "NautyTracesInterface")[2];

BindGlobal("DIGRAPHS_NautyAvailable",
IsPackageMarkedForLoading("NautyTracesInterface",
_NautyTracesInterfaceVersion));

Unbind(_NautyTracesInterfaceVersion);
# set to true by gap/nauty.g once NautyTracesInterface is loaded
BindGlobal("DIGRAPHS_NautyAvailable", false);

ReadPackage("digraphs", "gap/utils.gi");
ReadPackage("digraphs", "gap/digraph.gi");
Expand Down
Loading