Skip to content

Commit

Permalink
Consistency in DigraphRemoveEdge{s} for 0 edges
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-Ing authored and wilfwilson committed May 22, 2021
1 parent bc55fe2 commit 87f9392
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gap/oper.gi
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ InstallMethod(DigraphRemoveEdges, "for an immutable digraph and a list",
[IsImmutableDigraph, IsList],
{D, edges} -> MakeImmutable(DigraphRemoveEdges(DigraphMutableCopy(D), edges)));

InstallMethod(DigraphRemoveEdges, "for an immutable digraph and an empty list",
[IsImmutableDigraph, IsList and IsEmpty],
{D, edges} -> D);

InstallMethod(DigraphRemoveEdge, "for an immutable digraph and a list",
[IsImmutableDigraph, IsList and IsEmpty],
function(D, edges)
ErrorNoReturn("the 2nd argument must be non empty,");
end);

InstallMethod(DigraphReverseEdge,
"for a mutable digraph by out-neighbours and two positive integers",
[IsMutableDigraph and IsDigraphByOutNeighboursRep, IsPosInt, IsPosInt],
Expand Down
9 changes: 9 additions & 0 deletions tst/standard/oper.tst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ gap> DigraphRemoveEdges(gr, [[2, 1]]);
<immutable digraph with 2 vertices, 1 edge>
gap> last = gr;
true
gap> DigraphRemoveEdges(gr, []);
<immutable digraph with 2 vertices, 1 edge>
gap> last = gr;
true
gap> DigraphRemoveEdges(gr, [[1, 3]]);
Error, the 3rd argument <ran> must be a vertex of the digraph <D> that is the \
1st argument,
gap> DigraphRemoveEdges(gr, [[1, 2]]);
<immutable empty digraph with 2 vertices>
gap> gr := DigraphFromDigraph6String("&DtGsw_");
Expand Down Expand Up @@ -78,6 +85,8 @@ Error, the 2nd argument <src> must be a vertex of the digraph <D> that is the \
gap> DigraphRemoveEdge(gr, [1, 3]);
Error, the 3rd argument <ran> must be a vertex of the digraph <D> that is the \
1st argument,
gap> DigraphRemoveEdge(gr, []);
Error, the 2nd argument must be non empty,
gap> gr := DigraphRemoveEdge(gr, [2, 1]);
<immutable digraph with 2 vertices, 1 edge>
gap> DigraphEdges(gr);
Expand Down

0 comments on commit 87f9392

Please sign in to comment.