Skip to content

Commit

Permalink
digraph: fix String method for chains/cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Apr 6, 2022
1 parent ceb6c0d commit 91c1c04
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gap/digraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,15 @@ function(D)
Add(strings, String(outnbs_rep));

N := DigraphNrVertices(D);
props := [IsCycleDigraph, IsCompleteDigraph, IsChainDigraph,
props := [x -> IsCycleDigraph(x)
and x = CycleDigraph(DigraphNrVertices(x)),
IsCompleteDigraph,
x -> IsChainDigraph(x)
and x = ChainDigraph(DigraphNrVertices(x)),
IsEmptyDigraph];
creators_props := ["CycleDigraph", "CompleteDigraph", "ChainDigraph",
creators_props := ["CycleDigraph",
"CompleteDigraph",
"ChainDigraph",
"EmptyDigraph"];
for i in [1 .. Length(props)] do
if props[i](D) then
Expand Down
27 changes: 27 additions & 0 deletions tst/testinstall.tst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,33 @@ gap> D := Digraph([[2, 2, 2, 2, 2], []]);;
gap> GeneratorsOfEndomorphismMonoid(D);
Error, expected a digraph without multiple edges!
# Issue 517: bug in String for digraphs satisfying IsChainDigraph or
# IsCycleDigraph but not being equal to ChainDigraph or CycleDigraph.
gap> D := ChainDigraph(4);
<immutable chain digraph with 4 vertices>
gap> D := DigraphReverse(D);
<immutable digraph with 4 vertices, 3 edges>
gap> IsChainDigraph(D);
true
gap> D = ChainDigraph(4);
false
gap> String(D);
"DigraphFromDigraph6String(\"&CACG\")"
gap> String(ChainDigraph(4));
"ChainDigraph(4)"
gap> D := CycleDigraph(4);
<immutable cycle digraph with 4 vertices>
gap> D := DigraphReverse(D);
<immutable digraph with 4 vertices, 4 edges>
gap> IsCycleDigraph(D);
true
gap> D = CycleDigraph(4);
false
gap> String(D);
"DigraphFromDigraph6String(\"&CECG\")"
gap> String(CycleDigraph(4));
"CycleDigraph(4)"
# DIGRAPHS_UnbindVariables
gap> Unbind(gr2);
gap> Unbind(gr);
Expand Down

0 comments on commit 91c1c04

Please sign in to comment.