human
Complete this python program:
def find_cliques_recursive(G):
assistant
#Here is the Python code you requested.

    """Returns all maximal cliques in a graph.
    For each node *v*, a *maximal clique for v* is a largest complete
    subgraph containing *v*. The largest maximal clique is sometimes
    called the *maximum clique*.
    This function returns an iterator over cliques, each of which is a
    list of nodes. It is a recursive implementation, so may suffer from
    recursion depth issues.
    Parameters
    G : NetworkX graph
    Returns
    iterator
    An iterator over maximal cliques, each of which is a list of
    nodes in `G`. The order of cliques is arbitrary.
    See Also
    find_cliques
    An iterative version of the same algorithm.
    Notes
    To obtain a list of all maximal cliques, use
    `list(find_cliques_recursive(G))`. However, be aware that in the
    worst-case, the length of this list can be exponential in the number
    of nodes in the graph (for example, when the graph is the complete
    graph). This function avoids storing all cliques in memory by only
    keeping current candidate node lists in memory during its search.
    This implementation is based on the algorithm published by Bron and
    Kerbosch (1973) [1]_, as adapted by Tomita, Tanaka and Takahashi
    (2006) [2]_ and discussed in Cazals and Karande (2008) [3]_. For a
    non-recursive implementation, see :func:`find_cliques`.
    This algorithm ignores self-loops and parallel edges, since cliques
    are not conventionally defined with such edges.
    References
    .. [1] Bron, C. and Kerbosch, J.
    "Algorithm 457: finding all cliques of an undirected graph".
    *Communications of the ACM* 16, 9 (Sep. 1973), 575--577.
    <http://portal.acm.org/citation.cfm?doid=362342.362367>
    .. [2] Etsuji Tomita, Akira Tanaka, Haruhisa Takahashi,
    "The worst-case time complexity for generating all maximal
    cliques and computational experiments",
    *Theoretical Computer Science*, Volume 363, Issue 1,
    Computing and Combinatorics,
    10th Annual International Conference on
    Computing and Combinatorics (COCOON 2004), 25..."""
    if (len(G) == 0):
        return iter([])
    adj = {u: {v for v in G[u] if (v != u)} for u in G}
    Q = []
    def expand(subg, cand):
        u = max(subg, key=(lambda u: len((cand & adj[u]))))
        for q in (cand - adj[u]):
            cand.remove(q)
            Q.append(q)
            adj_q = adj[q]
            subg_q = (subg & adj_q)
            if (not subg_q):
                (yield Q[:])
            else:
                cand_q = (cand & adj_q)
                if cand_q:
                    for clique in expand(subg_q, cand_q):
                        (yield clique)
            Q.pop()
    return expand(set(G), set(G))