code: def test_SubgraphSampler_Link_With_Negative(sampler_type):
      _check_sampler_type(sampler_type)
      graph = gb_test_utils.rand_csc_graph(
          20, 0.15, bidirection_edge=True
      ).to(F.ctx())
      items = torch.arange(20).reshape(-1, 2)
      names = "node_pairs"
      if sampler_type == SamplerType.Temporal:
          graph.node_attributes = {
              "timestamp": torch.arange(20).to(F.ctx())
          }
          graph.edge_attributes = {
              "timestamp": torch.arange(len(graph.indices)).to(F.ctx())
          }
          items = (items, torch.arange(10))
          names = ("node_pairs", "timestamp")
      itemset = gb.ItemSet(items, names=names)
      datapipe = gb.ItemSampler(itemset, batch_size=2).copy_to(F.ctx())
      num_layer = 2
      fanouts = [torch.LongTensor([2]) for _ in range(num_layer)]
      datapipe = gb.UniformNegativeSampler(datapipe, graph, 1)
      sampler = _get_sampler(sampler_type)
      datapipe = sampler(datapipe, graph, fanouts)
      datapipe = datapipe.transform(partial(gb.exclude_seed_edges))
      assert len(list(datapipe)) == 5
  
imports: import unittest
  from enum import Enum
  from functools import partial
  import backend
  import dgl
  import dgl.graphbolt
  import pytest
  import torch
  from torchdata.datapipes.iter import Mapper
  from .None import gb_test_utils
label_desc: Use image node_id 9 for calling a global function with example usage: test_SubgraphSampler_Link_With_Negative(sampler_type) without return types