code: def input_and_expected_output(request):
      d = request.param.copy()
  
      input_graph_data = d.pop("graph")
      input_type = d.pop("input_type")
      src_or_offset_array = cudf.Series(
          input_graph_data["src_or_offset_array"], dtype="int32"
      )
      dst_or_index_array = cudf.Series(
          input_graph_data["dst_or_index_array"], dtype="int32"
      )
      weight = cudf.Series(input_graph_data["weight"], dtype="float32")
  
      max_level = d.pop("max_level")
      resolution = d.pop("resolution")
      output = d
  
      G = cugraph.Graph()
  
      if input_type == "COO":
          # Create graph from an edgelist
          df = cudf.DataFrame()
          df["src"] = src_or_offset_array
          df["dst"] = dst_or_index_array
          df["weight"] = cudf.Series(weight, dtype="float32")
          G.from_cudf_edgelist(
              df,
              source="src",
              destination="dst",
              edge_attr="weight",
              store_transposed=False,
          )
  
      elif input_type == "CSR":
          # Create graph from csr
          offsets = src_or_offset_array
          indices = dst_or_index_array
          G.from_cudf_adjlist(offsets, indices, weight, renumber=False)
  
      parts, mod = cugraph.leiden(G, max_level, resolution)
  
      parts = parts.sort_values("vertex").reset_index(drop=True)
  
      output["result_output"] = {
          "partition": parts["partition"],
          "modularity_score": mod,
      }
  
      return output
  
file_path: cugraph/python/cugraph/cugraph/tests/community/test_leiden.py
imports: import gc
  import time
  import pytest
  import networkx
  import cugraph
  import cudf
  from cugraph.testing import utils, UNDIRECTED_DATASETS
  from cugraph.datasets import karate_asymmetric
label_desc: Use image node_id 1 for calling a global function with example usage: input_and_expected_output(request) and returns: output