laplacian#

tangles.util.graph.laplacian(adj: spmatrix | sparray | ndarray) csr_matrix | ndarray | None#

Compute the combinatorial laplacian \(L = D-A\), where \(A\) is the adjacency matrix of a graph \(G\) and \(D\) is the diagonal matrix containing the degrees of \(G\).

Parameters#

Asparse array or np.ndarray

Adjacency matrix.

Returns#

scipy.sparse.csr_matrix or np.ndarray

The laplacian matrix.