code: def test_node2vec(sg_graph_objs, compress_result):
      (g, resource_handle, ds_name) = sg_graph_objs
  
      (
          seeds,
          expected_paths,
          expected_weights,
          expected_path_sizes,
          max_depth,
      ) = _test_data[ds_name].values()
  
      p = 0.8
      q = 0.5
  
      result = node2vec(
          resource_handle, g, seeds, max_depth, compress_result, p, q
      )
  
      (actual_paths, actual_weights, actual_path_sizes) = result
      num_paths = len(seeds)
  
      if compress_result:
          assert actual_paths.dtype == expected_paths.dtype
          assert actual_weights.dtype == expected_weights.dtype
          assert actual_path_sizes.dtype == expected_path_sizes.dtype
          actual_paths = actual_paths.tolist()
          actual_weights = actual_weights.tolist()
          actual_path_sizes = actual_path_sizes.tolist()
          exp_paths = expected_paths.tolist()
          exp_weights = expected_weights.tolist()
          exp_path_sizes = expected_path_sizes.tolist()
          # If compress_results is True, then also verify path lengths match
          # up with weights array
          assert len(actual_path_sizes) == num_paths
          expected_walks = sum(exp_path_sizes) - num_paths
          # Verify the number of walks was equal to path sizes - num paths
          assert len(actual_weights) == expected_walks
      else:
          assert actual_paths.dtype == expected_paths.dtype
          assert actual_weights.dtype == expected_weights.dtype
          actual_paths = actual_paths.tolist()
          actual_weights = actual_weights.tolist()
          exp_paths = expected_paths.tolist()
          exp_weights = expected_weights.tolist()
  
      # Verify exact walks chosen for linear graph Simple_1
      if ds_name == "Simple_1":
          for i in range(len(exp_paths)):
              assert (
                  pytest.approx(actual_paths[i], 1e-4) == exp_paths[i]
              )
          for i in range(len(exp_weights)):
              assert (
                  pytest.approx(actual_weights[i], 1e-4)
                  == exp_weights[i]
              )
  
      # Verify starting vertex of each path is the corresponding seed
      if compress_result:
          path_start = 0
          for i in range(num_paths):
              assert actual_path_sizes[i] == exp_path_sizes[i]
              assert actual_paths[path_start] == seeds[i]
              path_start += actual_path_sizes[i]
  
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 7 for calling a global function with example usage: test_node2vec(sg_graph_objs, compress_result) without return types