def prepare_tree(self):
self.tree.root.branch_length = <NUM_LIT><EOL>self.tree.root.mutation_length = self.tree.root.branch_length<EOL>self.tree.root.mutations = []<EOL>self.tree.ladderize()<EOL>self._prepare_nodes()<EOL>self._leaves_lookup = {node.name:node for node in self.tree.get_terminals()}<EOL>
Set link to parent and calculate distance to root for all tree nodes.
Should be run once the tree is read and after every rerooting,
topology change or branch length optimizations.