in heap.py [0:0]
def check_heap_property(self, root):
if root in self.invalid_pos:
return True # Actually we should check the children, but we will call it in the whole heap
holds = True
for node in self.dfs(root):
if node == root:
continue
holds = node in self.invalid_pos or self.cmp(self.data[root], self.data[node])
if not holds:
print("Does not hold root(%d) = %d node(%d) = %d" % (root, self.data[root], node, self.data[node]))
break
return holds