code: def _test_construct_graphs_multiple():
      from dgl.data.csv_dataset_base import (
          DGLGraphConstructor,
          EdgeData,
          GraphData,
          NodeData,
      )
  
      num_nodes = 100
      num_edges = 1000
      num_graphs = 10
      num_dims = 3
      node_ids = np.array([], dtype=int)
      src_ids = np.array([], dtype=int)
      dst_ids = np.array([], dtype=int)
      ngraph_ids = np.array([], dtype=int)
      egraph_ids = np.array([], dtype=int)
      u_indices = np.array([], dtype=int)
      for i in range(num_graphs):
          l_node_ids = np.random.choice(
              np.arange(num_nodes * 2), size=num_nodes, replace=False
          )
          node_ids = np.append(node_ids, l_node_ids)
          _, l_u_indices = np.unique(l_node_ids, return_index=True)
          u_indices = np.append(u_indices, l_u_indices)
          ngraph_ids = np.append(ngraph_ids, np.full(num_nodes, i))
          src_ids = np.append(
              src_ids, np.random.choice(l_node_ids, size=num_edges)
          )
          dst_ids = np.append(
              dst_ids, np.random.choice(l_node_ids, size=num_edges)
          )
          egraph_ids = np.append(egraph_ids, np.full(num_edges, i))
      ndata = {
          "feat": np.random.rand(num_nodes * num_graphs, num_dims),
          "label": np.random.randint(2, size=num_nodes * num_graphs),
      }
      ngraph_ids = ["graph_{}".format(id) for id in ngraph_ids]
      node_data = NodeData(node_ids, ndata, graph_id=ngraph_ids)
      egraph_ids = ["graph_{}".format(id) for id in egraph_ids]
      edata = {
          "feat": np.random.rand(num_edges * num_graphs, num_dims),
          "label": np.random.randint(2, size=num_edges * num_graphs),
      }
      edge_data = EdgeData(src_ids, dst_ids, edata, graph_id=egraph_ids)
      gdata = {
          "feat": np.random.rand(num_graphs, num_dims),
          "label": np.random.randint(2, size=num_graphs),
      }
      graph_ids = [
          "graph_{}".format(id) for id in np.arange(num_graphs)
      ]
      graph_data = GraphData(graph_ids, gdata)
      graphs, data_dict = DGLGraphConstructor.construct_graphs(
          node_data, edge_data, graph_data
      )
      assert len(graphs) == num_graphs
      assert len(data_dict) == len(gdata)
      for k, v in data_dict.items():
          assert F.dtype(v) != F.float64
          assert F.array_equal(
              F.reshape(
                  F.tensor(gdata[k], dtype=F.dtype(v)),
                  (len(graphs), -1),
              ),
              v,
          )
      for i, g in enumerate(graphs):
          assert g.is_homogeneous
          assert g.num_nodes() == num_nodes
          assert g.num_edges() == num_edges
  
          def assert_data(lhs, rhs, size, node=False):
              for key, value in lhs.items():
                  assert key in rhs
                  value = value[i * size : (i + 1) * size]
                  if node:
                      indices = u_indices[i * size : (i + 1) * size]
                      value = value[indices]
                  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, num_nodes, node=True)
          assert_data(edata, g.edata, num_edges)
  
      # Graph IDs found in node/edge CSV but not in graph CSV
      graph_data = GraphData(np.arange(num_graphs - 2), {})
      expect_except = False
      try:
          _, _ = DGLGraphConstructor.construct_graphs(
              node_data, edge_data, graph_data
          )
      except:
          expect_except = True
      assert expect_except
  
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 19 for calling a global function with example usage: _test_construct_graphs_multiple() without return types