def METHOD_NAME(G):
    """Generate connected components.
    Parameters
    ----------
    G : NetworkX graph
       An undirected graph
    Returns
    -------
    comp : generator of sets
       A generator of sets of nodes, one for each component of G.
    Raises
    ------
    NetworkXNotImplemented
        If G is directed.
    Examples
    --------
    Generate a sorted list of connected components, largest first.
    >>> G = nx.path_graph(4)
    >>> nx.add_path(G, [10, 11, 12])
    >>> [len(c) for c in sorted(nx.connected_components(G), key=len, reverse=True)]
    [4, 3]
    If you only want the largest connected component, it's more
    efficient to use max instead of sort.
    >>> largest_cc = max(nx.connected_components(G), key=len)
    To create the induced subgraph of each component use:
    >>> S = [G.subgraph(c).copy() for c in nx.connected_components(G)]
    See Also
    --------
    strongly_connected_components
    weakly_connected_components
    Notes
    -----
    For undirected graphs only.
    """
    seen = set()
    for v in G:
        if v not in seen:
            c = _plain_bfs(G, v)
            seen.update(c)
            yield c