Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlymatthew committed Jun 14, 2024
1 parent 9e5b2df commit 46280ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/hnsw/heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ func (d *DistHeap) PopMinItem() (*Item, error) {
return nil, EmptyHeapError
}

return Pop(d).(*Item), nil
return Pop(d), nil
}
func (d *DistHeap) PopMaxItem() (*Item, error) {
if d.IsEmpty() {
return nil, EmptyHeapError
}

return PopMax(d).(*Item), nil
return PopMax(d), nil
}
func (d *DistHeap) Insert(id Id, dist float32) {
if d.visited[id] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/hnsw/minmax.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func Push(h Interface, x *Item) {

// Pop removes and returns the minimum element (according to Less) from the heap.
// The complexity is O(log n) where n = h.Len().
func Pop(h Interface) interface{} {
func Pop(h Interface) *Item {
n := h.Len() - 1
h.Swap(0, n)
down(h, 0, n)
Expand All @@ -145,7 +145,7 @@ func Pop(h Interface) interface{} {

// PopMax removes and returns the maximum element (according to Less) from the heap.
// The complexity is O(log n) where n = h.Len().
func PopMax(h Interface) interface{} {
func PopMax(h Interface) *Item {
n := h.Len()

i := 0
Expand Down

0 comments on commit 46280ad

Please sign in to comment.