Skip to content
Snippets Groups Projects
Commit 36815247 authored by erwan's avatar erwan
Browse files

add support of init search in test/coloring

parent 2dbf4f75
No related branches found
No related tags found
No related merge requests found
......@@ -12,5 +12,14 @@ let clash_number pidl get =
let potential = Some clash_number
(* let potential = None *)
let legitimate = None
let fault = None
let init_search_utils = None
let fault = None
let md = max_degree ()
let s2n s = [I (0, s, md)]
let n2s nl s =
match nl with
| [I(_, i, _)] -> i
| _ -> assert false
let init_search_utils = Some (s2n, n2s)
(* Time-stamp: <modified the 28/07/2021 (at 09:01) by Erwan Jahier> *)
(* Time-stamp: <modified the 12/10/2021 (at 15:42) by Erwan Jahier> *)
(* This is algo 3.1 in the book *)
open Algo
let k = if is_directed () then
failwith "this algo is for non-directed graphs!" card()+1
failwith "this algo is for non-directed graphs!"
else
max_degree () + 1
......@@ -12,7 +12,9 @@ let (init_state: int -> string -> 'v) = fun i _ -> Random.int i
let (colors : 'v neighbor list -> 'v list) = fun nl ->
List.map (fun n -> state n) nl
(* Returns the free colors is ascending order (n.log(n)) *)
(* Returns the free colors is ascending order (n.log(n))
nb: suppose that all states are in [0;k-1]
*)
let (free : 'v neighbor list -> 'v list) = fun nl ->
let comp_neg x y = - (compare x y) in
let n_colors = List.map (fun n -> state n) nl in (* neighbor colors *)
......
......@@ -4,7 +4,7 @@
type t = int
let to_string = Printf.sprintf "c=%i"
let of_string = Some int_of_string
let of_string = Some (fun s -> Scanf.sscanf s "c=%i" (fun s -> s))
let copy = fun x -> x
let actions = ["conflict"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment