code: def _run_node2vec(
      src_arr,
      dst_arr,
      wgt_arr,
      seeds,
      num_vertices,
      num_edges,
      max_depth,
      compressed_result,
      p,
      q,
      renumbered,
  ):
      """
      Builds a graph from the input arrays and runs node2vec using the other args
      to this function, then checks the output for validity.
      """
      resource_handle = ResourceHandle()
      graph_props = GraphProperties(
          is_symmetric=False, is_multigraph=False
      )
      G = SGGraph(
          resource_handle=resource_handle,
          graph_properties=graph_props,
          src_or_offset_array=src_arr,
          dst_or_index_array=dst_arr,
          weight_array=wgt_arr,
          store_transposed=False,
          renumber=renumbered,
          do_expensive_check=True,
      )
  
      (paths, weights, sizes) = node2vec(
          resource_handle, G, seeds, max_depth, compressed_result, p, q
      )
  
      num_seeds = len(seeds)
  
      # Validating results of node2vec by checking each path
      M = np.zeros((num_vertices, num_vertices), dtype=np.float64)
  
      h_src_arr = src_arr.get()
      h_dst_arr = dst_arr.get()
      h_wgt_arr = wgt_arr.get()
      h_paths = paths.get()
      h_weights = weights.get()
  
      for i in range(num_edges):
          M[h_src_arr[i]][h_dst_arr[i]] = h_wgt_arr[i]
  
      if compressed_result:
          path_offsets = np.zeros(num_seeds + 1, dtype=np.int32)
          path_offsets[0] = 0
          for i in range(num_seeds):
              path_offsets[i + 1] = path_offsets[i] + sizes.get()[i]
  
          for i in range(num_seeds):
              for j in range(
                  path_offsets[i], (path_offsets[i + 1] - 1)
              ):
                  actual_wgt = h_weights[j - i]
                  expected_wgt = M[h_paths[j]][h_paths[j + 1]]
                  if pytest.approx(expected_wgt, 1e-4) != actual_wgt:
                      s = h_paths[j]
                      d = h_paths[j + 1]
                      raise ValueError(
                          f"Edge ({s},{d}) has wgt {actual_wgt}, "
                          f"should have been {expected_wgt}"
                      )
      else:
          max_path_length = int(len(paths) / num_seeds)
          for i in range(num_seeds):
              for j in range(max_path_length - 1):
                  curr_idx = i * max_path_length + j
                  next_idx = i * max_path_length + j + 1
                  if h_paths[next_idx] != num_vertices:
                      actual_wgt = h_weights[
                          i * (max_path_length - 1) + j
                      ]
                      expected_wgt = M[h_paths[curr_idx]][
                          h_paths[next_idx]
                      ]
                      if (
                          pytest.approx(expected_wgt, 1e-4)
                          != actual_wgt
                      ):
                          s = h_paths[j]
                          d = h_paths[j + 1]
                          raise ValueError(
                              f"Edge ({s},{d}) has wgt {actual_wgt}"
                              f", should have been {expected_wgt}"
                          )
  
file_path: cugraph/python/pylibcugraph/pylibcugraph/tests/test_node2vec.py
imports: import pytest
  import cupy
  import numpy
  from pylibcugraph import ResourceHandle, GraphProperties, SGGraph, node2vec
  from pylibcugraph.testing import utils
label_desc: Use image node_id 2 for calling a global function with example usage: _run_node2vec(src_arr, dst_arr, wgt_arr, seeds, num_vertices, num_edges, max_depth, compressed_result, p, q, renumbered) without return types