Esempio n. 1
0
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));
}
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
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;
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
RootedTree::RootedTree(const RootedTree& t1, const RootedTree& t2) 
  :Tree(t1),root_(nodes_[t1.root_->node])
{
  merge_tree(root(), t2, t2.root());
}