本文整理汇总了C++中SequenceTree::n_leafbranches方法的典型用法代码示例。如果您正苦于以下问题:C++ SequenceTree::n_leafbranches方法的具体用法?C++ SequenceTree::n_leafbranches怎么用?C++ SequenceTree::n_leafbranches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SequenceTree
的用法示例。
在下文中一共展示了SequenceTree::n_leafbranches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_lengths
bool update_lengths(const SequenceTree& Q,const SequenceTree& T,
valarray<double>& branch_lengths,
valarray<double>& branch_lengths_squared,
valarray<double>& node_lengths)
{
// map branches from Q -> T
vector<int> branches_map = extends_map(T,Q);
if (not branches_map.size())
return false;
// incorporate lengths of branches that map to Q
for(int b=0;b<Q.n_branches();b++)
{
int b2 = branches_map[b];
double L = T.directed_branch(b2).length();
branch_lengths[b] += L;
branch_lengths_squared[b] += L*L;
}
// map nodes from T -> Q
vector<int> nodes_map = get_nodes_map(Q,T,branches_map);
// incorprate lengths of branches that map to nodes in Q
for(int i=T.n_leafbranches();i<T.n_branches();i++)
{
const_branchview b = T.branch(i);
int n1 = nodes_map[b.source()];
int n2 = nodes_map[b.target()];
if (n1 == n2)
node_lengths[n1] += T.branch(i).length();
}
return true;
}
示例2:
vector<Partition> internal_partitions_from_tree(const SequenceTree& T)
{
vector<Partition> partitions;
for(int b=T.n_leafbranches();b<T.n_branches();b++)
partitions.push_back(partition_from_branch(T,b));
return partitions;
}