void tree_sample::add_tree(RootedTree& T) { if (T.root().degree() == 2) T.remove_node_from_branch(T.root()); add_tree(static_cast<Tree&>(T)); }
bool reader_t::next_tree(RootedTree& T) { int r; Tree& T2 = static_cast<Tree&>(T); if (next_tree_(T2,r)) { lines_++; T.reroot(r); return true; } else return false; }
string write_no_names(const RootedTree& T, bool print_lengths) { vector<const_branchview> branches = sorted_neighbors(T.root()); string output = "("; for(int i=0;i<branches.size();i++) { output += write_no_names(branches[i],print_lengths); if (i+1 < branches.size()) output += ','; } output += ");"; return output; }
string write_with_bootstrap_fraction(const RootedTree& T, const vector<string>& names, const vector<double>& bf, bool print_lengths) { vector<const_branchview> branches = sorted_neighbors(T.root()); string output = "("; for(int i=0;i<branches.size();i++) { output += write_with_bootstrap_fraction(names,branches[i],bf,print_lengths); if (i+1 < branches.size()) output += ','; } output += ");"; return output; }
RootedTree::RootedTree(const RootedTree& t1, const RootedTree& t2) :Tree(t1),root_(nodes_[t1.root_->node]) { merge_tree(root(), t2, t2.root()); }