Skip to content

Commit

Permalink
fix: hnsw -> init level connections under the control of maxM0 and maxM
Browse files Browse the repository at this point in the history
Applied the PR from jelmerk/hnswlib#54
  • Loading branch information
lvca committed Jun 28, 2023
1 parent 1238cd8 commit 18fcfbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.arcadedb.index.IndexInternal;
import com.arcadedb.index.TypeIndex;
import com.arcadedb.index.lsm.LSMTreeIndexAbstract;
import com.arcadedb.index.vector.distance.DistanceFunctionFactory;
import com.arcadedb.log.LogManager;
import com.arcadedb.schema.EmbeddedSchema;
import com.arcadedb.schema.IndexBuilder;
Expand Down Expand Up @@ -210,7 +211,7 @@ public boolean add(Vertex vertex) {
final ArrayList<RID>[] connections = new ArrayList[randomLevel + 1];

for (int level = 0; level <= randomLevel; level++) {
final int levelM = randomLevel == 0 ? maxM0 : maxM;
final int levelM = level == 0 ? maxM0 : maxM;
connections[level] = new ArrayList<>(levelM);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public boolean add(TItem item) {
IntArrayList[] connections = new IntArrayList[randomLevel + 1];

for (int level = 0; level <= randomLevel; level++) {
int levelM = randomLevel == 0 ? maxM0 : maxM;
int levelM = level == 0 ? maxM0 : maxM;
connections[level] = new IntArrayList(levelM);
}

Expand Down

0 comments on commit 18fcfbd

Please sign in to comment.