Interface Node<N extends NodeReference>

Type Parameters:
N - the type of reference used to point to other nodes, which must extend NodeReference

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 Details

    • getPrimaryKey

      @Nonnull Tuple getPrimaryKey()
      Gets the primary key for this object.

      The primary key is represented as a Tuple and 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 never null
    • getSelfReference

      @Nonnull N getSelfReference(@Nullable Transformed<RealVector> vector)
      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 of Half objects to process. This parameter is optional and can be null.
      Returns:
      a non-null reference to this object (this) for further method calls.
    • getNeighbors

      @Nonnull List<N> 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

      @Nonnull NodeKind getKind()
      Return the kind of the node, i.e. NodeKind.COMPACT or NodeKind.INLINING.
      Returns:
      the kind of this node as a NodeKind