public void compute() { nodeMoved = 0; if (structureChanged) { structureChanged = false; computePositions(); } publishPositions(); lastStep = System.currentTimeMillis(); }
levels[n.getIndex()] = 0; columns[n.getIndex()] = i; setBox(rootBox, n); Node root = roots.poll(); int level = levels[root.getIndex()] + 1; Box box = getChildrenBox(root); roots2.add(op); op.setAttribute("parent", root); setBox(box, op); Box box = getChildrenBox(internalGraph.getNode(i)); renderBox(boxes.extractMin());
protected void setBox(Box box, Node node) { if (node.hasAttribute("box")) getBox(node).remove(node); box.add(node); node.setAttribute("box", box); if (!node.hasAttribute("children")) node.addAttribute("children", new Box(node, 1)); getChildrenBox(node).level = box.level + 1; }
protected void publishPositions() { for (Node n : internalGraph) { if (n.hasAttribute("changed")) { n.removeAttribute("changed"); sendNodeAttributeChanged(sourceId, n.getId(), "xyz", null, new double[] { n.getNumber("x"), n.getNumber("y"), 0 }); } } }
public static void main(String... args) { Graph g = new AdjacencyListGraph("g"); BarabasiAlbertGenerator gen = new BarabasiAlbertGenerator(); HierarchicalLayout hl = new HierarchicalLayout(); gen.addSink(g); gen.begin(); for (int i = 0; i < 200; i++) gen.nextEvents(); gen.end(); Viewer v = g.display(false); v.enableAutoLayout(hl); } }
levels[n.getIndex()] = 0; columns[n.getIndex()] = i; setBox(rootBox, n); Node root = roots.poll(); int level = levels[root.getIndex()] + 1; Box box = getChildrenBox(root); roots2.add(op); op.setAttribute("parent", root); setBox(box, op); Box box = getChildrenBox(internalGraph.getNode(i)); renderBox(boxes.extractMin());
protected void setBox(Box box, Node node) { if (node.hasAttribute("box")) getBox(node).remove(node); box.add(node); node.setAttribute("box", box); if (!node.hasAttribute("children")) node.addAttribute("children", new Box(node, 1)); getChildrenBox(node).level = box.level + 1; }
protected void publishPositions() { for (Node n : internalGraph) { if (n.hasAttribute("changed")) { n.removeAttribute("changed"); sendNodeAttributeChanged(sourceId, n.getId(), "xyz", null, new double[] { n.getNumber("x"), n.getNumber("y"), 0 }); } } }
public static void main(String... args) { Graph g = new AdjacencyListGraph("g"); BarabasiAlbertGenerator gen = new BarabasiAlbertGenerator(); HierarchicalLayout hl = new HierarchicalLayout(); gen.addSink(g); gen.begin(); for (int i = 0; i < 200; i++) gen.nextEvents(); gen.end(); Viewer v = g.display(false); v.enableAutoLayout(hl); } }
public void compute() { nodeMoved = 0; if (structureChanged) { structureChanged = false; computePositions(); } publishPositions(); lastStep = System.currentTimeMillis(); }