tskit-dev/tskit

Avoid unnecessary upwards traversals in `tsk_pair_coalescence_stat`

Opened this issue · 0 comments

tsk_pair_coalescence_stat propagates changes in sample counts/pair counts upwards to the root from edge insertions/deletions. However, if sample_sets is such that removing/adding a given edge has no impact on pair counts, there's no need to do the traversal to the roots. This should speed things up substantially when sample_sets is a small subset of the tree sequence.