MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / separate_graph

Function separate_graph

python/pymesh/meshutils/separate_mesh.py:93–110  ·  view source on GitHub ↗

Split graph into disconnected components. Args: edges (:class:`numpy.ndarray`): edges of the graph. Returns: An array of indices indicating the component each edge belongs to.

(edges)

Source from the content-addressed store, hash-verified

91 return comp_meshes
92
93def separate_graph(edges):
94 """ Split graph into disconnected components.
95
96 Args:
97 edges (:class:`numpy.ndarray`): edges of the graph.
98
99 Returns:
100 An array of indices indicating the component each edge belongs to.
101 """
102 separator = MeshSeparator(edges)
103 separator.set_connectivity_type(MeshSeparator.VERTEX)
104 num_comps = separator.separate()
105
106 comp_indices = np.zeros(len(edges))
107 for i in range(num_comps):
108 src_idx = separator.get_sources(i).ravel()
109 comp_indices[src_idx] = i
110 return comp_indices
111

Callers

nothing calls this directly

Calls 4

set_connectivity_typeMethod · 0.95
separateMethod · 0.95
get_sourcesMethod · 0.95
MeshSeparatorClass · 0.85

Tested by

no test coverage detected