From c13029a38794897d8cb7bdc39cefd1a2edb2e8a4 Mon Sep 17 00:00:00 2001
From: Christoph Egger <Christoph.Egger@fau.de>
Date: Tue, 16 Feb 2016 12:47:32 +0100
Subject: [PATCH] Color-code core/state status in graph output

---
 src/lib/CoAlgMisc.ml | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/lib/CoAlgMisc.ml b/src/lib/CoAlgMisc.ml
index 071e169..9718617 100644
--- a/src/lib/CoAlgMisc.ml
+++ b/src/lib/CoAlgMisc.ml
@@ -781,12 +781,20 @@ let stateToString (state:state): string =
     "}"
 
 let stateToDot (state:state): string =
+  let color = match state.statusS with
+    | Sat -> "green"
+    | Unsat -> "red"
+    | Open -> "yellow"
+    | Expandable -> "white"
+  in
   let ownidx = (string_of_int state.idx) in
   let parents =
-    List.map (fun (co:core) -> "Node"^string_of_int co.idx^" -> Node"^ownidx^";")
+    List.map (fun (co:core) ->
+              "Node"^string_of_int co.idx^" -> Node"^ownidx^";")
              state.parentsS
   in
-  "Node" ^ ownidx ^ " [shape=ellipse,label=\"State "  ^ ownidx
+  "Node" ^ ownidx ^ " [shape=ellipse,style=filled,fillcolor=" ^ color
+  ^ ",label=\"State "  ^ ownidx
   ^ "\\n" ^ (Str.global_replace (Str.regexp ", ") "\\n"
                                 (bsetToString state.sortS state.bsS))
   ^ "\"];\n"
@@ -794,12 +802,20 @@ let stateToDot (state:state): string =
 
 
 let coreToDot (core:core): string =
+  let color = match core.statusC with
+    | Sat -> "green"
+    | Unsat -> "red"
+    | Open -> "yellow"
+    | Expandable -> "white"
+  in
   let ownidx = (string_of_int core.idx) in
   let parents =
-    List.map (fun (st,_:state*int) -> "Node"^string_of_int st.idx^" -> Node"^ownidx^";")
+    List.map (fun (st,_:state*int) ->
+              "Node"^string_of_int st.idx^" -> Node"^ownidx^";")
              core.parentsC
   in
-  "Node" ^ ownidx ^ " [shape=ellipse,label=\"Core "  ^ ownidx
+  "Node" ^ ownidx ^ " [shape=ellipse,style=filled,fillcolor=" ^ color
+  ^ ",label=\"Core "  ^ ownidx
   ^ "\\n" ^ (Str.global_replace (Str.regexp ", ") "\\n"
                                 (bsetToString core.sortC core.bsC))
   ^ "\"];\n"
-- 
GitLab