squidpy.gr.neighbors.KNNBuilder

class squidpy.gr.neighbors.KNNBuilder(n_neighs=6, transform=None, set_diag=False, percentile=None)[source]

Build a generic k-nearest-neighbor spatial graph.

Each observation is connected to its k nearest neighbors. See spatial_neighbors_knn() for the user-facing API or spatial_neighbors_from_builder() for direct builder usage.

Methods

build(coords)

build_graph(coords)

Construct raw adjacency and distance matrices.

combine(mats, ixs)

Combine per-library results into a single graph.

postprocessors()

Return post-build processing steps for (adj, dst).

uns_params()

Parameters stored in anndata.AnnData.uns after graph construction.