From ed9ddb66ff0329cef88116a5ba7b3de8cd1c34cd Mon Sep 17 00:00:00 2001 From: Baptiste Date: Mon, 2 Dec 2024 18:11:06 +0100 Subject: [PATCH] fix --- src/findpath.ml | 6 +++--- src/findpath.mli | 2 +- src/tools.mli | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/findpath.ml b/src/findpath.ml index d96b994..eb99981 100644 --- a/src/findpath.ml +++ b/src/findpath.ml @@ -34,10 +34,10 @@ let find_path (gr: 'a graph) (begin_node: id) (end_node: id) (filter: 'a arc -> with | Not_found -> [] -let path_to_list s = - let numbers = List.map int_of_string (String.split_on_char ' ' s) in +let path_to_list numbers = let rec build_pairs = function | x :: (y :: _ as rest) -> (x, y) :: build_pairs rest | _ -> [] in - build_pairs numbers \ No newline at end of file + build_pairs numbers + diff --git a/src/findpath.mli b/src/findpath.mli index 14633e8..84c67a8 100644 --- a/src/findpath.mli +++ b/src/findpath.mli @@ -7,4 +7,4 @@ val child_nodes: 'a graph -> id -> id list val find_path: 'a graph -> id -> id -> ('a arc -> bool) -> id list (* for example take [1;0;2;4] into [(1,0);(0,2);(2,4)]*) -val path_to_list: string -> (int * int) list \ No newline at end of file +val path_to_list: int list -> (int * int) list \ No newline at end of file diff --git a/src/tools.mli b/src/tools.mli index 357a80d..7f1c55d 100644 --- a/src/tools.mli +++ b/src/tools.mli @@ -11,4 +11,6 @@ val add_arc: int graph -> id -> id -> int -> int graph (* update_graph g l n : add n to all arcs in l. If an arc does not exist,it means that the arcs is in the otherside and the value is negative raise Not_found if the arc does not exist in the graph *) -val update_graph: int graph -> (id*id) list -> int -> int graph \ No newline at end of file +val update_graph: int graph -> (id*id) list -> int -> int graph + +val take_min: int graph -> (id * id) list -> int -> int \ No newline at end of file