fixes to Node.toGraphViz()
[sbp.git] / src / edu / berkeley / sbp / Node.java
index 5c0f023..8710863 100644 (file)
@@ -56,13 +56,8 @@ final class Node
                 Node child = res.parent();
                 holder[pos] = res.getForest();
                 if (pos>0)  child.reduce(r, pos-1, target, null);
-                else {
-                    Reduction reduction =
-                        new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
-                    target.reductionQueue.add(reduction);
-                }
+                else new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
             }
-
         holder[pos] = old;
     }
 
@@ -91,14 +86,14 @@ final class Node
     // GraphViz //////////////////////////////////////////////////////////////////////////////
 
     public GraphViz.Node toGraphViz(GraphViz gv) {
+        if (results.size()==0) return null;
         if (gv.hasNode(this)) return gv.createNode(this);
         GraphViz.Node n = gv.createNode(this);
         n.label = ""+state.toStringx();
         n.shape = "rectangle";
         boolean hasparents = false;
-        //for(Node parent : parents()) { hasparents = true; n.edge(parent, ""); }
-        //for(Forest result : resultMap) n.edge(result, "");
-        n.color = !hasparents ? "blue" : /*state.evil ? "red" :*/ "green";
+        for(Result r : results) n.edge(r, "");
+        n.color = state.doomed ? "red" : "green";
         ((GraphViz.Group)phase().toGraphViz(gv)).add(n);
         return n;
     }