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)
| 91 | return comp_meshes |
| 92 | |
| 93 | def 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 |
nothing calls this directly
no test coverage detected