From 7e93db834880845d824aa70d895f3001b0915d2f Mon Sep 17 00:00:00 2001 From: Leandro-rdz Date: Mon, 2 Dec 2024 12:29:04 +0100 Subject: [PATCH] fix : add the fact that we add the value if the arc already exists --- src/tools.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools.ml b/src/tools.ml index b40c1b4..dcbf8a4 100644 --- a/src/tools.ml +++ b/src/tools.ml @@ -9,5 +9,11 @@ let gmap gr f = e_fold gr (fun gr arc -> new_arc gr {arc with lbl = f arc.lbl}) (* adds n to the value of the arc between id1 and id2. If the arc does not exist, it is created *) let add_arc g id1 id2 n= match find_arc g id1 id2 with - | Some _ -> g - | None -> let arc = {src = id1; tgt = id2; lbl = n} in new_arc g arc \ No newline at end of file + | Some arc -> let new_lbl = arc.lbl + n in new_arc g {arc with lbl = new_lbl} + | None -> let arc = {src = id1; tgt = id2; lbl = n} in new_arc g arc + + + (* Tools to do : + - Update graph : take a list and a value -> add this value to all arc in the list + we must do a find_arc and if it doesn't find we try to do the arc in the other side with the value in negative + -Find path : find a patch and return a list of arc and a value : the max of increase *) \ No newline at end of file