(self, tree, node, square)
return obj
Get the Pythagoras tree representation in a graph like view.

        Constructs a graph using TreeNode into a tree structure. Each node in
        graph contains the information required to plot the the tree.

        Parameters
        ----------
        tree : TreeAdapter
            A tree adapter instance where the original tree is stored.
        node : int
            The node label, the root node is denoted with 0.
        square : Square
            The initial square which will represent the root of the tree.

        Returns
        -------
        TreeNode
            The root node which contains the rest of the tree.
Get the Pythagoras tree representation in a graph like view.
Get the Pythagoras tree representation in a graph like view .
def pythagoras_tree(self, tree, node, square):
        """Get the Pythagoras tree representation in a graph like view.

        Constructs a graph using TreeNode into a tree structure. Each node in
        graph contains the information required to plot the the tree.

        Parameters
        ----------
        tree : TreeAdapter
            A tree adapter instance where the original tree is stored.
        node : int
            The node label, the root node is denoted with 0.
        square : Square
            The initial square which will represent the root of the tree.

        Returns
        -------
        TreeNode
            The root node which contains the rest of the tree.

        """
        # make sure to clear out any old slopes if we are drawing a new tree
        if node == tree.root:
            self._slopes.clear()

        # Calculate the adjusted child weights for the node children
        child_weights = [self.adjust_weight(tree.weight(c))
                         for c in tree.children(node)]
        total_weight = sum(child_weights)
        normalized_child_weights = [cw / total_weight for cw in child_weights]

        children = tuple(
            self._compute_child(tree, square, child, cw)
            for child, cw in zip(tree.children(node), normalized_child_weights)
        )
        # make sure to pass a reference to parent to each child
        obj = TreeNode.from_tree(node, square, tree, children)
        # mutate the existing data stored in the created tree node
        for c in children:
            c.parent = obj
        return obj
def pythagoras_tree ( self , tree , node , square ) : # make sure to clear out any old slopes if we are drawing a new tree if node == tree . root : self . _slopes . clear ( ) # Calculate the adjusted child weights for the node children child_weights = [ self . adjust_weight ( tree . weight ( c ) ) for c in tree . children ( node ) ] total_weight = sum ( child_weights ) normalized_child_weights = [ cw / total_weight for cw in child_weights ] children = tuple ( self . _compute_child ( tree , square , child , cw ) for child , cw in zip ( tree . children ( node ) , normalized_child_weights ) ) # make sure to pass a reference to parent to each child obj = TreeNode . from_tree ( node , square , tree , children ) # mutate the existing data stored in the created tree node for c in children : c . parent = obj return obj