Class KnnGraphValues

  • Direct Known Subclasses:
    HnswGraph

    public abstract class KnnGraphValues
    extends Object
    Access to per-document neighbor lists in a (hierarchical) knn search graph.
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Constructor Detail

      • KnnGraphValues

        protected KnnGraphValues()
        Sole constructor
    • Method Detail

      • seek

        public abstract void seek​(int target)
                           throws IOException
        Move the pointer to exactly target, the id of a node in the graph. After this method returns, call nextNeighbor() to return successive (ordered) connected node ordinals.
        Parameters:
        target - must be a valid node in the graph, ie. ≥ 0 and < VectorValues.size().
        Throws:
        IOException
      • size

        public abstract int size()
        Returns the number of nodes in the graph
      • nextNeighbor

        public abstract int nextNeighbor()
                                  throws IOException
        Iterates over the neighbor list. It is illegal to call this method after it returns NO_MORE_DOCS without calling seek(int), which resets the iterator.
        Returns:
        a node ordinal in the graph, or NO_MORE_DOCS if the iteration is complete.
        Throws:
        IOException