Skip to content

Add permute function #28

@jeromekelleher

Description

@jeromekelleher

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions