diff --git a/gap/attr.gi b/gap/attr.gi index 67bb792ac..de37f4618 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -1630,11 +1630,13 @@ function(D) return [C, blocked]; end; - digraph := DigraphSymmetricClosure(DigraphRemoveLoops( - DigraphRemoveAllMultipleEdges(DigraphMutableCopyIfMutable(D)))); - + digraph := DigraphMutableCopy(D); + DigraphSymmetricClosure(DigraphRemoveLoops( + DigraphRemoveAllMultipleEdges(digraph))); + MakeImmutable(digraph); SetDigraphVertexLabels(digraph, Reversed(DigraphDegeneracyOrdering(digraph))); + temp := Triplets(digraph); T := temp[1]; C := temp[2]; diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index 3d79a8c5f..468abcd59 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -1036,6 +1036,41 @@ gap> DigraphAllChordlessCycles(D); [ 1, 4, 8, 7, 6, 2 ], [ 1, 4, 3, 2 ], [ 1, 4, 3, 7, 6, 5 ], [ 3, 2, 6, 7 ], [ 2, 1, 5, 6 ], [ 2, 1, 5, 8, 7, 3 ] ] +# check that DigraphAllChordlessCycles do not change the input graph +gap> g := Digraph([[2, 3, 7], [1, 4, 8], [1, 4, 9], [2, 3, 10], [6, 7, 9], [5, 8, 10], +> [8, 5, 1], [7, 6, 2], [5, 10, 3], [6, 9, 4]]);; +gap> DigraphAllChordlessCycles(g); +[ [ 7, 8, 6, 5 ], [ 6, 5, 9, 10 ], [ 3, 4, 10, 6, 5, 7, 1 ], + [ 3, 4, 10, 6, 8, 7, 1 ], [ 3, 4, 10, 9 ], [ 2, 4, 10, 6, 5, 7, 1 ], + [ 2, 4, 10, 6, 8 ], [ 2, 4, 10, 9, 5, 7, 8 ], [ 2, 4, 10, 9, 5, 7, 1 ], + [ 3, 4, 2, 1 ], [ 3, 4, 2, 8, 7, 5, 9 ], [ 3, 4, 2, 8, 6, 5, 9 ], + [ 3, 1, 7, 8, 6, 10, 9 ], [ 3, 1, 7, 5, 9 ], [ 2, 1, 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