From dd09abcf919074732edb107c22f70739c52dd4af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Wikle=20DUBARD?= <loic97429@gmail.com>
Date: Tue, 31 Dec 2019 15:08:51 +0100
Subject: [PATCH] =?UTF-8?q?capacit=C3=A9=20(mininum=20des=20capacit=C3=A9s?=
 =?UTF-8?q?=20de=20toutes=20les=20arretes)=20du=20chemin=20c=20dans=20le?=
 =?UTF-8?q?=20graphe=20g?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/phase2.ml | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/phase2.ml b/src/phase2.ml
index 4727840..e5e7f1e 100644
--- a/src/phase2.ml
+++ b/src/phase2.ml
@@ -8,7 +8,6 @@
  *)
 module Graphe = Map.Make(String)
 module Arreteliste = Map.Make(String)
-module Clesliste = Set.Make(String)
 
 
 (*
@@ -84,4 +83,33 @@ let rec chemins s g  =
  *)
 let rec filtre f t nl = match nl with
   | [] -> []
-  | elt::ma -> if (List.nth elt 0) = f && (List.nth elt ((List.length elt)-1)) = t then elt::(filtre f t ma) else (filtre f t ma)
\ No newline at end of file
+  | elt::ma -> if (List.nth elt 0) = f && (List.nth elt ((List.length elt)-1)) = t then elt::(filtre f t ma) else (filtre f t ma)
+
+ (* 
+ capacité d'un chemin = min des capacités de chaque arrete 
+ 
+ initialisation : pour la liste des chemins du graphe je choisi le chemin de capacite maximum que je sature 
+ hérédité : pour la liste des chemins du graphe des capacité résiduelles je choisi le chemin de capacite maximum que je sature *)
+
+
+(* 
+ * [capacite c g] capacité (mininum des capacités de toutes les arretes) du chemin c dans le graphe g
+ *)
+let capacite c g = 
+  let rec min l a = match l with 
+    | [] -> a
+    | e::m -> if e<a then min m e else min m a
+  in
+  let rec liste_capacite m = match m with
+    | [] -> []
+    | elt::[] -> []
+    | e1::(e2::nl) -> (Arreteliste.find e2 (Graphe.find e1 g))::(liste_capacite nl)
+  in
+  let liste = liste_capacite c
+  in
+  let f b = min liste (List.nth liste 0)
+  in
+  List.map f c
+
+(* [graphe_capacite_residuelles c n g] donne le graphe des capacité résiduelles aprèes avoir retirer des arretes du chemin c le nombre n *)
+let rec graphe_capacites_residuelles c n g = 
\ No newline at end of file
-- 
GitLab