Skip to navigation

GPUBuiltHnswGraph

View as Markdown

Java package: com.nvidia.cuvs.lucene

public class GPUBuiltHnswGraph extends HnswGraph

This class holds the in-memory representation of the HNSW graph

Public Members

GPUBuiltHnswGraph

public GPUBuiltHnswGraph( int size, int dimensions, List<int[]> layerNodes, List<CuVSMatrix> layerAdjacencies)

Multi-layer constructor that supports arbitrary number of layers.

Parameters

NameDescription
sizethe size of the dataset
dimensionsthe vector dimension
layerNodesthe nodes on the layer
layerAdjacenciesadjacency list

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:41

getNodesOnLevel

public NodesIterator getNodesOnLevel(int level)

Get all nodes on a given level as node 0th ordinals.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:92

getNeighbors

public NeighborArray getNeighbors(int level, int node)

Get the neighbors for the node and the level it resides.

Parameters

NameDescription
levelthe level
nodethe node

Returns

an instance of NeighborArray

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:110

seek

@Override public void seek(int level, int target)

Move the pointer to exactly the given level’s target.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:135

nextNeighbor

@Override public int nextNeighbor()

Iterates over the neighbor list.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:145

entryNode

@Override public int entryNode()

Returns graph’s entry point on the top level.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:176

maxConn

@Override public int maxConn()

returns M, the maximum number of connections for a node.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:195

neighborCount

@Override public int neighborCount()

Returns the neighbor count.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:210

size

public int size()

Returns the number of nodes in the graph.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:285

numLevels

public int numLevels()

Returns the number of levels in the HNSW graph.

Returns

the number of levels

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:294

dimensions

public int dimensions()

Gets the vector dimension.

Returns

the vector dimension

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:303

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/GPUBuiltHnswGraph.java:21