This function retrieves the ancestors of a specified node (clone) in a tree structure. It calculates the shortest path from the root node to the target node and returns the names of all ancestor nodes (excluding the target node itself).
get_clone_ancestors(tree, node)A character vector containing the names of the ancestor nodes, ordered from the root to the immediate parent of the target node.
The function:
Identifies the root node (assumes first vertex is root)
Finds shortest path from root to target node
Returns names of all nodes in the path
Assumes the tree is properly rooted with root node as first vertex