code: def test_k_hop_subgraph():
      edge_index = torch.tensor(
          [
              [0, 1, 2, 3, 4, 5],
              [2, 2, 4, 4, 6, 6],
          ]
      )
  
      subset, edge_index, mapping, edge_mask = k_hop_subgraph(
          6, 2, edge_index, relabel_nodes=True
      )
      assert subset.tolist() == [2, 3, 4, 5, 6]
      assert edge_index.tolist() == [[0, 1, 2, 3], [2, 2, 4, 4]]
      assert mapping.tolist() == [4]
      assert edge_mask.tolist() == [
          False,
          False,
          True,
          True,
          True,
          True,
      ]
  
      edge_index = torch.tensor(
          [
              [1, 2, 4, 5],
              [0, 1, 5, 6],
          ]
      )
  
      subset, edge_index, mapping, edge_mask = k_hop_subgraph(
          [0, 6], 2, edge_index, relabel_nodes=True
      )
  
      assert subset.tolist() == [0, 1, 2, 4, 5, 6]
      assert edge_index.tolist() == [[1, 2, 3, 4], [0, 1, 4, 5]]
      assert mapping.tolist() == [0, 5]
      assert edge_mask.tolist() == [True, True, True, True]
  
file_path: pytorch_geometric/test/utils/test_subgraph.py
imports: import torch
  from torch_geometric.nn import GCNConv, Linear
  from torch_geometric.testing import withCUDA, withPackage
  from torch_geometric.utils import bipartite_subgraph, get_num_hops, index_to_mask, k_hop_subgraph, subgraph
label_desc: Use image node_id 6 for calling a global function with example usage: test_k_hop_subgraph() without return types