breadth_first_traverse
- compas.topology.breadth_first_traverse(adjacency, root, callback=None)[source]
Traverse an adjacency dict in “breadth-first” order.
- Parameters
adjacency (dict) – Map of every node to a list of neighbouring nodes.
root (int) – The identifier of the starting node.
callback (callable, optional) – A callback function applied to every traversed node and its current neighbour.
- Returns
set – The visited nodes.
Examples
>>>