|
@@ -6,8 +6,10 @@
|
|
|
-export([flow/2, func/3, index/3, range/4, tagged/3, dynamic/2, dynamic/3]).
|
|
|
% Graph construction
|
|
|
-export([singleton/1, from_list/3]).
|
|
|
+% Graph queries
|
|
|
+-export([get_in/1, get_out/1, out_edges/2]).
|
|
|
% Graph manipulation
|
|
|
--export([append/2, append/1, get_in/1, get_out/1, out_edges/2, add_edge/2]).
|
|
|
+-export([append/2, append/1, add_edge/2, add_edge_list/2]).
|
|
|
% Checks for validity
|
|
|
-export([valid_edge/1, valid_edge_list/1, valid_graph/1]).
|
|
|
% Branching
|
|
@@ -134,6 +136,9 @@ 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], add_vertex(G,To))}.
|
|
|
|
|
|
+add_edge_list(FG = #flow_graph{}, Edges) ->
|
|
|
+ lists:foldl(fun(E, Acc) -> add_edge(Acc, E) end, FG, Edges).
|
|
|
+
|
|
|
add_vertex(FG = #flow_graph{graph=G}, V = #vertex{}) ->
|
|
|
FG#flow_graph{graph=?DICT:update(V, fun(Es)->Es end, [], G)}.
|
|
|
|