feat : add take_min from a list

This commit is contained in:
Leandro-rdz 2024-12-02 17:40:58 +01:00
parent 88b3be157b
commit 71ab30c3bb

View file

@ -24,3 +24,11 @@ let update_graph graph list value =
add_arc graph id2 id1 value
in aux graph rest value
in aux graph list value
let rec take_min graph l acu =
match l with
|[]->acu
|(id1,id2)::rest -> let arc = find_arc graph id1 id2 in
match arc with
| None-> raise Not_found
| Some x -> if x.lbl < acu then take_min graph rest x.lbl else take_min graph rest acu