Skip to content

Comments

Create-subtree#78

Merged
leoguignard merged 6 commits intov2.xfrom
create-subtree
Jun 27, 2025
Merged

Create-subtree#78
leoguignard merged 6 commits intov2.xfrom
create-subtree

Conversation

@leoguignard
Copy link
Member

Adding the get_subtree function that takes a list of nodes as an input and creates the subtree with the same properties and without the nodes not in the input set of nodes

Comment on lines +3352 to +3370
def get_subtree(self, node_list: set[int]) -> lineageTree:
new_successors = {
n: tuple(vi for vi in self.successor[n] if vi in node_list)
for n in node_list
}
return lineageTree(
successor=new_successors,
time=self._time,
pos=self.pos,
name=self.name,
root_leaf_value=[
(),
],
**{
name: self.__dict__[name]
for name in self._custom_property_list
},
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a way to extract lineageTrees, should we not be able to inject them too?

@leoguignard leoguignard requested a review from BadPrograms June 27, 2025 11:51
@leoguignard leoguignard merged commit 1f682c1 into v2.x Jun 27, 2025
3 checks passed
@leoguignard leoguignard deleted the create-subtree branch June 27, 2025 14:02
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

Successfully merging this pull request may close these issues.

2 participants