cross_adjacency: Cross Adjacency

View source: R/knn_weights.R

cross_adjacencyR Documentation

Cross Adjacency

Description

This function computes the cross adjacency matrix or graph between two sets of points based on their k-nearest neighbors and a kernel function applied to their distances.

Usage

cross_adjacency(
  X,
  Y,
  k = 5,
  FUN = heat_kernel,
  type = c("normal", "mutual", "asym"),
  as = c("igraph", "sparse", "index_sim")
)

Arguments

X

A matrix of size nXk, where n is the number of data points and k is the dimensionality of the feature space.

Y

A matrix of size pXk, where p is the number of query points and k is the dimensionality of the feature space.

k

An integer indicating the number of nearest neighbors to consider (default: 5).

FUN

A kernel function to apply to the Euclidean distances between data points (default: heat_kernel).

type

A character string indicating the type of adjacency to compute. One of "normal", "mutual", or "asym" (default: "normal").

as

A character string indicating the format of the output. One of "igraph", "sparse", or "index_sim" (default: "igraph").

Value

If 'as' is "index_sim", a two-column matrix where the first column contains the indices of nearest neighbors and the second column contains the corresponding kernel values. If 'as' is "igraph", an igraph object representing the cross adjacency graph. If 'as' is "sparse", a sparse adjacency matrix.


bbuchsbaum/neighborweights documentation built on April 1, 2024, 8:41 p.m.