c2v.utils.laplacian_eigenmaps

c2v.utils.laplacian_eigenmaps#

c2v.utils.laplacian_eigenmaps(adata, obsp_key='connectivities', n_components=20, key_added='X_laplacian', norm_laplacian=True, uns_key='laplacian_eigenmaps')#

Compute Laplacian eigenmaps from a sparse graph stored in adata.obsp.

The function builds the (normalised) graph Laplacian from the adjacency matrix in adata.obsp[obsp_key], computes the smallest non-trivial eigenvectors, and stores them in adata.obsm[key_added].

Parameters:
adata sc.AnnData

Annotated data matrix. Must contain a sparse adjacency matrix in adata.obsp[obsp_key].

obsp_key str, optional

Key in adata.obsp for the adjacency / connectivity matrix. Default is "connectivities".

n_components int, optional

Number of eigenvectors to compute (excluding the trivial constant eigenvector). Default is 20.

key_added str, optional

Key in adata.obsm where the embedding is stored. Default is "X_laplacian".

norm_laplacian bool, optional

If True, use the symmetric normalised Laplacian \(I - D^{-1/2} W D^{-1/2}\). Otherwise use the combinatorial Laplacian \(D - W\). Default is True.

uns_key str, optional

Name of the new column in adata.uns to store the Laplacian eigenmaps parameters, by default “laplacian_eigenmaps”.

Return type:

None

Returns:

None The embedding is stored in place in adata.obsm[key_added].