-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Labels
Python APIIssue is about the Python APIIssue is about the Python APIenhancementNew feature or requestNew feature or request
Description
As I've been implementing tree traversal methods, I've commonly wanted to go up the chain of parents for a node. I think there's a good argument for a tree.parents(u) (or tree.ancestors?) method which returns an iterator which then stops when the root is reached. This is a pretty fundamental tree operation and handy to avoid messing with all that tskit.NULL stuff for newbies:
def parents(self, u):
while self.parent(u) != tskit.NULL:
u = self.parent(u)
yield uThoughts? Worth the extra API burden?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Python APIIssue is about the Python APIIssue is about the Python APIenhancementNew feature or requestNew feature or request