NeighborArray
NeighborArray encodes the neighbors of a node and their mutual scores in the HNSW graph as a pair of growable arrays. Nodes are arranged in the sorted order of their scores in descending order (if scoresDescOrder is true), or in the ascending order of their scores (if scoresDescOrder is false)
Functions
Link copied to clipboard
fun addAndEnsureDiversity(newNode: Int, newScore: Float, nodeId: Int, scorer: UpdateableRandomVectorScorer)
In addition to .addOutOfOrder, this function will also remove the least-diverse node if the node array is full after insertion
Link copied to clipboard
Add a new node to the NeighborArray. The new node must be worse than all previously stored nodes. This cannot be called after .addOutOfOrder
Link copied to clipboard
Add node and newScore but do not insert as sorted
Link copied to clipboard
This method is for test only.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Sort the array according to scores, and return the sorted indexes of previous unsorted nodes (unchecked nodes)