def is_cycle(G):
    """Determines whether the given graph is a cycle or circle graph.

    A cycle graph or circular graph is a graph that consists of a single cycle.

    https://en.wikipedia.org/wiki/Cycle_graph

    Parameters
    ----------
    G : NetworkX graph

    Returns
    -------
    is_cycle : bool
        True if the graph consists of a single cycle.

    """
    if len(G) <= 2:
        return False
    trailing, leading = next(iter(G.edges))
    start_node = trailing
    n_visited = 1
    while leading != start_node:
        neighbors = G[leading]
        if len(neighbors) != 2:
            return False
        node1, node2 = neighbors
        if node1 == trailing:
            trailing, leading = leading, node2
        else:
            trailing, leading = leading, node1
        n_visited += 1
    return n_visited == len(G)
