mesh_adjacency_matrix

compas.datastructures.mesh_adjacency_matrix(mesh, rtype='array')[source]

Creates a vertex adjacency matrix from a Mesh datastructure.

Parameters:
meshcompas.datastructures.Mesh

Instance of mesh.

rtypeLiteral[‘array’, ‘csc’, ‘csr’, ‘coo’, ‘list’], optional

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')