code: def verify_metadata_counts(
      part_schema, part_g, graph_schema, g, partid
  ):
      """Verify the partitioned graph objects with the metadata
  
      Parameters:
      -----------
      part_schema : json object
          which is created by reading the metadata.json file for the
          partitioned graph
      part_g : DGL graph object
          of a graph partition
      graph_schema : json object
          which is created by reading the metadata.json file for the
          original graph
      g : DGL Graph object
          created by reading the original graph from the disk.
      partid : integer
          specifying the partition id of the graph object, part_g
      """
      for ntype in part_schema[constants.STR_NTYPES]:
          ntype_data = part_schema[constants.STR_NODE_MAP][ntype]
          meta_ntype_count = (
              ntype_data[partid][1] - ntype_data[partid][0]
          )
          inner_node_mask = _get_inner_node_mask(
              part_g, g.get_ntype_id(ntype)
          )
          graph_ntype_count = len(
              part_g.ndata[dgl.NID][inner_node_mask]
          )
          assert (
              meta_ntype_count == graph_ntype_count
          ), f"Metadata ntypecount = {meta_ntype_count} and graph_ntype_count = {graph_ntype_count}"
  
      for etype in part_schema[constants.STR_ETYPES]:
          etype_data = part_schema[constants.STR_EDGE_MAP][etype]
          meta_etype_count = (
              etype_data[partid][1] - etype_data[partid][0]
          )
          mask = _get_inner_edge_mask(
              part_g, g.get_etype_id(_etype_str_to_tuple(etype))
          )
          graph_etype_count = len(part_g.edata[dgl.EID][mask])
          assert (
              meta_etype_count == graph_etype_count
          ), f"Metadata etypecount = {meta_etype_count} does not match part graph etypecount = {graph_etype_count}"
  
file_path: dgl/tools/verification_utils.py
imports: import json
  import os
  import constants
  import dgl
  import numpy
  import pyarrow
  import pyarrow.parquet
  import pytest
  import torch
  from dgl.data.utils import load_tensors
  from dgl.distributed.partition import _etype_str_to_tuple, _etype_tuple_to_str, _get_inner_edge_mask, _get_inner_node_mask, RESERVED_FIELD_DTYPE
  from distpartitioning.utils import get_idranges
label_desc: Use image node_id 5 for calling a global function with example usage: verify_metadata_counts(part_schema, part_g, graph_schema, g, partid) without return types