code: def test_negative_sampling():
      edge_index = torch.as_tensor([[0, 0, 1, 2], [0, 1, 2, 3]])
  
      neg_edge_index = negative_sampling(edge_index)
      assert neg_edge_index.size(1) == edge_index.size(1)
      assert is_negative(
          edge_index, neg_edge_index, (4, 4), bipartite=False
      )
  
      neg_edge_index = negative_sampling(edge_index, method="dense")
      assert neg_edge_index.size(1) == edge_index.size(1)
      assert is_negative(
          edge_index, neg_edge_index, (4, 4), bipartite=False
      )
  
      neg_edge_index = negative_sampling(edge_index, num_neg_samples=2)
      assert neg_edge_index.size(1) == 2
      assert is_negative(
          edge_index, neg_edge_index, (4, 4), bipartite=False
      )
  
      edge_index = to_undirected(edge_index)
      neg_edge_index = negative_sampling(
          edge_index, force_undirected=True
      )
      assert neg_edge_index.size(1) == edge_index.size(1) - 1
      assert is_undirected(neg_edge_index)
      assert is_negative(
          edge_index, neg_edge_index, (4, 4), bipartite=False
      )
  
file_path: pytorch_geometric/test/utils/test_negative_sampling.py
imports: import torch
  from torch_geometric.utils import batched_negative_sampling, contains_self_loops, is_undirected, negative_sampling, structured_negative_sampling, structured_negative_sampling_feasible, to_undirected
  from torch_geometric.utils._negative_sampling import edge_index_to_vector, vector_to_edge_index
label_desc: Use image node_id 3 for calling a global function with example usage: test_negative_sampling() without return types