code: def create_graph(num_part, dist_graph_path, hetero):
      if not hetero:
          g = dgl.rand_graph(10000, 42000)
          g.ndata["feat"] = F.unsqueeze(F.arange(0, g.num_nodes()), 1)
          g.edata["feat"] = F.unsqueeze(F.arange(0, g.num_edges()), 1)
          g.ndata["in_degrees"] = g.in_degrees()
          g.ndata["out_degrees"] = g.out_degrees()
  
          etype = g.etypes[0]
          ntype = g.ntypes[0]
          edge_u, edge_v = g.find_edges(F.arange(0, g.num_edges(etype)))
          g.edges[etype].data["edge_u"] = edge_u
          g.edges[etype].data["edge_v"] = edge_v
  
          orig_nid, orig_eid = partition_graph(
              g,
              graph_name,
              num_part,
              dist_graph_path,
              return_mapping=True,
          )
  
          orig_nid_f = os.path.join(
              dist_graph_path, f"orig_nid_array_{ntype}.npy"
          )
          np.save(orig_nid_f, orig_nid.numpy())
          orig_eid_f = os.path.join(
              dist_graph_path, f"orig_eid_array_{etype}.npy"
          )
          np.save(orig_eid_f, orig_eid.numpy())
  
      else:
          from scipy import sparse as spsp
  
          num_nodes = {"n1": 10000, "n2": 10010, "n3": 10020}
          etypes = [
              ("n1", "r1", "n2"),
              ("n1", "r2", "n3"),
              ("n2", "r3", "n3"),
          ]
          edges = {}
          for etype in etypes:
              src_ntype, _, dst_ntype = etype
              arr = spsp.random(
                  num_nodes[src_ntype],
                  num_nodes[dst_ntype],
                  density=0.001,
                  format="coo",
                  random_state=100,
              )
              edges[etype] = (arr.row, arr.col)
          g = dgl.heterograph(edges, num_nodes)
  
          g.nodes["n1"].data["feat"] = F.unsqueeze(
              F.arange(0, g.num_nodes("n1")), 1
          )
          g.edges["r1"].data["feat"] = F.unsqueeze(
              F.arange(0, g.num_edges("r1")), 1
          )
  
          for _, etype, _ in etypes:
              edge_u, edge_v = g.find_edges(
                  F.arange(0, g.num_edges(etype)), etype=etype
              )
              g.edges[etype].data["edge_u"] = edge_u
              g.edges[etype].data["edge_v"] = edge_v
  
          orig_nid, orig_eid = partition_graph(
              g,
              graph_name,
              num_part,
              dist_graph_path,
              return_mapping=True,
          )
  
          for n_type, tensor in orig_nid.items():
              orig_nid_f = os.path.join(
                  dist_graph_path, f"orig_nid_array_{n_type}.npy"
              )
              np.save(orig_nid_f, tensor.numpy())
          for e_type, tensor in orig_eid.items():
              orig_eid_f = os.path.join(
                  dist_graph_path, f"orig_eid_array_{e_type}.npy"
              )
              np.save(orig_eid_f, tensor.numpy())
  
file_path: dgl/tests/dist/test_dist_objects.py
imports: import multiprocessing
  import os
  import shutil
  import subprocess
  import unittest
  import dgl
  import dgl.backend
  import numpy
  import pytest
  import utils
  from dgl.distributed import partition_graph
label_desc: Use image node_id 1 for calling a global function with example usage: create_graph(num_part, dist_graph_path, hetero) without return types