Skip to content

Commit

Permalink
Resolve Issue #114
Browse files Browse the repository at this point in the history
  • Loading branch information
James Mitchell committed Apr 24, 2018
1 parent 52e8eb9 commit 3288bf5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 10 additions & 4 deletions gap/isomorph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ if DIGRAPHS_NautyAvailable then
calling_function_name);
colors := NautyColorData(colors);
fi;
if DigraphNrVertices(digraph) = 0 then
# This circumvents Issue #17 in NautyTracesInterface, whereby a graph
# with 0 vertices causes a seg fault.
return [Group(()), ()];
fi;
data := NautyDense(DigraphSource(digraph),
DigraphRange(digraph),
DigraphNrVertices(digraph),
not IsSymmetricDigraph(digraph),
colors);
DigraphRange(digraph),
DigraphNrVertices(digraph),
not IsSymmetricDigraph(digraph),
colors);
if IsEmpty(data[1]) then
data[1] := [()];
fi;
Expand Down Expand Up @@ -232,6 +237,7 @@ function(digraph)
Info(InfoWarning, 1, "NautyTracesInterface is not available");
return fail;
fi;

data := NAUTY_DATA_NO_COLORS(digraph);
SetNautyCanonicalLabelling(digraph, data[2]);
if not HasDigraphGroup(digraph) then
Expand Down
14 changes: 14 additions & 0 deletions tst/testinstall.tst
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,20 @@ gap> gr := EmptyDigraph(0);;
gap> DigraphSymmetricClosure(gr);
<digraph with 0 vertices, 0 edges>
# Issue 114: Bug in NautyTracesInterface for graphs with 0 vertices
gap> not DIGRAPHS_NautyAvailable or
> NautyAutomorphismGroup(NullDigraph(0)) = Group(());
true
gap> not DIGRAPHS_NautyAvailable or
> NautyAutomorphismGroup(NullDigraph(0), []) = Group(());
true
gap> not DIGRAPHS_NautyAvailable or
> NautyCanonicalLabelling(NullDigraph(0)) = ();
true
gap> not DIGRAPHS_NautyAvailable or
> NautyCanonicalLabelling(NullDigraph(0), []) = ();
true
#T# DIGRAPHS_UnbindVariables
gap> Unbind(gr2);
gap> Unbind(gr);
Expand Down

0 comments on commit 3288bf5

Please sign in to comment.