Skip to contents

Build an exact kNN graph from a bigmemory::big.matrix

Usage

knn_graph_bigmatrix(
  x,
  k = 10L,
  metric = "euclidean",
  block_size = knn_default_block_size(),
  plan = NULL,
  include_distance = TRUE,
  format = c("edge_list", "triplet", "dgCMatrix"),
  symmetrize = c("none", "union", "mutual"),
  exclude_self = TRUE
)

Arguments

x

A bigmemory::big.matrix, an external pointer referencing a big.matrix, or a prepared reference returned by knn_prepare_bigmatrix().

k

Number of neighbours per row.

metric

Distance metric. Supported values are "euclidean", "sqeuclidean", and "cosine".

block_size

Number of rows to process per query and reference block.

plan

Optional execution plan returned by knn_plan_bigmatrix().

include_distance

Logical flag controlling whether kNN graph edges store distances or unit weights.

format

Output format. One of "edge_list", "triplet", or "dgCMatrix".

symmetrize

How directed kNN edges should be combined. One of "none", "union", or "mutual".

exclude_self

Logical flag controlling whether self loops are suppressed in the directed kNN graph.

Value

An edge list, a triplet list, or a Matrix::dgCMatrix, depending on the requested format.