code: def test_subgraph(self):
      node_features = np.random.rand(5, 10)
      edge_index = np.array(
          [[0, 1, 2, 3, 4], [1, 2, 3, 4, 0]], dtype=np.int64
      )
      edge_features = np.random.rand(5, 3)
      graph_data = GraphData(node_features, edge_index, edge_features)
  
      nodes = [0, 1, 2, 4]
      subgraph, node_mapping = graph_data.subgraph(nodes)
  
      assert subgraph.num_nodes == len(nodes)
      assert subgraph.num_edges == 3
  
      expected_node_features = node_features[nodes]
      np.testing.assert_array_equal(
          subgraph.node_features, expected_node_features
      )
  
      expected_edge_index = np.array(
          [[0, 1, 3], [1, 2, 0]], dtype=np.int64
      )
      np.testing.assert_array_equal(
          subgraph.edge_index, expected_edge_index
      )
  
      expected_edge_features = edge_features[[0, 1, 4]]
      np.testing.assert_array_equal(
          subgraph.edge_features, expected_edge_features
      )
  
      expected_node_mapping = {0: 0, 1: 1, 2: 2, 4: 3}
      assert node_mapping == expected_node_mapping
  
file_path: deepchem/deepchem/feat/tests/test_graph_data.py
imports: import unittest
  import numpy
  import pytest
  from deepchem.feat.graph_data import BatchGraphData, GraphData, shortest_path_length
label_desc: Use image node_id 9 for calling the TestGraph obj's underlying member method code with example usage: obj.test_subgraph() without return types