diff --git a/src/ftest.ml b/src/ftest.ml index 80489df..faec057 100644 --- a/src/ftest.ml +++ b/src/ftest.ml @@ -1,4 +1,5 @@ open Gfile +open Tools let () = @@ -27,9 +28,10 @@ let () = (* Open file *) let graph = from_file infile in + let g = clone_nodes graph in (* Rewrite the graph that has been read. *) - let () = write_file outfile graph in + let () = write_file outfile g in - () + () diff --git a/src/tools.ml b/src/tools.ml new file mode 100644 index 0000000..3492734 --- /dev/null +++ b/src/tools.ml @@ -0,0 +1,8 @@ +open Graph + +let clone_nodes gr= n_fold gr new_node empty_graph +let gmap gr f = + e_fold gr (fun g arc -> (new_arc g {src=arc.src; tgt=arc.tgt; lbl=f arc.lbl})) empty_graph + +let add_arc _a _b _c _d = assert false + diff --git a/src/tools.mli b/src/tools.mli new file mode 100644 index 0000000..8e6fb3d --- /dev/null +++ b/src/tools.mli @@ -0,0 +1,5 @@ +open Graph + +val clone_nodes: 'a graph -> 'b graph +val gmap: 'a graph -> ('a -> 'b) -> 'b graph +val add_arc: int graph -> id -> id -> int -> int graph