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
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)
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)
def Find(p, tree): y = tr.Find_node(p, tree, In) return y
def Pnt(tree): tr.Op(Print, tree)
def Divide(Node, layers): n = 2**len(Node.objects[0].shape) tr.P_tree(Node, n, layers) tr.Op(Divide_node, Node)