Skip to content

Commit

Permalink
Fix #73
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stevensonmt authored and bitwalker committed Mar 10, 2024
1 parent 0713df2 commit 76052b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/graph.ex
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ defmodule Graph do
end
end

def add_vertex(g, v, label) do
def add_vertex(%__MODULE__{} = g, v, label) when not is_list(label) do
add_vertex(g, v, [label])
end

Expand Down

0 comments on commit 76052b3

Please sign in to comment.