Skip to contents

This function generates a similarity network (SN) for a given embeddings. Specifically, the function computes K-nearest neighbor (KNN) graphs based on the provided embedding.

Usage

getSN(emb, k = 50)

Arguments

emb

A matrix contains the embedding, with rows correspond to principal components (PCs) or features, and columns correspond to spatial neighborhoods.

k

An integer specifying the number of nearest neighbors to consider when constructing the KNN graph. Default is 50.

Value

A matrix for the similarity network (SN). The rows and columns represent spatial neighborhood, and the values represent inverted distance.

Details

The function computes a KNN graph using the input embedding and inverts the resulting distances to similarity scores.