Skip to content

TreeSequence.preorder(u) function #3339

@jeromekelleher

Description

@jeromekelleher

This should equivalent to

all_descendants = []
for tree in ts.trees():
    all_descendants = np.union1d(
        all_descendants, np.sort(tree.preorder(alpha_origin["node_id"])))

But in graph preorder.

I think the algorithm is here: #2869 (reply in thread)

We can add other traversal orders if they seem useful, but this seems like a good place to start. Return value is a numpy array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Python APIIssue is about the Python API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions