def bfs_tree(G, source, reverse=False):
    T = nx.DiGraph()
    T.add_node(source)
    T.add_edges_from(bfs_edges(G,source,reverse=reverse))
    return T
Return directed tree of breadth-first-search from source.
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/traversal/breadth_first_search.py/bfs_tree