Interface Node<N extends NodeReference>
- Type Parameters:
N- the type of reference used to point to other nodes, which must extendNodeReference
public interface Node<N extends NodeReference>
Represents a node within an HNSW (Hierarchical Navigable Small World) structure.
A node corresponds to a data point (vector) in the structure and maintains a list of its neighbors.
This interface defines the common contract for different node representations, such as CompactNode
and InliningNode.
-
Method Summary
Modifier and TypeMethodDescriptiongetKind()Return the kind of the node, i.e.Gets the list of neighboring nodes.Gets the primary key for this object.getSelfReference(Transformed<RealVector> vector) Returns a self-reference to this object, enabling fluent method chaining.
-
Method Details
-
getPrimaryKey
Gets the primary key for this object.The primary key is represented as a
Tupleand uniquely identifies the object within its storage context. This method is guaranteed to not return a null value.- Returns:
- the primary key as a
Tuple, which is nevernull
-
getSelfReference
Returns a self-reference to this object, enabling fluent method chaining. This allows to create node references that contain a vector and are independent of the storage implementation.- Parameters:
vector- the vector ofHalfobjects to process. This parameter is optional and can benull.- Returns:
- a non-null reference to this object (
this) for further method calls.
-
getNeighbors
Gets the list of neighboring nodes.This method is guaranteed to not return
null. If there are no neighbors, an empty list is returned.- Returns:
- a non-null list of neighboring nodes.
-
getKind
Return the kind of the node, i.e.NodeKind.COMPACTorNodeKind.INLINING.- Returns:
- the kind of this node as a
NodeKind
-