code: def bfs_tree(
      G, source, reverse=False, depth_limit=None, sort_neighbors=None
  ):
      """`sort_neighbors` parameter is not yet supported."""
      G = _check_G_and_source(G, source)
      if depth_limit is not None and depth_limit < 1:
          return nxcg.DiGraph.from_coo(
              1,
              cp.array([], dtype=index_dtype),
              cp.array([], dtype=index_dtype),
              id_to_key=[source],
          )
  
      distances, predecessors, node_ids = _bfs(
          G,
          source,
          depth_limit=depth_limit,
          reverse=reverse,
      )
      if predecessors.size == 0:
          return nxcg.DiGraph.from_coo(
              1,
              cp.array([], dtype=index_dtype),
              cp.array([], dtype=index_dtype),
              id_to_key=[source],
          )
      # TODO: create renumbering helper function(s)
      unique_node_ids = cp.unique(cp.hstack((predecessors, node_ids)))
      # Renumber edges
      src_indices = cp.searchsorted(
          unique_node_ids, predecessors
      ).astype(index_dtype)
      dst_indices = cp.searchsorted(unique_node_ids, node_ids).astype(
          index_dtype
      )
      # Renumber nodes
      if (id_to_key := G.id_to_key) is not None:
          key_to_id = {
              id_to_key[old_index]: new_index
              for new_index, old_index in enumerate(
                  unique_node_ids.tolist()
              )
          }
      else:
          key_to_id = {
              old_index: new_index
              for new_index, old_index in enumerate(
                  unique_node_ids.tolist()
              )
          }
      return nxcg.DiGraph.from_coo(
          unique_node_ids.size,
          src_indices,
          dst_indices,
          key_to_id=key_to_id,
      )
  
imports: from itertools import repeat
  import cupy
  import networkx
  import numpy
  import pylibcugraph
  import nx_cugraph
  from nx_cugraph.convert import _to_graph
  from nx_cugraph.utils import _groupby, index_dtype, networkx_algorithm
label_desc: Use image node_id 7 for calling a global function with example usage: bfs_tree(G, source, reverse, depth_limit, sort_neighbors) and returns: nxcg, nxcg, nxcg