/** * Add vertex as a root of the tree * * @param vertex the tree root to add * @return true if this call mutates the underlying graph * @see edu.uci.ics.jung.graph.Graph#addVertex(java.lang.Object) */ @Override public boolean addVertex(V vertex) { setRoot(vertex); return true; }
/** * Add vertex as a root of the tree * * @param vertex * the tree root to add * @return true if this call mutates the underlying graph * @see edu.uci.ics.jung.graph.Graph#addVertex(java.lang.Object) */ @Override public boolean addVertex(V vertex) { setRoot(vertex); return true; }
public DerivationTreeTransformer(DerivationTree t, Dimension d, boolean isAnchored) { this.isAnchored = isAnchored; anchorPoint = new Point2D.Double(0, 0); graph = t; DelegateForest<Node, DerivationTreeEdge> del = new DelegateForest<>(t); del.setRoot(t.root); del.setRoot(t.sourceRoot); root = t.root; sourceRoot = t.sourceRoot; Y_DIST = d.getHeight() / (2 * (1 + distanceToLeaf(root))); int leafCount = 0; for (Node n : t.getVertices()) { if (t.outDegree(n) == 0) leafCount++; } X_DIST = d.getWidth() / leafCount; treeLayout = new TreeLayout<>(del, (int) Math.round(X_DIST)); }