code: def _ladder_graph(n, create_using, *, is_circular=False):
      # Like path path_graph with extra arange, and middle link missing
      n = _ensure_nonnegative_int(n)
      if n < 2:
          if not is_circular:
              return _common_small_graph(
                  2 * n, None, create_using, allow_directed=False
              )
          graph_class, inplace = _create_using_class(create_using)
          if graph_class.is_directed():
              raise nx.NetworkXError("Directed Graph not supported")
          if n == 1:
              src_indices = cp.array([0, 1, 0, 1], index_dtype)
              dst_indices = cp.array([0, 0, 1, 1], index_dtype)
              nodes = None
          elif graph_class.is_multigraph():
              src_indices = cp.array([0, 0, 1, 1], index_dtype)
              dst_indices = cp.array([1, 1, 0, 0], index_dtype)
              nodes = [0, -1]
          else:
              src_indices = cp.array([0, 1], index_dtype)
              dst_indices = cp.array([1, 0], index_dtype)
              nodes = [0, -1]
          G = graph_class.from_coo(
              2, src_indices, dst_indices, id_to_key=nodes
          )
          if inplace:
              return create_using._become(G)
          return G
      graph_class, inplace = _create_using_class(create_using)
      if graph_class.is_directed():
          raise nx.NetworkXError("Directed Graph not supported")
      path_src = cp.arange(1, 2 * n - 1, dtype=index_dtype) // 2
      path_dst = (
          cp.arange(n, dtype=index_dtype)[:, None]
          + cp.array([-1, 1], index_dtype)
      ).ravel()[1:-1]
      srcs = [
          path_src,
          path_src + n,
          cp.arange(2 * n, dtype=index_dtype),
      ]
      dsts = [
          path_dst,
          path_dst + n,
          cp.arange(n, 2 * n, dtype=index_dtype),
          cp.arange(0, n, dtype=index_dtype),
      ]
      if is_circular and (n > 2 or graph_class.is_multigraph()):
          srcs.append(cp.array([0, n - 1, n, 2 * n - 1], index_dtype))
          dsts.append(cp.array([n - 1, 0, 2 * n - 1, n], index_dtype))
      src_indices = cp.hstack(srcs)
      dst_indices = cp.hstack(dsts)
      G = graph_class.from_coo(2 * n, src_indices, dst_indices)
      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 7 for calling a global function with example usage: _ladder_graph(n, create_using) and returns: G, G, create_using, _common_small_graph, create_using