src/new_tree_rearrangements/main_helper.cpp
//add a root above current root, so nodes can move above the current node
add a root above current root, so nodes can move above the current node
add a root above current root so nodes can move above the current node
void add_root(MAT::Tree *tree) {
    MAT::Node *old_root = tree->root;
    MAT::Node *new_root = new MAT::Node();
    new_root->identifier = std::to_string(++tree->curr_internal_node);
    std::string &node_name = new_root->identifier;
    new_root->children.push_back(old_root);
    tree->all_nodes.emplace(node_name, new_root);
    old_root->parent=new_root;
    tree->root=new_root;
}
void add_root ( MAT :: Tree * tree ) { MAT :: Node * old_root = tree -> root ; MAT :: Node * new_root = new MAT :: Node ( ) ; new_root -> identifier = std :: to_string ( ++ tree -> curr_internal_node ) ; std :: string & node_name = new_root -> identifier ; new_root -> children . push_back ( old_root ) ; tree -> all_nodes . emplace ( node_name , new_root ) ; old_root -> parent = new_root ; tree -> root = new_root ; }
add a root above current root, so nodes can move above the current node
add a root above current root so nodes can move above the current node