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 orspatial_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.
Return post-build processing steps for
(adj, dst).Parameters stored in
anndata.AnnData.unsafter graph construction.