retworkx.BFSSuccessors¶
- class BFSSuccessors¶
A custom class for the return from
retworkx.bfs_successors()
This class is a container class for the results of the
retworkx.bfs_successors()
function. It implements the Python sequence protocol. So you can treat the return as read-only sequence/list that is integer indexed. If you want to use it as an iterator you can by wrapping it in aniter()
that will yield the results in order.For example:
import retworkx graph = retworkx.generators.directed_path_graph(5) bfs_succ = retworkx.bfs_successors(0) # Index based access third_element = bfs_succ[2] # Use as iterator bfs_iter = iter(bfs_succ) first_element = next(bfs_iter) second_element = nex(bfs_iter)
- __init__()¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
()Initialize self.