mesh_degree_matrix
-
compas.datastructures.
mesh_degree_matrix
(mesh, rtype='array')[source] Creates a vertex degree matrix from a Mesh datastructure.
- Parameters
mesh (compas.datastructures.Mesh) – Instance of mesh.
rtype ({‘array’, ‘csc’, ‘csr’, ‘coo’, ‘list’}) – Format of the result.
- Returns
array-like – Constructed vertex degree matrix.
Examples
>>> D = mesh_degree_matrix(mesh) >>> type(D) <class 'numpy.ndarray'>
>>> D = mesh_degree_matrix(mesh, rtype='csr') >>> type(D) <class 'scipy.sparse.csr.csr_matrix'>
>>> D = mesh_degree_matrix(mesh) >>> D.diagonal() array([2., 3., 3., 3., 3., 2., 3., 4., 4., 4., 4., 3., 3., 4., 4., 4., 4., 3., 3., 4., 4., 4., 4., 3., 3., 4., 4., 4., 4., 3., 2., 3., 3., 3., 3., 2.])