connected_components
- compas.topology.connected_components(adjacency)[source]
Identify the vertices of connected components.
- Parameters
adjacency (dict) – An adjacency dictionary mapping vertex identifiers to neighbours.
- Returns
list of list of hashable – A nested list of vertex identifiers.
Examples
>>> adjacency = {0: [1, 2], 1: [0, 2], 2: [0, 1], 3: []} >>> connected_components(adjacency) [[0, 1, 2], [3]]