code: def test_add_nodes(idtype):
      # homogeneous Graphs
      g = dgl.graph(([0, 1], [1, 2]), idtype=idtype, device=F.ctx())
      g.ndata["h"] = F.copy_to(
          F.tensor([1, 1, 1], dtype=idtype), ctx=F.ctx()
      )
      new_g = dgl.add_nodes(g, 1)
      assert g.num_nodes() == 3
      assert new_g.num_nodes() == 4
      assert F.array_equal(
          new_g.ndata["h"], F.tensor([1, 1, 1, 0], dtype=idtype)
      )
  
      # zero node graph
      g = dgl.graph(
          ([], []), num_nodes=3, idtype=idtype, device=F.ctx()
      )
      g.ndata["h"] = F.copy_to(
          F.tensor([1, 1, 1], dtype=idtype), ctx=F.ctx()
      )
      g = dgl.add_nodes(
          g,
          1,
          data={
              "h": F.copy_to(F.tensor([2], dtype=idtype), ctx=F.ctx())
          },
      )
      assert g.num_nodes() == 4
      assert F.array_equal(
          g.ndata["h"], F.tensor([1, 1, 1, 2], dtype=idtype)
      )
  
      # bipartite graph
      g = dgl.heterograph(
          {("user", "plays", "game"): ([0, 1], [1, 2])},
          idtype=idtype,
          device=F.ctx(),
      )
      g = dgl.add_nodes(
          g,
          2,
          data={
              "h": F.copy_to(
                  F.tensor([2, 2], dtype=idtype), ctx=F.ctx()
              )
          },
          ntype="user",
      )
      assert g.num_nodes("user") == 4
      assert g.num_nodes("game") == 3
      assert F.array_equal(
          g.nodes["user"].data["h"],
          F.tensor([0, 0, 2, 2], dtype=idtype),
      )
      g = dgl.add_nodes(g, 2, ntype="game")
      assert g.num_nodes("user") == 4
      assert g.num_nodes("game") == 5
  
      # heterogeneous graph
      g = create_test_heterograph3(idtype)
      g = dgl.add_nodes(g, 1, ntype="user")
      g = dgl.add_nodes(
          g,
          2,
          data={
              "h": F.copy_to(
                  F.tensor([2, 2], dtype=idtype), ctx=F.ctx()
              )
          },
          ntype="game",
      )
      assert g.num_nodes("user") == 4
      assert g.num_nodes("game") == 4
      assert g.num_nodes("developer") == 2
      assert F.array_equal(
          g.nodes["user"].data["h"],
          F.tensor([1, 1, 1, 0], dtype=idtype),
      )
      assert F.array_equal(
          g.nodes["game"].data["h"],
          F.tensor([2, 2, 2, 2], dtype=idtype),
      )
  
imports: import math
  import os
  import unittest
  import backend
  import dgl
  import dgl.function
  import dgl.partition
  import networkx
  import numpy
  import pytest
  from scipy import sparse
  from utils import parametrize_idtype
  from utils.graph_cases import get_cases
label_desc: Use image node_id 26 for calling a global function with example usage: test_add_nodes(idtype) without return types