src/newick.py
def resolve_polytomies(self):
        """
        Insert additional nodes with length=0 into the subtree in such a way
        that all non-leaf nodes have only 2 descendants, i.e. the tree becomes
        a fully resolved binary tree.
        """
        def _resolve_polytomies(n):
            new = Node(length=self._length_formatter(self._length_parser('0')))
            while len(n.descendants) > 1:
                new.add_descendant(n.descendants.pop())
            n.descendants.append(new)

        self.visit(_resolve_polytomies, lambda n: len(n.descendants) > 2)
def resolve_polytomies(self):
        def _resolve_polytomies(n):
            new = Node(length=self._length_formatter(self._length_parser('0')))
            while len(n.descendants) > 1:
                new.add_descendant(n.descendants.pop())
            n.descendants.append(new)

        self.visit(_resolve_polytomies, lambda n: len(n.descendants) > 2)
def resolve_polytomies ( self ) : def _resolve_polytomies ( n ) : new = Node ( length = self . _length_formatter ( self . _length_parser ( '0' ) ) ) while len ( n . descendants ) > 1 : new . add_descendant ( n . descendants . pop ( ) ) n . descendants . append ( new ) self . visit ( _resolve_polytomies , lambda n : len ( n . descendants ) > 2 )
Insert additional nodes with length=0 into the subtree in such a way
        that all non-leaf nodes have only 2 descendants, i.e. the tree becomes
        a fully resolved binary tree.
Insert additional nodes with length = 0 into the subtree in such a way that all non - leaf nodes have only 2 descendants i . e . the tree becomes a fully resolved binary tree .