Skip to content

Commit 76052b3

Browse files
stevensonmtbitwalker
authored andcommitted
Fix #73
add_vertex would loop infinitely if passed non-graph value as first parameter b/c it would always match the last function head def for add_vertex/3, which was a recursive call. Making all function heads match first parameter on %Graph{} should solve this issue.
1 parent 0713df2 commit 76052b3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/graph.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ defmodule Graph do
693693
end
694694
end
695695

696-
def add_vertex(g, v, label) do
696+
def add_vertex(%__MODULE__{} = g, v, label) when not is_list(label) do
697697
add_vertex(g, v, [label])
698698
end
699699

0 commit comments

Comments
 (0)