public void setGraph(Graph<V,E> graph) { this.graph = graph; if(size != null && graph != null) { initialize(); } }
public void setGraph(Graph<V,E> graph) { this.graph = graph; if(size != null && graph != null) { initialize(); } }
/** * When a visualization is resized, it presumably wants to fix the * locations of the vertices and possibly to reinitialize its data. The * current method calls <tt>initializeLocations</tt> followed by <tt>initialize_local</tt>. */ public void setSize(Dimension size) { if(size != null && graph != null) { Dimension oldSize = this.size; this.size = size; initialize(); if(oldSize != null) { adjustLocations(oldSize, size); } } }
/** * When a visualization is resized, it presumably wants to fix the * locations of the vertices and possibly to reinitialize its data. The * current method calls <tt>initializeLocations</tt> followed by <tt>initialize_local</tt>. */ public void setSize(Dimension size) { if(size != null && graph != null) { Dimension oldSize = this.size; this.size = size; initialize(); if(oldSize != null) { adjustLocations(oldSize, size); } } }
public void process() { try { if (g.getVertexCount() < 100) { layout.lock(true); //add a vertex Integer v1 = new Integer(g.getVertexCount()); Relaxer relaxer = vv.getModel().getRelaxer(); relaxer.pause(); g.addVertex(v1); System.err.println("added node " + v1); // wire it to some edges if (v_prev != null) { g.addEdge(g.getEdgeCount(), v_prev, v1); // let's connect to a random vertex, too! int rand = (int) (Math.random() * g.getVertexCount()); g.addEdge(g.getEdgeCount(), v1, rand); } v_prev = v1; layout.initialize(); relaxer.resume(); layout.lock(false); } else { done = true; } } catch (Exception e) { System.out.println(e); } }