Package io.github.jbellis.jvector.graph
Interface GraphIndex<T>
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
CachingGraphIndex,OnDiskGraphIndex,OnHeapGraphIndex
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getNodes()Get all nodes on a given level as node 0th ordinals.getView()Return a View with which to navigate the graph.intstatic <T> StringprettyPrint(GraphIndex<T> graph) intsize()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
nextIntreturns 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
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
prettyPrint
-