nigsp.operations.laplacian.symmetric_normalised_laplacian¶
- nigsp.operations.laplacian.symmetric_normalised_laplacian(mtx, d=None, fix_zeros=True)[source]¶
Compute symmetric normalised Laplacian (SNL) matrix.
The SNL is obtained by pre- and post- multiplying mtx by the square root of the inverse of the diagonal and subtract the result from the identity matrix. Alternatively, it is possible to specify a different diagonal to do so. With zero-order nodes, the diagonals will contain 0s, returning a Laplacian with NaN elements. To avoid that, 0 elements in d will be changed to 1.
- Parameters:
- mtx
numpy.ndarray
A [structural] matrix
- d
np.ndarray
orNone
, optional Either an array or a diagonal matrix. If specified, d will be used as the normalisation factor (not the degree matrix).
- fix_zeros
bool
, optional Whether to change 0 elements in the degree matrix to 1 to avoid multiplying by 0
- mtx
- Returns:
numpy.ndarray
The symmetric normalised laplacian of mtx
- Raises:
ValueError
If d in not a diagonal matrix or an array If d and mtx have different shapes.
Notes
This is here mainly for tests and legacy code, but it would be better not to use it!
https://en.wikipedia.org/wiki/Laplacian_matrix#Symmetrically_normalized_Laplacian_2