code: def test_random_link_split_non_contiguous():
      edge_index = get_random_edge_index(40, 40, num_edges=150)
      edge_index = edge_index[:, :100]
      assert not edge_index.is_contiguous()
  
      data = Data(edge_index=edge_index, num_nodes=40)
      transform = RandomLinkSplit(num_val=0.2, num_test=0.2)
      train_data, val_data, test_data = transform(data)
      assert train_data.num_edges == 60
      assert train_data.edge_index.is_contiguous()
  
      data = HeteroData()
      data["p"].num_nodes = 40
      data["p", "p"].edge_index = edge_index
      transform = RandomLinkSplit(
          num_val=0.2, num_test=0.2, edge_types=("p", "p")
      )
      train_data, val_data, test_data = transform(data)
      assert train_data["p", "p"].num_edges == 60
      assert train_data["p", "p"].edge_index.is_contiguous()
  
file_path: pytorch_geometric/test/transforms/test_random_link_split.py
imports: import pytest
  import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.testing import get_random_edge_index, onlyFullTest, onlyOnline
  from torch_geometric.transforms import RandomLinkSplit
  from torch_geometric.utils import is_undirected, to_undirected
label_desc: Use image node_id 7 for calling a global function with example usage: test_random_link_split_non_contiguous() without return types