Another Simulation Campaign: Comparing Spanning Trees Construction

By re-using the OCaml scripts presented in in this post we can compare various Spanning Trees construction Algorithms on cliques and random graphs (generated with the Ernos-Reny algorithm).

sasa/tools/simca/spanning_tree_campaign.ml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#use "genExpeMakefiles.ml";;
let algos = ["../../test/bfs-spanning-tree";
             "../../test/dfs";
             "../../test/bfs-st-HC92";
             "../../test/st-CYH91";
             "../../test/st-KK06-algo1";
             "../../test/st-KK06-algo2"
             ]
let daemons = ["-cd";"-dd"]
let cliques = List.init 10 (fun n -> Clique (20*(n+1)))  (* [20; 40; ...; 200] *)
let er = List.init 10 (fun n -> ER (10*(n+1), 0.4)) (* [10; 20; ...; 100] *)

let gen_make_rules () =
  precision := 0.5;
  let fn = "Makefile.expe-rules" in
  let oc = open_out fn in
  Printf.fprintf oc "# Generated by spanning_tree_campaign.ml / gen_make_rules";
  let compare_neg x y = compare y x in
  let l = List.sort_uniq compare_neg (cliques @ er) in
  let targets,targets_cmxs = gen_makefile_incr oc daemons algos l [] [] in
  Printf.fprintf oc "\nCMXS=%s\n"  (String.concat " " targets_cmxs);
  Printf.fprintf oc "\nLOG=%s\n%!" (String.concat " " targets);
  Printf.printf "%s has been generated\n%!" fn;
  close_out oc
;;
#use "parseLog.ml";;
let gen_pdf () =
  let gl = ["clique"; "er"] in
  List.iter (fun n -> sh ("rm -f "^n^".data")) gl;
  parse_log ["BFS book", "bfs-spanning-tree";
             "DFS book", "dfs";
             "HC92", "bfs-st-HC92";
             "CYH91", "st-CYH91";
             "KK06-algo1", "st-KK06-algo1";
             "KK06-algo2", "st-KK06-algo2"]
    gl daemons;
  List.iter (fun n -> sh ("./gen_pdf.r "^n^".data Tree")) gl
;;

To generate the following pdf files:

Cliques - Focus on Algorithms Cliques - Focus on Daemons
Erdos-Renyi - Focus on Algorithms Erdos-Renyi - Focus on Daemons