this.model = model;
}
public void loadGraph() {
//dosomething
ClusterHead ch = null;
if(model.isClusterHead()){
}
try {
if(!model.isClusterHead()){
ch = TreeLoader.loadTreeFromDot(model.getDotName());
}else{
ch = TreeLoader2.loadTreeFromSerial(model.getDotName());
}
primitives.graph.Graph g = new primitives.graph.Graph(ch.getNodes());
DirectedSparseMultigraph go = new DirectedSparseMultigraph();
//HashMap<Node,String> nodes = new HashMap<Node,String>();
for (Node n : g.getNodes()) {
go.addVertex(n);
}
for (Node n : g.getNodes()) {
for (Transition t : n.getTransitionsAsT()) {
go.addEdge(t.getLabel() + "<!--" + Math.random() + "-->", n, t.getDestinationNode());
//JUNG's E set must be distinct, so chuck some random crap on the end of each label
//to make each one unique. HTML is used when rendering so we hide the random crap with a comment
}
}
try {
if(!model.isClusterHead())
ch = SILReader.clusterTreeBySIL(g, new File(model.getSilName()));
HashMap<String, HashSet<Node>> clusters = new HashMap<String, HashSet<Node>>();
for (IClusterLevel l : ch.getChildren()) {
String c = "C" + Math.random();
clusters.put(c, new HashSet<Node>());
for (Node n : l.getNodes()) {
clusters.get(c).add(n);
}