From f8703beaa590a1707e07bf5ea2002b8816179d26 Mon Sep 17 00:00:00 2001 From: Leandro-rdz Date: Mon, 9 Dec 2024 13:17:06 +0100 Subject: [PATCH] feat : add the mainloop to search solution --- src/ftest.ml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ftest.ml b/src/ftest.ml index 64c456f..ba9d4c5 100644 --- a/src/ftest.ml +++ b/src/ftest.ml @@ -1,7 +1,14 @@ open Gfile open Tools open Findpath - +let rec mainloop graph p1 p2 = + let id_list =path_to_list (find_path graph p1 p2 (fun arc -> arc.lbl > 0)) in + match id_list with + |[] -> graph + |_ -> let min = take_min graph id_list max_int in + let graph = update_graph graph id_list min in + mainloop graph p1 p2 + let () = (* Check the number of command-line arguments *) @@ -32,10 +39,11 @@ let () = (*let () = export outfile graph in *) let graph = gmap graph (fun x -> (int_of_string x)) in - let id_list =path_to_list (find_path graph 0 5 (fun arc -> arc.lbl > 0)) in + (*let id_list =path_to_list (find_path graph 0 5 (fun arc -> arc.lbl > 0)) in let min = take_min graph id_list max_int in - let graph = update_graph graph id_list min in + let graph = update_graph graph id_list min in*) (*List.iter (fun x -> Printf.printf "%d " x) id_list; Printf.printf "\n\n%d " min*) + let graph= mainloop graph 0 5 in let graph = gmap graph (fun x -> (string_of_int x)) in let () =export outfile graph in () \ No newline at end of file