diff --git a/doc/constructors.xml b/doc/constructors.xml index 5b3220e37..1496768fc 100644 --- a/doc/constructors.xml +++ b/doc/constructors.xml @@ -21,8 +21,9 @@ if the terminal vertex of the edge associated with v is the start vertex of the edge associated with u.

- Note that the returned digraph is always a new immutable digraph, and the - argument digraph is never modified. + Note that the returned digraph is always a new digraph with the same + mutability as the input digraph. The input digraph is never + modified. LineDigraph(CompleteDigraph(3)); @@ -45,8 +46,9 @@ gap> LineDigraph(ChainDigraph(3)); between two vertices if and only if the corresponding edges have a vertex in common.

- Note that the returned digraph is always a new immutable digraph, and the - argument digraph is never modified. + Note that the returned digraph is always a new digraph with the same + mutability as the input digraph. The input digraph is never + modified. LineUndirectedDigraph(CompleteDigraph(3)); diff --git a/gap/constructors.gi b/gap/constructors.gi index 056f9ef9f..4dcecb257 100644 --- a/gap/constructors.gi +++ b/gap/constructors.gi @@ -130,9 +130,7 @@ function(D, distance) end); # Warning: unlike the other methods the next two do not change their arguments -# in place, and always return an immutable digraph. There is currently no -# method for creating a mutable digraph with 4 arguments, as required by the -# next two methods. +# in place. InstallMethod(LineDigraph, "for a digraph", [IsDigraph], function(D) diff --git a/tst/testinstall.tst b/tst/testinstall.tst index fa35b32cf..35d8d3863 100644 --- a/tst/testinstall.tst +++ b/tst/testinstall.tst @@ -568,6 +568,20 @@ gap> OutNeighbours(D); gap> OutNeighbours(C); [ [ 2, 3, 4 ], [ 1, 3, 4, 5 ], [ 1, 2 ], [ 5 ], [ 4 ] ] +# LineDigraph for mutable digraphs: mutable output, unchanged input +gap> D := Digraph(IsMutableDigraph, [[2, 3, 4], [1, 3, 4, 5], [1, 2], [5], [4]]);; +gap> out := LineDigraph(D);; +gap> IsMutableDigraph(out); +true +gap> D = out; +false +gap> D := DigraphSymmetricClosure(D);; +gap> out := LineUndirectedDigraph(D);; +gap> IsMutableDigraph(out); +true +gap> D = out; +false + # gap> DIGRAPHS_StopTest(); gap> STOP_TEST("Digraphs package: testinstall.tst", 0);