list<int> suc(int i,int j,int n,int* P,double* &T,int* Suc1,int* Suc2,bool* flag,bool* & leaf,int* & Pre,list<int> &sucL,list<int> &sucI){ list<int> result; int s1=Suc1[j]; int s2=Suc2[j]; if (i==0 && j!=0){ leaf[j]=true; T[j]=T[0];} if (flag[s1]){ Pre[s1]=i; if (leaf[s1]) sucL.push_back(s1); else sucI.push_back(s1); } else{ list<int> l1=suc(i,s1,n,P,T,Suc1,Suc2,flag,leaf,Pre,sucL,sucI); concatPos(l1,result); } if (flag[s2]){ Pre[s2]=i; if (leaf[s2]) sucL.push_back(s2); else sucI.push_back(s2); } else{ list<int> l2=suc(i,s2,n,P,T,Suc1,Suc2,flag,leaf,Pre,sucL,sucI); concatPos(l2,result); } if (j!=i) result.push_back(j); return result; }
list<int> suc_polytomy(int i,int j,Pr* pr,Node** nodes,int* & Pre,list<int> &suc){ list<int> result; if (leaf(nodes[i])) { nodes[j]->D=nodes[i]->D; activeMarkLeaf(nodes[j]); } if (j>=pr->nbINodes) { result.push_back(j); Pre[j]=i; if (markLeaf(nodes[j]) || j<pr->nbINodes) suc.push_back(j); } else{ for (vector<int>::iterator iter=nodes[j]->suc.begin(); iter!=nodes[j]->suc.end(); iter++) { int s=*iter; if (!tc(nodes[s])) { Pre[s]=i; if (markLeaf(nodes[s]) || s<pr->nbINodes) suc.push_back(s); } else{ list<int> l1=suc_polytomy(i,s,pr,nodes,Pre,suc); concatPos(l1,result); } } if (j!=i) result.push_back(j); } return result; }