Пример #1
0
def spanning_tree_total(Graph, tree=None, leave=None):
    if tree == None:
        tree = nd.Node()
        tree.objects.append(Graph)
        if Graph.kids == []:
            pass
        else:
            for kid in Graph.kids:
                if tr.In_tree(kid, tree, it_points):
                    pass
                else:
                    a = nd.Node()
                    tree.kids.append(a)
                    a.objects.append(kid)
                    b = a
                    spanning_tree_total(kid, tree, b)
    else:
        if Graph.kids == []:
            pass
        else:
            for kid in Graph.kids:
                if tr.In_tree(kid, tree, it_points):
                    pass
                else:
                    a = nd.Node()
                    leave.kids.append(a)
                    a.objects.append(kid)
                    if not (kid.kids == []):
                        spanning_tree_total(kid, tree, a)
    return tree
Пример #2
0
def Indexes(n):
    a = nd.Node()
    tr.P_tree(a, 2, n)
    tr.Op(Index_node, a)
    c = tr.Leaves(a)
    d = []
    for Node in c:
        d.append(Node.objects)
    return d
 def attach_balls(self):
     for node in self.objects:
         p = self.node2plane(node)
         p.ball = gr.spanning_tree(node, n=self.radius)
         p.distance = tr.tree_distances(p.ball)
Пример #4
0
def attach_balls(status, n_r):
    for node in status.objects:
        q = node.objects[0]
        p = q.objects[0]
        p.ball = gr.spanning_tree(node, n=n_r)
        p.distance = tr.tree_distances(p.ball)
Пример #5
0
def Find(p, tree):
    y = tr.Find_node(p, tree, In)
    return y
Пример #6
0
def Pnt(tree):
    tr.Op(Print, tree)
Пример #7
0
def Divide(Node, layers):
    n = 2**len(Node.objects[0].shape)
    tr.P_tree(Node, n, layers)
    tr.Op(Divide_node, Node)