def _to_diagonally_dominant ( mat ) : mat += np . diag ( np . sum ( mat != 0 , axis = 1 ) + 0.01 ) return mat
how to a matrix diagonally dominant in python
Make matrix unweighted diagonally dominant using the Laplacian .
def _to_diagonally_dominant(mat):
    """Make matrix unweighted diagonally dominant using the Laplacian."""
    mat += np.diag(np.sum(mat != 0, axis=1) + 0.01)
    return mat