voyagerpy.spatial.compute_higher_order_neighbors#
- voyagerpy.spatial.compute_higher_order_neighbors(adata: AnnData, graph_name: str | None = None, force: bool = False, *, order: int) List[csr_matrix]#
Compute higher order neighbors of graph. The first order neighbors is the graph itself.
- Parameters:
adata (AnnData) – The AnnData object storing the graph.
order (int) – The order of neighbors to compute. Will compute all orders up to this order.
graph_name (Optional[str], optional) – The key in
adata.uns["spatial"]storing the spatial weights neighborhood graph, defaults to None.force (bool, optional) – If True, recompute all pre-computed orders. Otherwise, start with the highest pre-computed order. Defaults to False.
- Returns:
List of libpysal spatial weights matrices. The first element is the original graph, the second element is the first order neighbors, etc.This list is a reference to
adata.uns["spatial"]["higher_order"][graph_name].- Return type:
List[sparse.csr_matrix]