public void attemptToScaleTree(MutableTree tree, double rootHeight) { // avoid empty tree if (tree.getRoot() == null) return; double scale = rootHeight / tree.getNodeHeight(tree.getRoot()); for (int i = 0; i < tree.getInternalNodeCount(); i++) { NodeRef n = tree.getInternalNode(i); tree.setNodeHeight(n, tree.getNodeHeight(n) * scale); } MutableTree.Utils.correctHeightsForTips(tree); }