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

fix: make sure that graph constant are not generated twice in the oracle.lus (-glos)

parent 71edd39f
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 14/02/2020 (at 09:31) by Erwan Jahier> *)
(* Time-stamp: <modified the 11/03/2020 (at 14:13) by Erwan Jahier> *)
open Process
......@@ -14,9 +14,29 @@ let (matrix_to_string : bool array array -> string) =
let l = Array.fold_right (fun a acc -> (array_to_string a)::acc) m [] in
"[\n\t"^(String.concat ",\n\t" l)^"]"
let already_defined = function (* some attributes may already be defined *)
| "links_number"
| "degree"
| "min_degree"
| "mean_degree"
| "diameter"
| "card"
| "is_cyclic"
| "is_connected"
| "is_a_tree"
| "f"
| "t"
| "adjacency" -> true
| _ -> false
let graph_attributes_to_string () =
let al = Register.graph_attribute_list () in
let l = List.map (fun (n,v) -> Printf.sprintf "const %s=%s;\n" n v) al in
let l = List.map
(fun (n,v) -> if not (already_defined n) then
Printf.sprintf "const %s=%s;\n" n v else "")
al
in
String.concat "" l
......
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