Skip to content

Commit 605bf8c

Browse files
committed
More changes made to DigraphRemoveAllEdges
1 parent 3568304 commit 605bf8c

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

gap/attr.gd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ DeclareAttributeThatReturnsDigraph("DigraphReverse", IsDigraph);
8989
DeclareAttributeThatReturnsDigraph("DigraphDual", IsDigraph);
9090
DeclareAttributeThatReturnsDigraph("ReducedDigraph", IsDigraph);
9191
DeclareAttributeThatReturnsDigraph("DigraphRemoveAllMultipleEdges", IsDigraph);
92-
DeclareAttributeThatReturnsDigraph("DigraphRemoveAllEdges", IsImmutableDigraph);
93-
DeclareAttributeThatReturnsDigraph("DigraphRemoveAllEdges", IsMutableDigraph);
92+
DeclareAttributeThatReturnsDigraph("DigraphRemoveAllEdges", IsDigraph);
9493

9594
# TODO replace all DeclareOperations below to
9695
# DeclareAttributeThatReturnsDigraph, and remove the *Attr versions.

gap/attr.gi

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,18 +2540,13 @@ end);
25402540
InstallMethodThatReturnsDigraph(DigraphRemoveAllEdges,
25412541
"for an immutable digraph",
25422542
[IsImmutableDigraph],
2543-
D -> NullDigraph(DigraphNrVertices(D))
2544-
);
2543+
D -> NullDigraph(DigraphNrVertices(D)));
25452544

25462545
InstallMethodThatReturnsDigraph(DigraphRemoveAllEdges,
25472546
"for a mutable digraph",
25482547
[IsMutableDigraph],
25492548
function(D)
2550-
local i, currentEdges;
2551-
for i in [1 .. Length(OutNeighbours(D))] do
2552-
currentEdges := DigraphOutEdges(D, i);
2553-
DigraphRemoveEdges(D, currentEdges);
2554-
od;
2549+
D!.OutNeighbours := List(DigraphVertices(D), v -> []);
25552550
return D;
25562551
end);
25572552

gap/oper.gi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,8 +994,8 @@ InstallMethod(SwapDigraphs,
994994
[IsMutableDigraph, IsMutableDigraph],
995995
function(D1, D2)
996996
local nb1, nb2;
997-
nb1 := OutNeighboursMutableCopy(D1);
998-
nb2 := OutNeighboursMutableCopy(D2);
997+
nb1 := OutNeighbours(D1);
998+
nb2 := OutNeighbours(D2);
999999
D1!.OutNeighbours := nb2;
10001000
D2!.OutNeighbours := nb1;
10011001
end);

0 commit comments

Comments
 (0)