Constructs a Shared Nearest Neighbor (SNN) graph from a given feature space using k-nearest neighbors (KNN) and Seurat's SNN computation.

ConstructSNNGraph(
  knn = 5,
  feature_space,
  self_loop = 1,
  adjust_disconnection = TRUE
)

Arguments

knn

integer; the number of nearest neighbors to consider for each node. Default is 5.

feature_space

matrix; a cell-by-coordinate matrix (e.g., 20 principal components)

self_loop

numeric; value for the diagonal elements of the affinity matrix to add self-loops. Default is 1.

Value

A list containing the following elements:

graph

A symmetric matrix representing the graph affinity matrix.

adj_matrix

A binary adjacency matrix indicating the presence of edges between nodes.