|
@@ -7,7 +7,7 @@
|
|
|
% Graph construction
|
|
|
-export([singleton/1, from_list/3]).
|
|
|
% Graph manipulation
|
|
|
--export([append/2, append/1, get_in/1, get_out/1, out_edges/2]).
|
|
|
+-export([append/2, append/1, get_in/1, get_out/1, out_edges/2, add_edge/2]).
|
|
|
% Checks for validity
|
|
|
-export([valid_edge/1, valid_edge_list/1, valid_graph/1]).
|
|
|
% Branching
|
|
@@ -130,9 +130,9 @@ get_out(#flow_graph{out=Out}) -> Out.
|
|
|
out_edges(#flow_graph{graph=G}, #vertex{ref=R}) ->
|
|
|
?DICT:find(R, G).
|
|
|
|
|
|
-add_edge(FG = #flow_graph{graph=G}, E = #edge{from=From}) ->
|
|
|
+add_edge(FG = #flow_graph{graph=G}, E = #edge{from=From, to=To}) ->
|
|
|
Add = fun(Edges) -> [E|Edges] end,
|
|
|
- FG#flow_graph{graph=?DICT:update(From, Add, [E], G)}.
|
|
|
+ FG#flow_graph{graph=?DICT:update(From, Add, [E], add_vertex(G,To))}.
|
|
|
|
|
|
add_vertex(FG = #flow_graph{graph=G}, V = #vertex{}) ->
|
|
|
FG#flow_graph{graph=?DICT:update(V, fun(Es)->Es end, [], G)}.
|