HnswIndex: The HnswIndex class

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/Hnsw-class.R

Description

A class to hold indexing structures for the HNSW algorithm for approximate nearest neighbor identification.

Usage

1
2
3
4
5
6
7
8
HnswIndex(data, path, ef.search=10, NAMES=NULL, distance="Euclidean")

HnswIndex_path(x)

HnswIndex_ef_search(x)

## S4 method for signature 'HnswIndex'
show(object)

Arguments

data

A numeric matrix with data points in columns and dimensions in rows.

path

A string specifying the path to the index file.

ef.search

Integer scalar specifying the size of the dynamic list at run time.

NAMES

A character vector of sample names or NULL.

distance

A string specifying the distance metric to use.

x, object

A HnswIndex object.

Details

The HnswIndex class holds the indexing structure required to run the HNSW algorithm. Users should never need to call the constructor explicitly, but should generate instances of HnswIndex classes with buildHnsw.

Value

The HnswIndex constructor will return an instance of the HnswIndex class.

HnswIndex_path will return the path to the index file.

HnswIndex_ef_search will return the size of the dynamic list.

Author(s)

Aaron Lun

See Also

buildHnsw

Examples

1
2

Example output

bldHns> Y <- matrix(rnorm(100000), ncol=20)

bldHns> out <- buildHnsw(Y)

bldHns> out
class: HnswIndex
dim: 5000 20
distance: Euclidean
path: /work/tmp/tmp/Rtmpzi4vma/file16fd01a70323.idx
EF search: 10
 chr "/work/tmp/tmp/Rtmpzi4vma/file16fd01a70323.idx"

BiocNeighbors documentation built on Dec. 9, 2020, 2:01 a.m.