mesh_is_connected

compas.datastructures.mesh_is_connected(mesh)[source]

Verify that the mesh is connected.

Parameters:
meshcompas.datastructures.Mesh

A mesh data structure.

Returns:
bool

True, if the mesh is connected. False, otherwise.

Notes

A mesh is connected if for every two vertices a path exists connecting them.

Examples

>>> from compas.datastructures import Mesh
>>> mesh = Mesh()
>>> mesh_is_connected(mesh)
False
>>> a = mesh.add_vertex(x=0, y=0, z=0)
>>> b = mesh.add_vertex(x=1, y=0, z=0)
>>> c = mesh.add_vertex(x=1, y=1, z=0)
>>> mesh_is_connected(mesh)
False
>>> abc = mesh.add_face([a, b, c])
>>> mesh_is_connected(mesh)
True