diff --git a/graphs/flow_graph1.txt b/graphs/flow_graph1.txt new file mode 100644 index 0000000..03a7ecc --- /dev/null +++ b/graphs/flow_graph1.txt @@ -0,0 +1,21 @@ +% This is a graph. + +n 20 300 0 +n 200 300 1 +n 200 200 2 +n 200 400 3 +n 380 300 4 +n 380 200 5 + +e 0 2 0 5 +e 0 3 1 5 +e 0 1 2 5 +e 2 4 3 5 +e 3 4 4 5 +e 3 2 5 5 +e 3 1 6 5 +e 1 4 7 5 +e 1 5 8 5 +e 4 5 9 5 + +% End of graph diff --git a/src/ftest.ml b/src/ftest.ml index faec057..8f82245 100644 --- a/src/ftest.ml +++ b/src/ftest.ml @@ -28,10 +28,15 @@ let () = (* Open file *) let graph = from_file infile in - let g = clone_nodes graph in + (*let g = clone_nodes graph in*) + + let flow_graph_1 = create_flow_graph graph in + let flow_graph_2 = update_flow_graph flow_graph_1 (fun _ -> true) 5 in + + let string_flow_graph = gmap flow_graph_2 (fun x -> string_of_int x) in (* Rewrite the graph that has been read. *) - let () = write_file outfile g in + let () = write_file outfile string_flow_graph in () diff --git a/src/tools.ml b/src/tools.ml index e0ac489..48a766a 100644 --- a/src/tools.ml +++ b/src/tools.ml @@ -19,7 +19,6 @@ let update_flow_graph : int graph -> (int arc -> bool) -> int -> int graph = e_fold original_graph (fun acc_graph arc -> - (* Perform some transformation or condition on the arc and accumulate the result in the new graph *) let modified_arc = if condition arc then { arc with lbl = arc.lbl + increment } @@ -27,7 +26,7 @@ let update_flow_graph : int graph -> (int arc -> bool) -> int -> int graph = arc in new_arc acc_graph modified_arc) - empty_graph + original_graph in new_graph