allShortEdges.addAll(shortEdges);
allOtherEdges.addAll(otherEdges);
}
//for the poster
Graph gp = new BasicGraph(nodes, edges);
javax.swing.JFrame frame = new javax.swing.JFrame();
GraphViewer viewer = new GraphViewer();
viewer.setLongEdges(allLongEdges);
viewer.setShortEdges(allShortEdges);
viewer.setOtherEdges(allOtherEdges);
viewer.setColorEdges(true);
viewer.setGraph(gp);
frame.getContentPane().add(viewer);
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
frame.setSize(new java.awt.Dimension(800, 800));
frame.setTitle("Assigned edge categories");
frame.setVisible(true);
//Phase I
Iterator nodeIt3 = nodes.iterator();
while (nodeIt3.hasNext()){
DelaunayNode next = (DelaunayNode) nodeIt3.next();
AutoClustData acd = (AutoClustData) map.get(next);
List shortEdges = acd.getShortEdges();
List longEdges = acd.getLongEdges();
edges.removeAll(shortEdges);
LOGGER.finer("removed " + shortEdges);
edges.removeAll(longEdges);
LOGGER.finer("removed " + longEdges);
}
LOGGER.fine("End of phase one and ");
LOGGER.fine("Nodes are " + nodes);
LOGGER.fine("Edges are " + edges);
showGraph(nodes, edges, 1);
Vector connectedComponents = AutoClustUtils.findConnectedComponents(nodes, edges);
//Phase II
Iterator nodeIt4 = nodes.iterator();
while (nodeIt4.hasNext()){
DelaunayNode next = (DelaunayNode) nodeIt4.next();
AutoClustData acd = (AutoClustData) map.get(next);
List shortEdges = acd.getShortEdges();
if (!(shortEdges.isEmpty())){
Vector shortlyConnectedComponents = new Vector();
Iterator shortIt = shortEdges.iterator();
while (shortIt.hasNext()){
Edge nextEdge = (Edge) shortIt.next();
Node other = nextEdge.getOtherNode(next);
Graph g = getMyComponent(other, connectedComponents);
if (!(shortlyConnectedComponents.contains(g))){
shortlyConnectedComponents.add(g);
}
}
Graph cv = null;
if (shortlyConnectedComponents.size() > 1){
Iterator sccIt = shortlyConnectedComponents.iterator();
int maxSize = 0;
while (sccIt.hasNext()){
Graph nextGraph = (Graph) sccIt.next();
int size = nextGraph.getNodes().size();
if (size > maxSize){
maxSize = size;
cv = nextGraph;
}
}
} else {
cv = (Graph) shortlyConnectedComponents.get(0);
}
Iterator shortIt2 = shortEdges.iterator();
while (shortIt2.hasNext()){
Edge nextEdge = (Edge) shortIt2.next();
Node other = nextEdge.getOtherNode(next);
if (cv.equals(getMyComponent(other, shortlyConnectedComponents))){
edges.add(nextEdge);
}
}
} //end if shortEdges isn't empty
Graph gr = getMyComponent(next, connectedComponents);
if (gr.getNodes().size() == 1){
Vector shortlyConnectedComponents = new Vector();
Iterator shortIt = shortEdges.iterator();
while (shortIt.hasNext()){
Edge nextEdge = (Edge) shortIt.next();
Node other = nextEdge.getOtherNode(next);
Graph g = getMyComponent(other, connectedComponents);
if (!(shortlyConnectedComponents.contains(g))){
shortlyConnectedComponents.add(g);
}
}
if (shortlyConnectedComponents.size() == 1){