build_knn_graph: Make KNN network

View source: R/build_knn_graph.R

build_knn_graphR Documentation

Make KNN network

Description

Construct a binary adjacency matrix

Usage

build_knn_graph(coords, k)

Arguments

coords

An n x 2 data frame or matrix of 2d spot coordinates

k

The number of neighbors

Value

an adjacency matrix

Examples

data(coords_df_sim)
coords_df <- coords_df_sim[,1:2]
A <- build_knn_graph(coords_df,k = 4)

carter-allen/spruce documentation built on April 6, 2024, 8:34 p.m.