Commit 6dceaf26 authored by Quentin Kaci's avatar Quentin Kaci
Browse files

Fix parent relation in alpha tree

parent 03fed0c8
......@@ -211,14 +211,18 @@ namespace mln::morpho
// Do we need to create a new node
int rp_root = links[rp];
int rq_root = links[rq];
int max_root = std::max(rp_root, rq_root);
int min_root = std::min(rp_root, rq_root);
int new_root_id;
if (levels[rq_root] == w)
if (levels[max_root] == w)
{
new_root_id = rq_root;
new_root_id = max_root;
}
else if (levels[rp_root] == w)
else if (levels[min_root] == w)
{
new_root_id = rp_root;
new_root_id = min_root;
}
else
{
......@@ -287,4 +291,4 @@ namespace mln::morpho
return {std::move(t), std::move(node_map)};
}
} // namespace mln::morpho
} // namespace mln::morpho
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment