From 87f9392c4525acb4a15139f46bab0c1e4fd77f82 Mon Sep 17 00:00:00 2001
From: Peter-Ing <peter@ingarfield.net>
Date: Wed, 11 Nov 2020 15:48:17 +0000
Subject: [PATCH] Consistency in DigraphRemoveEdge{s} for 0 edges

---
 gap/oper.gi           | 10 ++++++++++
 tst/standard/oper.tst |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/gap/oper.gi b/gap/oper.gi
index e1231fa88..85726d9cc 100644
--- a/gap/oper.gi
+++ b/gap/oper.gi
@@ -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],
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 1397c9797..877a538be 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -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_");
@@ -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);