From cbd88f9238dbd66acacb782bdc0fd3aa9a82b804 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 1 Jul 2014 17:38:27 +0200 Subject: Small changes in Graphwiz export : same vars at same level. --- abstract/abs_interp_edd.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'abstract') diff --git a/abstract/abs_interp_edd.ml b/abstract/abs_interp_edd.ml index f08be44..510bf93 100644 --- a/abstract/abs_interp_edd.ml +++ b/abstract/abs_interp_edd.ml @@ -200,6 +200,8 @@ end = struct let fmt = Format.formatter_of_out_channel o in Format.fprintf fmt "digraph G {@[@,"; + let nov = Hashtbl.create 12 in + let f f_rec = function | DChoice(n, v, x) -> let aux fmt = function @@ -208,12 +210,21 @@ end = struct | DVal(i, _) -> Format.fprintf fmt "v%d" i | DChoice(n, _, _) -> Format.fprintf fmt "n%d" n in + let p = try Hashtbl.find nov v with _ -> [] in + Hashtbl.replace nov v (n::p); Format.fprintf fmt "n%d [label=\"%s\"];@ " n v; List.iter (fun (i, c) -> if c <> DBot then Format.fprintf fmt "n%d -> %a [label=\"%s\"];@ " n aux c i; f_rec c) x | _ -> () in memo f v.root; + + Hashtbl.iter (fun var nodes -> + Format.fprintf fmt "{ rank = same; "; + List.iter (Format.fprintf fmt "n%d; ") nodes; + Format.fprintf fmt "}@ ") + nov; + Format.fprintf fmt "@]}@."; close_out o -- cgit v1.2.3