Interface GraphIndex<T>

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
CachingGraphIndex, OnDiskGraphIndex, OnHeapGraphIndex

public interface GraphIndex<T> extends AutoCloseable
Represents a graph-based vector index. Nodes are represented as ints, and edges are represented as adjacency lists.

Mostly this applies to any graph index, but a few methods (e.g. getVector()) are specifically included to support the DiskANN-based design of OnDiskGraphIndex.

All methods are threadsafe. Operations that require persistent state are wrapped in a View that should be created per accessing thread.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    Get all nodes on a given level as node 0th ordinals.
    Return a View with which to navigate the graph.
    int
     
    static <T> String
     
    int
    Returns the number of nodes in the graph
  • Method Details

    • size

      int size()
      Returns the number of nodes in the graph
    • getNodes

      NodesIterator getNodes()
      Get all nodes on a given level as node 0th ordinals. The nodes are NOT guaranteed to be presented in any particular order.
      Returns:
      an iterator over nodes where nextInt returns a next node on the level
    • getView

      GraphIndex.View<T> getView()
      Return a View with which to navigate the graph. Views are not threadsafe.
    • maxDegree

      int maxDegree()
      Returns:
      the maximum number of edges per node
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • prettyPrint

      static <T> String prettyPrint(GraphIndex<T> graph)