export method
This commit is contained in:
parent
d30c36204b
commit
a72be9043c
2 changed files with 18 additions and 0 deletions
16
src/gfile.ml
16
src/gfile.ml
|
|
@ -112,3 +112,19 @@ let from_file path =
|
|||
close_in infile ;
|
||||
final_graph
|
||||
|
||||
let export path graph =
|
||||
let ff = open_out path in
|
||||
|
||||
fprintf ff "digraph {\n" ;
|
||||
fprintf ff "rankdir=LR;\n";
|
||||
fprintf ff "node [shape = circle]\n";
|
||||
|
||||
e_iter graph (fun arc -> fprintf ff "%d -> %d [label = \"%s\"];\n" arc.src arc.tgt arc.lbl);
|
||||
|
||||
fprintf ff "}"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ val from_file: path -> string graph
|
|||
* If necessary, use gmap (to be written by you) to prepare the input graph. *)
|
||||
val write_file: path -> string graph -> unit
|
||||
|
||||
val export : path -> string graph -> unit
|
||||
|
||||
|
||||
(* The format of files is compatible with the files generated by:
|
||||
https://algorithms.discrete.ma.tum.de/graph-algorithms/flow-ford-fulkerson/index_en.html
|
||||
|
|
|
|||
Loading…
Reference in a new issue