Skip to content

Commit b98f611

Browse files
wilfwilsonjames-d-mitchell
authored andcommitted
StarDigraph: use CompleteBipartiteDigraph
1 parent 9a9320e commit b98f611

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

gap/examples.gi

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,10 @@ InstallMethod(TriangularGridGraph, "for two positive integers",
528528
InstallMethod(StarDigraphCons, "for IsMutableDigraph and a positive integer",
529529
[IsMutableDigraph, IsPosInt],
530530
function(filt, k)
531-
local j, graph;
532-
graph := EmptyDigraph(IsMutable, k);
533-
for j in [2 .. k] do
534-
DigraphAddEdges(graph, [[1, j], [j, 1]]);
535-
od;
536-
return graph;
531+
if k = 1 then
532+
return EmptyDigraph(IsMutable, 1);
533+
fi;
534+
return CompleteBipartiteDigraph(IsMutableDigraph, 1, k - 1);
537535
end);
538536

539537
InstallMethod(StarDigraph, "for a function and a positive integer",
@@ -739,4 +737,4 @@ function(filt, m)
739737
SetIsSymmetricDigraph(D, true);
740738
SetIsBipartiteDigraph(D, true);
741739
return D;
742-
end);
740+
end);

0 commit comments

Comments
 (0)