Skip to content

Commit 1586d4d

Browse files
mmolariivan-aksamentov
authored andcommitted
feat: only execute trivial node cleanup if root changes
1 parent 70ae1ce commit 1586d4d

File tree

1 file changed

+4
-4
lines changed
  • packages/treetime/src/commands/clock

1 file changed

+4
-4
lines changed

packages/treetime/src/commands/clock/reroot.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ where
4848

4949
if new_root_key != old_root_key {
5050
apply_reroot(graph, old_root_key, new_root_key, options)?;
51-
}
5251

53-
// Clean up old root if it is now a trivial node, i.e. has exactly one parent and one child
54-
// Nb: the attributes of the old root node and branches (other than branch lengths) are discarded
55-
remove_node_if_trivial(graph, old_root_key)?;
52+
// Clean up old root if it is now a trivial node, i.e. has exactly one parent and one child
53+
// Nb: the attributes of the old root node and branches (other than branch lengths) are discarded
54+
remove_node_if_trivial(graph, old_root_key)?;
55+
}
5656

5757
Ok(new_root_key)
5858
}

0 commit comments

Comments
 (0)