def _assign_traversal_positions(self):
    y = 0
    for root in self.tree.roots:
        for u in self.tree.nodes(root, order='postorder'):
            if self.tree.is_leaf(u):
                self.traversal_position[u] = y
                y += 2
            else:
                coords = [self.traversal_position[c] for c in self.tree.children(u)]
                if (len(coords) == 1):
                    self.traversal_position[u] = coords[0]
                else:
                    a = min(coords)
                    b = max(coords)
                    child_mid = int(round((a + ((b - a) / 2))))
                    self.traversal_position[u] = child_mid
        y += 1
    self.height = (y - 2)
def _assign_traversal_positions(self):
    y = 0
    for root in self.tree.roots:
        for u in self.tree.nodes(root, order='postorder'):
            if self.tree.is_leaf(u):
                self.traversal_position[u] = y
                y += 2
            else:
                coords = [self.traversal_position[c] for c in self.tree.children(u)]
                if (len(coords) == 1):
                    self.traversal_position[u] = coords[0]
                else:
                    a = min(coords)
                    b = max(coords)
                    child_mid = int(round((a + ((b - a) / 2))))
                    self.traversal_position[u] = child_mid
        y += 1
    self.height = (y - 2)