code: def bfs_layers(G, sources):
      G = _to_graph(G)
      if sources in G:
          sources = [sources]
      else:
          sources = set(sources)
          if not all(source in G for source in sources):
              node = next(
                  source for source in sources if source not in G
              )
              raise nx.NetworkXError(
                  f"The node {node} is not in the graph."
              )
          sources = list(sources)
      source_ids = G._list_to_nodearray(sources)
      distances, predecessors, node_ids = plc.bfs(
          handle=plc.ResourceHandle(),
          graph=G._get_plc_graph(),
          sources=source_ids,
          direction_optimizing=False,
          depth_limit=-1,
          compute_predecessors=False,
          do_expensive_check=False,
      )
      mask = distances != np.iinfo(distances.dtype).max
      distances = distances[mask]
      node_ids = node_ids[mask]
      groups = _groupby(distances, node_ids)
      return (
          G._nodearray_to_list(groups[key])
          for key in range(len(groups))
      )
  
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 11 for calling a global function with example usage: bfs_layers(G, sources) and returns: unknown