From 91c1c0445c62821a0e90437d048d43e52dcdc53b Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Wed, 6 Apr 2022 09:44:49 +0100 Subject: [PATCH] digraph: fix String method for chains/cycles --- gap/digraph.gi | 10 ++++++++-- tst/testinstall.tst | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gap/digraph.gi b/gap/digraph.gi index 0db23b548..9371e6dee 100644 --- a/gap/digraph.gi +++ b/gap/digraph.gi @@ -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 diff --git a/tst/testinstall.tst b/tst/testinstall.tst index abbaad0e7..a427fa94a 100644 --- a/tst/testinstall.tst +++ b/tst/testinstall.tst @@ -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); + +gap> D := DigraphReverse(D); + +gap> IsChainDigraph(D); +true +gap> D = ChainDigraph(4); +false +gap> String(D); +"DigraphFromDigraph6String(\"&CACG\")" +gap> String(ChainDigraph(4)); +"ChainDigraph(4)" +gap> D := CycleDigraph(4); + +gap> D := DigraphReverse(D); + +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);