Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
rustworkx.bfs_layers¶
- bfs_layers(graph, sources=None)[source]¶
- bfs_layers(digraph: PyDiGraph, sources=None)
- bfs_layers(graph: PyGraph, sources=None)
Return the BFS layers of a graph as a list of lists.
- Parameters:
- Returns:
A list of lists where each inner list contains the node indices at that BFS layer/level from the source nodes
- Return type:
list[list[int]]