You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
include windows in genetic_relatedness_vector #2996
I was a bit worried about how to efficiently deal with clearing out state between windows, but there's a nice way. Naively, we could start at each sample and traverse up the tree to the root to compute the state for that sample. That'd be O(N log N). However, if we clear the state of each node we pass through on the way, that lets us know "we've already been here and everywhere above this"; so we just have to traverse up until we find a node with x == position. This means we hit each edge once; so it's O(N).
Oh, wait - that doesn't work. The issue is that we store things so that the desired value is the sum all the way up the tree; we don't have a notion of "stuff further up the tree doesn't contribute". This was the price we had to pay for not keeping track of siblings and children - we'd need sibs and children to push things back down the tree.
So - I'll do this in the O(N log N) way; I think to do better we need a way to traverse back down the tree.
Activity
petrelharp commentedon Sep 24, 2024
Oh, wait - that doesn't work. The issue is that we store things so that the desired value is the sum all the way up the tree; we don't have a notion of "stuff further up the tree doesn't contribute". This was the price we had to pay for not keeping track of siblings and children - we'd need sibs and children to push things back down the tree.
So - I'll do this in the O(N log N) way; I think to do better we need a way to traverse back down the tree.
jeromekelleher commentedon Sep 24, 2024
Meh, log N is small so let's not worry about it. Could easily be cancelled out by a simpler algorithm.
windows!!! closes tskit-dev#2996
relatendess matrix-vector operation (rebase)
relatendess matrix-vector operation (rebase)
relatendess matrix-vector operation (rebase) (tskit-dev#2980)