laplacian_matrix

compas.numerical.laplacian_matrix(edges, normalize=False, rtype='array')[source]

Creates a laplacian matrix from a list of edge topologies.

Parameters
  • edges (list) – List of lists [[node_i, node_j], [node_k, node_l]].

  • rtype ({‘array’, ‘csc’, ‘csr’, ‘coo’, ‘list’}) – Format of the result.

Returns

array-like – Constructed Laplacian matrix.

Notes

The laplacian matrix is defined as

\[\mathbf{L} = \mathbf{C} ^ \mathrm{T} \mathbf{C}\]

The current implementation only supports umbrella weights.

Examples

>>> laplacian_matrix([[0, 1], [0, 2], [0, 3]], rtype='array')
array([[ 3., -1., -1., -1.],
       [-1.,  1.,  0.,  0.],
       [-1.,  0.,  1.,  0.],
       [-1.,  0.,  0.,  1.]])