code: def _plain_bfs(G, source):
      """A fast BFS node generator"""
      adj = G._adj
      n = len(adj)
      seen = {source}
      nextlevel = [source]
      while nextlevel:
          thislevel = nextlevel
          nextlevel = []
          for v in thislevel:
              for w in adj[v]:
                  if w not in seen:
                      seen.add(w)
                      nextlevel.append(w)
              if len(seen) == n:
                  return seen
      return seen
  
file_path: networkx/networkx/algorithms/components/connected.py
imports: import networkx
  from networkx.utils.decorators import not_implemented_for
  from ...utils import arbitrary_element
label_desc: Use image node_id 5 for calling a global function with example usage: _plain_bfs(G, source) and returns: seen, seen