This is a convinience function, internal borrowed from https://github.com/NickWilliamsSanger/treemut/blob/main/R/treemut.R#L68

get_ancestral_nodes(node, edge, exclude_root = TRUE)