Class Lucene91OnHeapHnswGraph
java.lang.Object
org.apache.lucene.util.hnsw.HnswGraph
org.apache.lucene.backward_codecs.lucene91.Lucene91OnHeapHnswGraph
An
HnswGraph where all nodes and connections are held in memory. This class is used to
construct the HNSW graph before it's written to the index.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.util.hnsw.HnswGraph
HnswGraph.ArrayNodesIterator, HnswGraph.CollectionNodesIterator, HnswGraph.NodesIterator -
Field Summary
Fields inherited from class org.apache.lucene.util.hnsw.HnswGraph
EMPTY, UNKNOWN_MAX_CONN -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNode(int level, int node) Add node on the given levelintReturns the graph's current entry node on the top level shown as ordinals of the nodes on 0th levelgetNeighbors(int level, int node) Returns theNeighborQueueconnected to the given node.getNodesOnLevel(int level) intmaxConn()intintintReturns the current number of levels in the graphvoidseek(int level, int targetNode) intsize()
-
Method Details
-
getNeighbors
Returns theNeighborQueueconnected to the given node.- Parameters:
level- level of the graphnode- the node whose neighbors are returned, represented as an ordinal on the level 0.
-
size
public int size() -
addNode
public void addNode(int level, int node) Add node on the given level- Parameters:
level- level to add a node onnode- the node to add, represented as an ordinal on the level 0.
-
seek
public void seek(int level, int targetNode) -
maxConn
public int maxConn() -
neighborCount
public int neighborCount()- Specified by:
neighborCountin classHnswGraph
-
nextNeighbor
public int nextNeighbor()- Specified by:
nextNeighborin classHnswGraph
-
numLevels
public int numLevels()Returns the current number of levels in the graph -
entryNode
public int entryNode()Returns the graph's current entry node on the top level shown as ordinals of the nodes on 0th level -
getNodesOnLevel
- Specified by:
getNodesOnLevelin classHnswGraph
-