HnswParam {BiocNeighbors} | R Documentation

## The HnswParam class

### Description

A class to hold parameters for the Hnsw algorithm for approximate nearest neighbor identification.

### Usage

    HnswParam(
      nlinks = 16,
      ef.construction = 200,
      directory = tempdir(),
      ef.search = 10,
      distance = "Euclidean"
    )

### Arguments

`nlinks` | Integer scalar, number of bi-directional links per element for index generation.
`ef.construction` | Integer scalar, size of the dynamic list for index generation.
`directory` | String specifying the directory in which to save the index.
`ef.search` | Integer scalar, size of the dynamic list for neighbor searching.
`distance` | A string specifying the distance metric to use.

### Details

The HnswParam class holds any parameters associated with running the HNSW algorithm. This generally relates to building of the index - see `buildHnsw` for details.

Users can get or set values with the usual `[[` syntax. All parameters listed in the constructor can be manipulated in this manner.

### Value

An instance of the HnswParam class.

### Author(s)

Aaron Lun

### See Also

`buildHnsw`, for the index construction.

`findHnsw` and related functions, for the actual search.

BiocNeighborParam, for the parent class and its available methods.

### Examples

    (out <- HnswParam())
    out[['nlinks']]

    out[['nlinks']] <- 20L
    out

[Package BiocNeighbors version 1.10.0 Index]