code: def genereate_raw_data_for_hetero_dataset(
      test_dir,
      dataset_name,
      num_nodes,
      num_edges,
      num_classes,
      edge_fmt="csv",
  ):
      # Generate edges.
      edges_path = {}
      for etype, num_edge in num_edges.items():
          src_ntype, etype_str, dst_ntype = etype
          src = torch.randint(0, num_nodes[src_ntype], (num_edge,))
          dst = torch.randint(0, num_nodes[dst_ntype], (num_edge,))
          os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True)
          assert edge_fmt in ["numpy", "csv"], print(
              "only numpy and csv are supported for edges."
          )
          if edge_fmt == "csv":
              # Write into edges/edge.csv
              edges = pd.DataFrame(
                  np.stack([src, dst], axis=1), columns=["src", "dst"]
              )
              edge_path = os.path.join("edges", f"{etype_str}.csv")
              edges.to_csv(
                  os.path.join(test_dir, edge_path),
                  index=False,
                  header=False,
              )
          else:
              edges = np.stack([src, dst], axis=1).T
              edge_path = os.path.join("edges", f"{etype_str}.npy")
              np.save(os.path.join(test_dir, edge_path), edges)
          edges_path[etype_str] = edge_path
  
      # Generate node features.
      node_feats_path = {}
      os.makedirs(os.path.join(test_dir, "data"), exist_ok=True)
      for ntype, num_node in num_nodes.items():
          node_feat_path = os.path.join("data", f"{ntype}-feat.npy")
          node_feats = np.random.rand(num_node, num_classes)
          np.save(os.path.join(test_dir, node_feat_path), node_feats)
          node_feats_path[ntype] = node_feat_path
  
      # Generate edge features.
      edge_feats_path = {}
      os.makedirs(os.path.join(test_dir, "data"), exist_ok=True)
      for etype, num_edge in num_edges.items():
          src_ntype, etype_str, dst_ntype = etype
          edge_feat_path = os.path.join("data", f"{etype_str}-feat.npy")
          edge_feats = np.random.rand(num_edge, num_classes)
          np.save(os.path.join(test_dir, edge_feat_path), edge_feats)
          edge_feats_path[etype_str] = edge_feat_path
  
      # Generate train/test/valid set.
      os.makedirs(os.path.join(test_dir, "set"), exist_ok=True)
      user_ids = torch.arange(num_nodes["user"])
      np.random.shuffle(user_ids)
      num_train = int(num_nodes["user"] * 0.6)
      num_validation = int(num_nodes["user"] * 0.2)
      num_test = num_nodes["user"] - num_train - num_validation
      train_path = os.path.join("set", "train.npy")
      np.save(os.path.join(test_dir, train_path), user_ids[:num_train])
      validation_path = os.path.join("set", "validation.npy")
      np.save(
          os.path.join(test_dir, validation_path),
          user_ids[num_train : num_train + num_validation],
      )
      test_path = os.path.join("set", "test.npy")
      np.save(
          os.path.join(test_dir, test_path),
          user_ids[num_train + num_validation :],
      )
  
      yaml_content = f"""
          dataset_name: {dataset_name}
          graph: # graph structure and required attributes.
            nodes:
              - type: user
                num: {num_nodes["user"]}
              - type: item
                num: {num_nodes["item"]}
            edges:
              - type: "user:follow:user"
                format: {edge_fmt}
                path: {edges_path["follow"]}
              - type: "user:click:item"
                format: {edge_fmt}
                path: {edges_path["click"]}
            feature_data:
              - domain: node
                type: user
                name: feat
                format: numpy
                in_memory: true
                path: {node_feats_path["user"]}
              - domain: node
                type: item
                name: feat
                format: numpy
                in_memory: true
                path: {node_feats_path["item"]}
              - domain: edge
                type: "user:follow:user"
                name: feat
                format: numpy
                in_memory: true
                path: {edge_feats_path["follow"]}
              - domain: edge
                type: "user:click:item"
                name: feat
                format: numpy
                in_memory: true
                path: {edge_feats_path["click"]}
          feature_data:
            - domain: node
              type: user
              name: feat
              format: numpy
              in_memory: true
              path: {node_feats_path["user"]}
            - domain: node
              type: item
              name: feat
              format: numpy
              in_memory: true
              path: {node_feats_path["item"]}
          tasks:
            - name: node_classification
              num_classes: {num_classes}
              train_set:
                - type: user
                  data:
                    - name: seed_nodes
                      format: numpy
                      in_memory: true
                      path: {train_path}
              validation_set:
                - type: user
                  data:
                    - name: seed_nodes
                      format: numpy
                      in_memory: true
                      path: {validation_path}
              test_set:
                - type: user
                  data:
                    - name: seed_nodes
                      format: numpy
                      in_memory: true
                      path: {test_path}
      """
  
      yaml_file = os.path.join(test_dir, "metadata.yaml")
      with open(yaml_file, "w") as f:
          f.write(yaml_content)
  
file_path: dgl/tests/python/pytorch/graphbolt/gb_test_utils.py
imports: import os
  import dgl
  import dgl.graphbolt
  import numpy
  import pandas
  import scipy.sparse
  import torch
label_desc: Use image node_id 7 for calling a global function with example usage: genereate_raw_data_for_hetero_dataset(test_dir, dataset_name, num_nodes, num_edges, num_classes, edge_fmt) without return types