modularity_matrix#

tangles.util.graph.modularity_matrix(adj: csr_matrix, diagonal: ndarray | None = None) ndarray#

Compute the modularity matrix of the graph with adjacency matrix A.

Parameters#

adjsparse.csr_matrix

Adjacency matrix.

diagonal: np.ndarray, optional

Diagonal.

Returns#

np.ndarray

The modularity matrix. Note: the matrix is not sparse.