mesh_adjacency_matrix
- compas.datastructures.mesh_adjacency_matrix(mesh, rtype='array')[source]
Creates a vertex adjacency 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 adjacency matrix.
Examples
>>> from compas.datastructures import Mesh >>> mesh = Mesh.from_polyhedron(6) >>> A = mesh_adjacency_matrix(mesh) >>> type(A) <class 'numpy.ndarray'>
>>> A = mesh_adjacency_matrix(mesh, rtype='csr') >>> type(A) <class 'scipy.sparse.csr.csr_matrix'>