diff options
Diffstat (limited to 'examples/general/get_distances_between_nodes.py')
-rw-r--r-- | examples/general/get_distances_between_nodes.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/general/get_distances_between_nodes.py b/examples/general/get_distances_between_nodes.py index 4401603..1606981 100644 --- a/examples/general/get_distances_between_nodes.py +++ b/examples/general/get_distances_between_nodes.py @@ -7,7 +7,7 @@ nw = """(((A:0.1, B:0.01):0.001, C:0.0001):1.0, (((((D:0.00001,I:0):0,F:0):0,G:0):0,H:0):0, E:0.000001):0.0000001):2.0;""" t = Tree(nw) -print t +print(t) # /-A # /--------| # /--------| \-B @@ -30,24 +30,24 @@ print t A = t&"A" C = t&"C" # Calculate distance from current node -print "The distance between A and C is", A.get_distance("C") +print("The distance between A and C is", A.get_distance("C")) # Calculate distance between two descendants of current node -print "The distance between A and C is", t.get_distance("A","C") +print("The distance between A and C is", t.get_distance("A","C")) # Calculate the toplogical distance (number of nodes in between) -print "The number of nodes between A and D is ", \ - t.get_distance("A","D", topology_only=True) +print("The number of nodes between A and D is ", \ + t.get_distance("A","D", topology_only=True)) # Calculate the farthest node from E within the whole structure farthest, dist = (t&"E").get_farthest_node() -print "The farthest node from E is", farthest.name, "with dist=", dist +print("The farthest node from E is", farthest.name, "with dist=", dist) # Calculate the farthest node from E within the whole structure, # regarding the number of nodes in between as distance value # Note that the result is differnt. farthest, dist = (t&"E").get_farthest_node(topology_only=True) -print "The farthest (topologically) node from E is", \ - farthest.name, "with", dist, "nodes in between" +print("The farthest (topologically) node from E is", \ + farthest.name, "with", dist, "nodes in between") # Calculate farthest node from an internal node farthest, dist = t.get_farthest_node() -print "The farthest node from root is", farthest.name, "with dist=", dist +print("The farthest node from root is", farthest.name, "with dist=", dist) # # The program results in the following information: # |