Adds getAncestors method to thin-tree.