Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add permute function #28

Open
jeromekelleher opened this issue Aug 2, 2022 · 0 comments
Open

Add permute function #28

jeromekelleher opened this issue Aug 2, 2022 · 0 comments

Comments

@jeromekelleher
Copy link
Owner

We would like a function that permutes the nodes in dataset into a different ordering, e.g.

def permute_nodes(ds, ordering):
     """
     Returns a new dataset in which the tree nodes have been permuted according to the specified ordering
     such that  node u in the new dataset will be equivalent to ``ordering[u]``.
     """

For example, if we wanted to permute the nodes so that they are in preorder (for efficiency in large tree algorithms), we would do

ds_preorder = pk.permute_nodes(ds, pk.preorder(ds))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant