def bfs_predecessors(G, source):
 for (s, t) in bfs_edges(G, source):
  (yield (t, s))

def bfs_predecessors ( G , source ) : for ( s , t ) in bfs_edges ( G , source ) : ( yield ( t , s ) )
returns an iterator of predecessors in breadth-first-search from source .