code: def cycle_graph(n, create_using=None):
      n, nodes = _number_and_nodes(n)
      graph_class, inplace = _create_using_class(create_using)
      if n == 1:
          src_indices = cp.zeros(1, index_dtype)
          dst_indices = cp.zeros(1, index_dtype)
      elif (
          n == 2
          and graph_class.is_multigraph()
          and not graph_class.is_directed()
      ):
          # This is kind of a peculiar edge case
          src_indices = cp.array([0, 0, 1, 1], index_dtype)
          dst_indices = cp.array([1, 1, 0, 0], index_dtype)
      elif n < 3:
          return _common_small_graph(n, nodes, create_using)
      elif graph_class.is_directed():
          src_indices = cp.arange(n, dtype=index_dtype)
          dst_indices = cp.arange(1, n + 1, dtype=index_dtype)
          dst_indices[-1] = 0
      else:
          src_indices = cp.arange(2 * n, dtype=index_dtype) // 2
          dst_indices = (
              cp.arange(n, dtype=index_dtype)[:, None]
              + cp.array([-1, 1], index_dtype)
          ).ravel()
          dst_indices[0] = n - 1
          dst_indices[-1] = 0
      G = graph_class.from_coo(
          n, src_indices, dst_indices, id_to_key=nodes
      )
      if inplace:
          return create_using._become(G)
      return G
  
imports: import itertools
  from numbers import Integral
  import cupy
  import networkx
  import numpy
  import nx_cugraph
  from ..utils import _get_int_dtype, index_dtype, networkx_algorithm
  from ._utils import _IS_NX32_OR_LESS, _common_small_graph, _complete_graph_indices, _create_using_class, _ensure_int, _ensure_nonnegative_int, _number_and_nodes
label_desc: Use image node_id 5 for calling a global function with example usage: cycle_graph(n, create_using) and returns: G, create_using, _common_small_graph