Skip to content

Commit

Permalink
removed visited uids
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil-goel committed Nov 16, 2024
1 parent bacda28 commit 5ed6d10
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions tok/hnsw/persistent_hnsw.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"strings"
"time"

"github.com/bits-and-blooms/bitset"
c "github.com/dgraph-io/dgraph/v24/tok/constraints"
"github.com/dgraph-io/dgraph/v24/tok/index"
opt "github.com/dgraph-io/dgraph/v24/tok/options"
Expand All @@ -45,7 +44,6 @@ type persistentHNSW[T c.Float] struct {
// nodeAllEdges[65443][1][3] indicates the 3rd neighbor in the first
// layer for uuid 65443. The result will be a neighboring uuid.
nodeAllEdges map[uint64][][]uint64
visitedUids *bitset.BitSet
deadNodes map[uint64]struct{}
}

Expand Down Expand Up @@ -215,9 +213,6 @@ func (ph *persistentHNSW[T]) searchPersistentLayer(
var eVec []T
improved := false
for _, currUid := range allLayerEdges[level] {
if ph.visitedUids.Test(uint(currUid)) {
continue
}
if r.indexVisited(currUid) {
continue
}
Expand All @@ -238,7 +233,6 @@ func (ph *persistentHNSW[T]) searchPersistentLayer(
currDist, currUid, filteredOut)
r.addToVisited(*currElement)
r.incrementDistanceComputations()
ph.visitedUids.Set(uint(currUid))

// If we have not yet found k candidates, we can consider
// any candidate. Otherwise, only consider those that
Expand Down Expand Up @@ -366,8 +360,6 @@ func (ph *persistentHNSW[T]) SearchWithPath(
start := time.Now().UnixMilli()
r = index.NewSearchPathResult()

ph.visitedUids = bitset.New(10)

// 0-profile_vector_entry
var startVec []T
entry, err := ph.PickStartNode(ctx, c, &startVec)
Expand Down Expand Up @@ -451,8 +443,6 @@ func (ph *persistentHNSW[T]) insertHelper(ctx context.Context, tc *TxnCache,
inLevel := getInsertLayer(ph.maxLevels) // calculate layer to insert node at (randomized every time)
var layerErr error

ph.visitedUids = bitset.New(10)

for level := 0; level < inLevel; level++ {
// perform insertion for layers [level, max_level) only, when level < inLevel just find better start
err := ph.getVecFromUid(entry, tc, &startVec)
Expand Down

0 comments on commit 5ed6d10

Please sign in to comment.