feat : add take_min from a list
This commit is contained in:
parent
88b3be157b
commit
71ab30c3bb
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
Loading…
Reference in a new issue