code: def negative_sampling(
      edge_index, num_nodes, num_neg_edge, undirected=False
  ):
      row, col = edge_index
      adj_dense = torch.zeros([num_nodes, num_nodes], device=row.device)
      adj_dense[row, col] = 1
  
      neg_adj_dense = 1.0 - adj_dense
      neg_row, neg_col = torch.nonzero(neg_adj_dense).t()
      if undirected:
          neg_row, neg_col, _ = filter_adj(
              neg_row, neg_col, None, neg_row < neg_col
          )
      else:
          neg_row, neg_col, _ = filter_adj(
              neg_row, neg_col, None, neg_row != neg_col
          )
  
      num_neg_edge = min(num_neg_edge, len(neg_row))
      neg_idx = random.sample(range(len(neg_row)), num_neg_edge)
      return neg_row[neg_idx], neg_col[neg_idx]
  
file_path: DIG/dig/auggraph/method/GraphAug/aug/edge_per.py
imports: import torch
  import random
  import torch.nn.functional
  from torch.distributions.bernoulli import Bernoulli
  from torch_geometric.data import Data
  from torch_geometric.utils.dropout import filter_adj
  from torch_geometric.utils.num_nodes import maybe_num_nodes
  from .aug_utils import coalesce
label_desc: Use image node_id 1 for calling a global function with example usage: negative_sampling(edge_index, num_nodes, num_neg_edge, undirected) and returns: neg_row,  neg_col