Tutorial: tree algorithms with numba
Once we have direct numpy access to the tree arrays in Python (tskit-dev/tskit#1299) I think we should be able to do quite performant traversal algorithms in python using numba. We can illustrate this with a couple of examples:
- Implement the get_mrca function, using the algorithm given here: more efficient TMRCA computation? tskit#1306 (although we might get hit by the creation of the
node_timearray if we create it for each function call - we could work around this for the moment by using a copy of the node time array that we keep lying around). This is easy because we only go up the tree. - Implement one of the phylogenetics parsimony algorithms in a simple way. This would illustrate how to do traversals down from the root efficiently. Probably the Sankoff score would be a good one.