buildIndex {BiocNeighbors} | R Documentation

## Build a nearest-neighbor index

### Description

Build indices for nearest-neighbor searching with different algorithms.

### Usage

    buildIndex(X, ..., BNPARAM)

### Arguments

`X` | A numeric matrix where rows correspond to data points and columns correspond to variables (i.e., dimensions).
`...` | Further arguments to be passed to individual methods. This is guaranteed to include `transposed`.
`BNPARAM` | A BiocNeighborParam object specifying the type of index to be constructed. This defaults to a KmknnParam object if no argument is supplied.

### Details

Supplying a KmknnParam object as `BNPARAM` will dispatch to `buildKmknn`.

Supplying a VptreeParam object as `BNPARAM` will dispatch to `buildVptree`.

Supplying an AnnoyParam object as `BNPARAM` will dispatch to `buildAnnoy`.

Supplying an HnswParam object as `BNPARAM` will dispatch to `buildHnsw`.

### Value

A BiocNeighborIndex object containing indexing structures for the specified algorithm.

### Author(s)

Aaron Lun

### See Also

`buildKmknn`, `buildVptree`, `buildAnnoy` and `buildHnsw` for specific methods.

### Examples

    Y <- matrix(rnorm(100000), ncol=20)
    (k.out <- buildIndex(Y))
    (a.out <- buildIndex(Y, BNPARAM=AnnoyParam()))

[Package BiocNeighbors version 1.8.2 Index]