-
- }else{
- if (lc == -1) { dists[i] = T->tree[i].getBranchLength(); }
- else { //smaller of my two children distances plus my branch length
- //look at your children's length to leaf
- float ldist = dists[lc];
- float rdist = dists[rc];
-
- float smaller = ldist;
- if (rdist < smaller) { smaller = rdist; }
-
- dists[i] = smaller + T->tree[i].getBranchLength();
+ }
+ }
+
+ dists.clear();
+
+ for (int i = 0; i < T->getNumNodes(); i++) {
+
+ double sum = 0.0;
+ int index = i;
+
+ while(T->tree[index].getParent() != -1){
+ if (T->tree[index].getBranchLength() != -1) {
+ sum += abs(T->tree[index].getBranchLength());