code: def _bfs(G, source, *, depth_limit=None, reverse=False):
      src_index = source if G.key_to_id is None else G.key_to_id[source]
      distances, predecessors, node_ids = plc.bfs(
          handle=plc.ResourceHandle(),
          graph=G._get_plc_graph(switch_indices=reverse),
          sources=cp.array([src_index], dtype=index_dtype),
          direction_optimizing=False,
          depth_limit=-1 if depth_limit is None else depth_limit,
          compute_predecessors=True,
          do_expensive_check=False,
      )
      mask = predecessors >= 0
      return distances[mask], predecessors[mask], node_ids[mask]
  
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 2 for calling a global function with example usage: _bfs(G, source) and returns: distances,  predecessors,  node_ids