projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkpoint
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
util
/
GraphViz.java
diff --git
a/src/edu/berkeley/sbp/util/GraphViz.java
b/src/edu/berkeley/sbp/util/GraphViz.java
index
13899bb
..
bfef2f6
100644
(file)
--- a/
src/edu/berkeley/sbp/util/GraphViz.java
+++ b/
src/edu/berkeley/sbp/util/GraphViz.java
@@
-23,11
+23,13
@@
public class GraphViz {
public boolean directed = false;
public String color="black";
public ArrayList<Node> edges = new ArrayList<Node>();
public boolean directed = false;
public String color="black";
public ArrayList<Node> edges = new ArrayList<Node>();
+ public ArrayList<Object> labels = new ArrayList<Object>();
public ArrayList<Node> inbound = new ArrayList<Node>();
public ArrayList<Node> inbound = new ArrayList<Node>();
- public void edge(ToGraphViz o) {
+ public void edge(ToGraphViz o, Object label) {
Node n = o.toGraphViz(GraphViz.this);
if (n==null) return;
edges.add(n);
Node n = o.toGraphViz(GraphViz.this);
if (n==null) return;
edges.add(n);
+ labels.add(label);
n.inbound.add(this);
}
public String name() {
n.inbound.add(this);
}
public String name() {
@@
-37,8
+39,11
@@
public class GraphViz {
}
public void edges(PrintWriter pw) {
if (simple()) return;
}
public void edges(PrintWriter pw) {
if (simple()) return;
- for(Node n : edges)
- pw.println(" "+name()+" -> " + n.name() + " [color="+color+"];\n");
+ for(int i=0; i<edges.size(); i++) {
+ Node n = edges.get(i);
+ Object label = labels.get(i);
+ pw.println(" "+name()+" -> " + n.name() + " [color="+color+" " +(label==null?"":("label=\""+label+"\""))+ "];\n");
+ }
}
public int numEdges() { return edges.size(); }
public boolean simple() {
}
public int numEdges() { return edges.size(); }
public boolean simple() {