-
Notifications
You must be signed in to change notification settings - Fork 1
/
tree.py
57 lines (52 loc) · 1.23 KB
/
tree.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 2015, Jean-Baptiste Assouad et Artemis Mucaj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Tree structure for IAC algorithm
class node(object):
"""node for tree stucture"""
def __init__(self, cutval,dimCutVal,data,n1,n2,LE,LEM):
super(node, self).__init__()
self.cutval = cutval
self.dimCutVal = dimCutVal
self.n1 = n1
self.n2 = n2
self.data = data
self.LE = LE
self.LEM = LEM
def display(self):
print "cutval =",self.cutval
print "n1 =",self.n1
print "n2 =",self.n2
print "data =",self.data
pass
# Prints tree structure
def status(tree,nbTab=0):
for x in range(0,nbTab):
print ' ',
pass
print '<',nbTab,':','tree.cutval', tree.cutval,'tree.dimCutVal', tree.dimCutVal
for x in range(0,nbTab):
print ' ',
pass
print 'size data =',len(tree.data),'size LE',len(tree.LE)
if tree.cutval != -1:
for x in range(0,nbTab):
print ' ',
pass
print nbTab,'n1 :'
status(tree.n1,nbTab+1)
for x in range(0,nbTab):
print ' ',
pass
print nbTab,'n2 :'
status(tree.n2,nbTab+1)
for x in range(0,nbTab):
print ' ',
pass
print nbTab,'>'
pass
'''
test = node(10,1,1,1)
test.display()
'''