Package org.apache.lucene.backward_codecs.lucene91

## Class Lucene91OnHeapHnswGraph

- java.lang.Object
- - org.apache.lucene.util.hnsw.HnswGraph
  - - org.apache.lucene.backward_codecs.lucene91.Lucene91OnHeapHnswGraph

-     public final class Lucene91OnHeapHnswGraph
      extends HnswGraph

  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.NodesIterator`

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.util.hnsw.HnswGraph

      `EMPTY`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addNode​(int level, int node)` | Add node on the given level
    `int` | `entryNode()` | Returns the graph's current entry node on the top level shown as ordinals of the nodes on 0th level
    `Lucene91NeighborArray` | `getNeighbors​(int level, int node)` | Returns the `NeighborQueue` connected to the given node.
    `HnswGraph.NodesIterator` | `getNodesOnLevel​(int level)` |
    `int` | `nextNeighbor()` |
    `int` | `numLevels()` | Returns the current number of levels in the graph
    `void` | `seek​(int level, int targetNode)` |
    `int` | `size()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getNeighbors

          public Lucene91NeighborArray getNeighbors​(int level,
                                                    int node)

      Returns the `NeighborQueue` connected to the given node.
      Parameters:
        `level` - level of the graph
        `node` - the node whose neighbors are returned, represented as an ordinal on the level 0.

    - #### size

          public int size()

      Specified by:
        `size` in class `HnswGraph`

    - #### addNode

          public void addNode​(int level,
                              int node)

      Add node on the given level
      Parameters:
        `level` - level to add a node on
        `node` - the node to add, represented as an ordinal on the level 0.

    - #### seek

          public void seek​(int level,
                           int targetNode)

      Specified by:
        `seek` in class `HnswGraph`

    - #### nextNeighbor

          public int nextNeighbor()

      Specified by:
        `nextNeighbor` in class `HnswGraph`

    - #### numLevels

          public int numLevels()

      Returns the current number of levels in the graph
      Specified by:
        `numLevels` in class `HnswGraph`
      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
      Specified by:
        `entryNode` in class `HnswGraph`
      Returns:
        the graph's current entry node on the top level

    - #### getNodesOnLevel

          public HnswGraph.NodesIterator getNodesOnLevel​(int level)

      Specified by:
        `getNodesOnLevel` in class `HnswGraph`