From 07fbf605b2109ab476b1f4d59625dad4aa0d6843 Mon Sep 17 00:00:00 2001 From: Zachary Pincus Date: Wed, 30 Dec 2009 14:31:08 -0500 Subject: [PATCH] Fix heap.pyx to work when infinite values are pushed. --- scikits/image/graph/heap.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scikits/image/graph/heap.pyx b/scikits/image/graph/heap.pyx index 0df22d7f..1e3b8e5b 100644 --- a/scikits/image/graph/heap.pyx +++ b/scikits/image/graph/heap.pyx @@ -350,13 +350,13 @@ cdef class BinaryHeap: cdef int levels = self.levels # search tree (using absolute indices) for level in range(1, levels): - if values[i] < values[i+1]: + if values[i] <= values[i+1]: i = i*2+1 # CalcNextAbs else: i = (i+1)*2+1 # CalcNextAbs # select best one in last level - if values[i] < values[i+1]: + if values[i] <= values[i+1]: i = i else: i = i+1 @@ -367,7 +367,7 @@ cdef class BinaryHeap: self._popped_ref = self._references[ir] # remove it - if value != inf: + if self.count: self._remove(i) # return