squidpy.gr.neighbors.GridBuilder

class squidpy.gr.neighbors.GridBuilder(n_neighs=6, n_rings=1, delaunay=False, transform=None, set_diag=False)[source]

Build a grid-based spatial graph.

Assumes observations lie on an approximately regular lattice (e.g., Visium). When delaunay=True, Delaunay triangulation is used only to derive the base connectivity; the distance matrix still encodes grid/ring distances, not Euclidean lengths.

See spatial_neighbors_grid() 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.