Return the tree generated by a breadthfirst search
Note that a breadthfirst tree from a specified node is unique.
New in version 0.11.0.
Parameters :  csgraph : array_like or sparse matrix
i_start : int
directed : bool, optional


Returns :  cstree : csr matrix

Examples
The following example shows the computation of a depthfirst tree over a simple fourcomponent graph, starting at node 0:
input graph breadth first tree from (0)
(0) (0)
/ \ / \
3 8 3 8
/ \ / \
(3)5(1) (3) (1)
\ / /
6 2 2
\ / /
(2) (2)
In compressed sparse representation, the solution looks like this:
>>> from scipy.sparse import csr_matrix
>>> from scipy.sparse.csgraph import breadth_first_tree
>>> X = csr_matrix([[0, 8, 0, 3],
... [0, 0, 2, 5],
... [0, 0, 0, 6],
... [0, 0, 0, 0]])
>>> Tcsr = breadth_first_tree(X, 0, directed=False)
>>> Tcsr.toarray().astype(int)
array([[0, 8, 0, 3],
[0, 0, 2, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]])
Note that the resulting graph is a Directed Acyclic Graph which spans the graph. A breadthfirst tree from a given node is unique.