code: def _test_construct_graphs_hetero():
      from dgl.data.csv_dataset_base import (
          DGLGraphConstructor,
          EdgeData,
          NodeData,
      )
  
      # node_id/src_id/dst_id could be non-sorted, duplicated, non-numeric.
      num_nodes = 100
      num_edges = 1000
      num_dims = 3
      ntypes = ["user", "item"]
      node_data = []
      node_ids_dict = {}
      ndata_dict = {}
      for ntype in ntypes:
          node_ids = np.random.choice(
              np.arange(num_nodes * 2), size=num_nodes, replace=False
          )
          assert len(node_ids) == num_nodes
          # to be non-sorted
          np.random.shuffle(node_ids)
          # to be non-numeric
          node_ids = ["id_{}".format(id) for id in node_ids]
          t_ndata = {
              "feat": np.random.rand(num_nodes, num_dims),
              "label": np.random.randint(2, size=num_nodes),
          }
          _, u_indices = np.unique(node_ids, return_index=True)
          ndata = {
              "feat": t_ndata["feat"][u_indices],
              "label": t_ndata["label"][u_indices],
          }
          node_data.append(NodeData(node_ids, t_ndata, type=ntype))
          node_ids_dict[ntype] = node_ids
          ndata_dict[ntype] = ndata
      etypes = [("user", "follow", "user"), ("user", "like", "item")]
      edge_data = []
      edata_dict = {}
      for src_type, e_type, dst_type in etypes:
          src_ids = np.random.choice(
              node_ids_dict[src_type], size=num_edges
          )
          dst_ids = np.random.choice(
              node_ids_dict[dst_type], size=num_edges
          )
          edata = {
              "feat": np.random.rand(num_edges, num_dims),
              "label": np.random.randint(2, size=num_edges),
          }
          edge_data.append(
              EdgeData(
                  src_ids,
                  dst_ids,
                  edata,
                  type=(src_type, e_type, dst_type),
              )
          )
          edata_dict[(src_type, e_type, dst_type)] = edata
      graphs, data_dict = DGLGraphConstructor.construct_graphs(
          node_data, edge_data
      )
      assert len(graphs) == 1
      assert len(data_dict) == 0
      g = graphs[0]
      assert not g.is_homogeneous
      assert g.num_nodes() == num_nodes * len(ntypes)
      assert g.num_edges() == num_edges * len(etypes)
  
      def assert_data(lhs, rhs):
          for key, value in lhs.items():
              assert key in rhs
              assert F.dtype(rhs[key]) != F.float64
              assert F.array_equal(
                  F.tensor(value, dtype=F.dtype(rhs[key])), rhs[key]
              )
  
      for ntype in g.ntypes:
          assert g.num_nodes(ntype) == num_nodes
          assert_data(ndata_dict[ntype], g.nodes[ntype].data)
      for etype in g.canonical_etypes:
          assert g.num_edges(etype) == num_edges
          assert_data(edata_dict[etype], g.edges[etype].data)
  
imports: import gzip
  import io
  import os
  import tarfile
  import tempfile
  import unittest
  import warnings
  import backend
  import dgl
  import dgl.data
  import numpy
  import pandas
  import pytest
  import yaml
  from dgl import DGLError
label_desc: Use image node_id 18 for calling a global function with example usage: _test_construct_graphs_hetero() without return types