本文整理汇总了C++中TreeNode::SubstituteNodeWithRespectToAnc方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::SubstituteNodeWithRespectToAnc方法的具体用法?C++ TreeNode::SubstituteNodeWithRespectToAnc怎么用?C++ TreeNode::SubstituteNodeWithRespectToAnc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::SubstituteNodeWithRespectToAnc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Prune
//MTH
void TreeNode::Prune()
{ //DZ 7-6 removing adjustments to branch lengths when pruning, which just result in adding a whole bunch of length
//to the whole tree, making the dlens get longer and longer and longer as the run progresses
assert(anc);//never call with this=root
attached=false;
if(anc->anc)
{//not connected to the root
if(anc->left->next==anc->right)
{TreeNode *sis;
if(anc->left==this)
sis=anc->right;
else
sis=anc->left;
// sis->dlen+=anc->dlen;
anc->SubstituteNodeWithRespectToAnc(sis);
anc->attached=false;
}
else
{
anc=anc;
assert(0);//internal polytomy
}
}
else
{
//these assume a trifurcating root
if(anc->left==this){
anc->left=next;
anc->left->prev=NULL;
anc->left->next=anc->right;
}
else
if(anc->right==this){
anc->right=prev;
anc->right->next=NULL;
anc->left->next=anc->right;
}
else
{assert(anc->left==prev && anc->right==next);
next->prev=prev;
prev->next=next;
assert(anc->left && anc->right);
TreeNode *temp;
if(anc->left->left){
//anc->right->dlen+=anc->left->dlen;
temp=anc->left;
temp->SubstituteNodeWithRespectToAnc(temp->left);
anc->AddDes(temp->right);
temp->attached=false;
}
else
if(anc->right->left){
//anc->left->dlen+=anc->right->dlen;
temp=anc->right;
temp->SubstituteNodeWithRespectToAnc(temp->left);
anc->AddDes(temp->right);
temp->attached=false;
}
}
}
}