diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-11-22 11:38:34 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-11-22 20:24:21 -0600 |
commit | eb5c0eb42434d0603149f6de460bef7b3ef7b4de (patch) | |
tree | 19b7d7249ea312b8f8f54f875af61458c1764a51 | |
parent | 3e01e3e46d84e09946d347c3115db528bc88396c (diff) |
include initial verticies in solution list
-rw-r--r-- | src/rebar_digraph.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rebar_digraph.erl b/src/rebar_digraph.erl index 1198530..bbcb736 100644 --- a/src/rebar_digraph.erl +++ b/src/rebar_digraph.erl @@ -18,7 +18,9 @@ restore_graph({Vs, Es}) -> Graph. solve(Graph, Vertices) -> - solve(Graph, Vertices, dict:new()). + solve(Graph, Vertices, lists:foldl(fun({Key, _}=N, Solution) -> + dict:store(Key, N, Solution) + end, dict:new(), Vertices)). solve(_Graph, [], Solution) -> {_, Vertices} = lists:unzip(dict:to_list(Solution)), @@ -28,8 +30,7 @@ solve(Graph, Vertices, Solution) -> lists:foldl(fun(V, {NewVertices, SolutionAcc}) -> OutNeighbors = digraph:out_neighbours(Graph, V), lists:foldl(fun({Key, _}=N, {NewVertices1, SolutionAcc1}) -> - case dict:is_key(Key, SolutionAcc1) orelse - lists:keymember(Key, 1, Vertices) of + case dict:is_key(Key, SolutionAcc1) of true -> {NewVertices1, SolutionAcc1}; false -> |