code: def _test_construct_graphs_homo():
      from dgl.data.csv_dataset_base import (
          DGLGraphConstructor,
          EdgeData,
          NodeData,
      )
  
      # node_id could be non-sorted, non-numeric.
      num_nodes = 100
      num_edges = 1000
      num_dims = 3
      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 = NodeData(node_ids, t_ndata)
      src_ids = np.random.choice(node_ids, size=num_edges)
      dst_ids = np.random.choice(node_ids, size=num_edges)
      edata = {
          "feat": np.random.rand(num_edges, num_dims),
          "label": np.random.randint(2, size=num_edges),
      }
      edge_data = EdgeData(src_ids, dst_ids, edata)
      graphs, data_dict = DGLGraphConstructor.construct_graphs(
          node_data, edge_data
      )
      assert len(graphs) == 1
      assert len(data_dict) == 0
      g = graphs[0]
      assert g.is_homogeneous
      assert g.num_nodes() == num_nodes
      assert g.num_edges() == num_edges
  
      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]
              )
  
      assert_data(ndata, g.ndata)
      assert_data(edata, g.edata)
  
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 17 for calling a global function with example usage: _test_construct_graphs_homo() without return types