I am having different outputs on running same program again and again, in different environments(anaconda, python, 2.7, 3.5)
Can someone explain the behaviour of the traversal in quadtree.
I have used this library.
Take a look at code, and outputs.
from pyqtree import Index
class Dataset:
def __init__(self,id,x,y):
self.id = id
self.bbox = (x,y,x,y)
spidex = Index(bbox=(0,0,80,80))
p = [[0]*4]*4
k = 0
i1 = i2 = 0
for i in range(10,81,20):
for j in range(10,81,20):
p[i1][i2] = Dataset(k,i,j)
k += 1
spidex.insert(p[i1][i2],(p[i1][i2]).bbox)
i2 +=1
i1+=1
i2 = 0
o9 = (0,0,80,80)
matches = spidex.intersect(o9)
for i in matches:
# print(str(i.id))
print('p'+str(i.id)+' --> ('+str(i.bbox[0])+','+str(i.bbox[1])+')')
Outputs are different where I use first comment statement and second comment statement also.
Different outputs:
/usr/bin/python qt3.py
p6--> (30,50)
p10--> (50,50)
p3--> (10,70)
p11--> (50,70)
p14--> (70,50)
p7--> (30,70)
p0--> (10,10)
p13--> (70,30)
p4--> (30,10)
p8--> (50,10)
p1--> (10,30)
p5--> (30,30)
p12--> (70,10)
p15--> (70,70)
p9--> (50,30)
p2--> (10,50)
python2 qt3.py
p14 --> (70,50)
p6 --> (30,50)
p10 --> (50,50)
p3 --> (10,70)
p11 --> (50,70)
p7 --> (30,70)
p0 --> (10,10)
p13 --> (70,30)
p4 --> (30,10)
p15 --> (70,70)
p8 --> (50,10)
p1 --> (10,30)
p5 --> (30,30)
p12 --> (70,10)
p9 --> (50,30)
p2 --> (10,50)
There are more than two different outputs. Let me know if you are having deterministic behaviour. Kindly explain the behaviour otherwise.