<div dir="ltr">Hello folks , i am using the newick module <a href="http://www.daimi.au.dk/~mailund/newick.html.I">http://www.daimi.au.dk/~mailund/newick.html.I</a> am just learning to use it and i have a question about it.<br>
<br>from  newick.tree import parse_tree<br>from  newick.tree import add_parent_links<br>from  newick.tree import add_distance_from_root <br><br>import sys<br><br>t = parse_tree('((A:2,B:3):1,C:6);')<br><br>print t<br>
<br>deltas = add_distance_from_root(t)<br><br>now when i do this i can get the output like this<br><br><br>(('A' : 2.0, 'B' : 3.0) : 1.0, 'C' : 6.0)<br>None<br><br>This is the code of the add_distance_from_root(0<br>
<br>def add_distance_from_root(tree):<br>    '''Extend all nodes with the distance (branch length) from the root'''<br>    tree.distance_from_root = 0.0       # 'tree' is the root...<br>    <br>
    class V(TreeVisitor):<br>        def pre_visit_edge(self,src,b,l,dst):<br>            if l is None: l = 0<br>            dst.distance_from_root = src.distance_from_root - l<br>             <br>    tree.dfs_traverse(V())<br>
     <br>From here it is clear that the function does not return anything but i wanna get the value of the distance from root.How can i get this?<br><br>Thanks<br><br>Aditya<br></div>