Skip to content

Commit fefd6ac

Browse files
committed
refactor:Simpler and more correct creator methods code.
1 parent 9e240f6 commit fefd6ac

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/Graph.rakumod

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Graph
4242
}
4343

4444
#------------------------------------------------------
45-
multi method new(:%adjacency-list = %(), Bool:D :d(:directed-edges(:$directed)) = False, :$vertex-coordinates = Whatever) {
46-
self.bless(:%adjacency-list, :$directed, :$vertex-coordinates);
45+
multi method new(:%adjacency-list = %(), :@vertexes = Empty, :@edges = Empty, Bool:D :d(:directed-edges(:$directed)) = False, :$vertex-coordinates = Whatever) {
46+
self.bless(:%adjacency-list, :$directed, :@vertexes, :@edges, :$vertex-coordinates);
4747
}
4848

4949
multi method new(%edges, Bool:D :d(:directed-edges(:$directed)) = False, :$vertex-coordinates = Whatever) {
@@ -58,10 +58,6 @@ class Graph
5858
self.bless(adjacency-list => %(), :$directed, :@vertexes, :@edges, :$vertex-coordinates);
5959
}
6060

61-
multi method new(:@vertexes!, :@edges!, Bool:D :d(:directed-edges(:$directed)) = False, :$vertex-coordinates = Whatever) {
62-
self.bless(adjacency-list => %(), :$directed, :@vertexes, :@edges, :$vertex-coordinates);
63-
}
64-
6561
multi method new(Graph:D $gr, :d(:directed-edges(:$directed)) is copy = Whatever, :$vertex-coordinates = Whatever) {
6662

6763
if $directed.isa(Whatever) { $directed = $gr.directed; }

0 commit comments

Comments
 (0)