Skip to content
Snippets Groups Projects
Commit 1476ba37 authored by Nicolas Marsic's avatar Nicolas Marsic
Browse files

Bug Fix: forgot to copy next choices when unserializing a permutation tree

parent cd033d5c
Branches
Tags
No related merge requests found
......@@ -191,11 +191,14 @@ void PermutationTree::rebuild(std::vector<unlink_t>& unlink){
list<node_t*> listOfLeaf;
for(size_t i = 1; i < nextNodeId; i++){
// Father
node[i]->father = node[unlink[i].fatherId];
// Son
for(size_t j = 0; j < node[i]->son.size(); j++)
node[i]->son[j] = node[unlink[i].sonId[j]];
// Leaf (if it is actualy a leaf)
if(node[i]->leafId != (size_t)(-1))
listOfLeaf.push_back(node[i]);
}
......@@ -210,6 +213,9 @@ PermutationTree::node_t* PermutationTree::copy(unlink_t* unlink){
node->myChoice = unlink->myChoice;
node->nxtChoice.resize(unlink->nNxtChoice);
for(size_t i = 0; i < unlink->nNxtChoice; i++)
node->nxtChoice[i] = unlink->nxtChoice[i];
node->father = NULL;
node->son.resize(unlink->nSon);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment