root: int | str
This is the index of the root node or a list of root node indices. use this node as the root cell for diffusion pseudotime.
import scanpy as sc
sc.tl.louvain(adata)
adata.uns['iroot'] = np.flatnonzero(adata.obs['louvain'] == '16')[0]
sc.tl.dpt(adata)
sc.pl.draw_graph(adata, color=['louvain', 'dpt_pseudotime'], legend_loc='on data', cmap='viridis')