@Override
 public List<Integer> getLeaves() {
   int externalNodeCount = tree.getExternalNodeCount();
   List<Integer> leaves = new ArrayList<Integer>(externalNodeCount);
   for (int i = 0; i < externalNodeCount; ++i) leaves.add(tree.getExternalNode(i).getNumber());
   return leaves;
 }
Example #2
0
  public double[] getSummaryStatistic(Tree tree) {

    double externalLength = 0.0;
    double internalLength = 0.0;

    int externalNodeCount = tree.getExternalNodeCount();
    for (int i = 0; i < externalNodeCount; i++) {
      NodeRef node = tree.getExternalNode(i);
      externalLength += tree.getBranchLength(node);
    }

    int internalNodeCount = tree.getInternalNodeCount();
    for (int i = 0; i < internalNodeCount; i++) {
      NodeRef node = tree.getInternalNode(i);
      if (!tree.isRoot(node)) {
        internalLength += tree.getBranchLength(node);
      }
    }
    return new double[] {internalLength + externalLength};
  }
 @Override
 public int getNoOfLeaves() {
   return tree.getExternalNodeCount();
 }