create ff algo functions definitions

This commit is contained in:
Arnaud Vergnet 2020-11-12 14:03:12 +01:00
parent 5ffa39c47b
commit 7c268e5739
2 changed files with 47 additions and 0 deletions

38
src/ffalgo.ml Normal file
View file

@ -0,0 +1,38 @@
open Graph
open Printf
open Tools
type 'a network = {
graph: 'a graph;
origin: id;
destination: id;
}
type flow = {
current: int;
capacity: int;
}
type path = (id * id) list
(* int graph -> flow graph *)
let initialize_graph gr = gmap gr (fun c -> { current = 0; capacity = c })
(* flow graph -> int graph *)
let build_res_network gr = let gr_res = clone_nodes gr in
e_fold gr (fun g origin destination fl ->
let new_g = add_arc g origin destination (fl.capacity - fl.current) in
add_arc new_g destination origin fl.current ) gr_res
(* int network -> path *)
let find_path network = assert false
(* path -> int *)
let find_min path = assert false
(* flow graph -> path -> aug -> flow graph *)
let apply_path graph path aug = assert false
let run_ff network = assert false

9
src/ffalgo.mli Normal file
View file

@ -0,0 +1,9 @@
open Graph
type 'a network = {
graph: 'a graph;
origin: int;
destination: int;
}
val run_ff: int network -> int