Przeglądaj źródła

Added append/1, get_in/1, get_out/1 to flow_graph.

Paul Downen 14 lat temu
rodzic
commit
bad34446e4
1 zmienionych plików z 8 dodań i 1 usunięć
  1. 8 1
      src/flow_graph.erl

+ 8 - 1
src/flow_graph.erl

@@ -7,7 +7,7 @@
 % Graph construction
 -export([singleton/1, from_list/3]).
 % Graph manipulation
--export([append/2, out_edges/2]).
+-export([append/2, append/1, get_in/1, get_out/1, out_edges/2]).
 % Checks for validity
 -export([valid_edge/1, valid_edge_list/1, valid_graph/1]).
 
@@ -119,6 +119,13 @@ append(FG1 = #flow_graph{in=In1, out=Out1},
     add_edge(#flow_graph{in=In1, out=Out2, graph=G},
 	     flow(Out1, In2)).
 
+append([FG1|FGs]) ->
+    lists:foldl(fun(FG, All) -> append(All, FG) end, FG1, FGs).
+
+get_in(#flow_graph{in=In}) -> In.
+
+get_out(#flow_graph{out=Out}) -> Out.
+
 out_edges(#flow_graph{graph=G}, #vertex{ref=R}) ->
     ?DICT:find(R, G).