rustworkx.bfs_successors#

bfs_successors(graph, node, /)#

Return successors in a breadth-first-search from a source node.

The return format is [(Parent Node, [Children Nodes])] in a bfs order from the source node provided.

Parameters:
  • graph (PyDiGraph) – The DAG to get the bfs_successors from

  • node (int) – The index of the dag node to get the bfs successors for

Returns:

A list of nodes’s data and their children in bfs order. The BFSSuccessors class that is returned is a custom container class that implements the sequence protocol. This can be used as a python list with index based access.

Return type:

BFSSuccessors