voyagerpy.spatial.to_spatial_weights#
- voyagerpy.spatial.to_spatial_weights(adata: AnnData, graph_name: str | None = None) AnnData#
Convert a graph adjacency matrix to a spatial weights matrix.
- Parameters:
adata (AnnData) – The AnnData object storing the graph
graph_name (Optional[str], optional) – The key in
obspstoring the matrix, defaults to None. If None, the default graph is used.
- Raises:
ImportError – If libpysal is not installed.
- Returns:
The updated AnnData object. The libpysal spatial weights matrix is stored in
adata.uns["spatial"][graph_name].- Return type:
AnnData