buildVptree: Build a VP tree

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

View source: R/buildVptree.R

Description

Build a vantage point tree in preparation for a nearest-neighbors search.

Usage

1
2
3
4
5
buildVptree(
  X,
  transposed = FALSE,
  distance = c("Euclidean", "Manhattan", "Cosine")
)

Arguments

X

A numeric matrix where rows correspond to data points and columns correspond to variables (i.e., dimensions).

transposed

Logical scalar indicating whether X is transposed, i.e., rows are variables and columns are data points.

distance

String specifying the type of distance to use.

Details

This function is automatically called by findVptree and related functions. However, it can be called directly by the user to save time if multiple queries are to be performed to the same X.

Points in X are reordered to improve data locality during the nearest-neighbor search. Specifically, points in the same cluster are contiguous and ordered by increasing distance from the cluster center.

The function also reports a list containing four vectors of equal length describing the structure of the VP tree. Each parallel element specifies a node:

All indices here are zero-based, with child values set to -1 for leaf nodes.

Value

A VptreeIndex object containing indexing structures for the VP-tree search.

Author(s)

Aaron Lun

See Also

VptreeIndex, for details on the output class.

findVptree and queryVptree, for dependent functions.

Examples

1
2
3
Y <- matrix(rnorm(100000), ncol=20)
out <- buildVptree(Y)
out

LTLA/BiocNeighbors documentation built on Sept. 18, 2021, 8:19 p.m.