code: def test_InSubgraphSampler_homo():
      """Original graph in COO:
      1   0   1   0   1   0
      1   0   0   1   0   1
      0   1   0   1   0   0
      0   1   0   0   1   0
      1   0   0   0   0   1
      0   0   1   0   1   0
      """
      indptr = torch.LongTensor([0, 3, 5, 7, 9, 12, 14])
      indices = torch.LongTensor(
          [0, 1, 4, 2, 3, 0, 5, 1, 2, 0, 3, 5, 1, 4]
      )
      graph = gb.fused_csc_sampling_graph(indptr, indices).to(F.ctx())
  
      seed_nodes = torch.LongTensor([0, 5, 3])
      item_set = gb.ItemSet(seed_nodes, names="seed_nodes")
      batch_size = 1
      item_sampler = gb.ItemSampler(
          item_set, batch_size=batch_size
      ).copy_to(F.ctx())
  
      in_subgraph_sampler = gb.InSubgraphSampler(item_sampler, graph)
  
      it = iter(in_subgraph_sampler)
  
      def original_indices(minibatch):
          sampled_subgraph = minibatch.sampled_subgraphs[0]
          _indices = sampled_subgraph.original_row_node_ids[
              sampled_subgraph.sampled_csc.indices
          ]
          return _indices
  
      mn = next(it)
      assert torch.equal(
          mn.seed_nodes, torch.LongTensor([0]).to(F.ctx())
      )
      assert torch.equal(
          mn.sampled_subgraphs[0].sampled_csc.indptr,
          torch.tensor([0, 3]).to(F.ctx()),
      )
  
      mn = next(it)
      assert torch.equal(
          mn.seed_nodes, torch.LongTensor([5]).to(F.ctx())
      )
      assert torch.equal(
          mn.sampled_subgraphs[0].sampled_csc.indptr,
          torch.tensor([0, 2]).to(F.ctx()),
      )
      assert torch.equal(
          original_indices(mn), torch.tensor([1, 4]).to(F.ctx())
      )
  
      mn = next(it)
      assert torch.equal(
          mn.seed_nodes, torch.LongTensor([3]).to(F.ctx())
      )
      assert torch.equal(
          mn.sampled_subgraphs[0].sampled_csc.indptr,
          torch.tensor([0, 2]).to(F.ctx()),
      )
      assert torch.equal(
          original_indices(mn), torch.tensor([1, 2]).to(F.ctx())
      )
  
file_path: dgl/tests/python/pytorch/graphbolt/impl/test_in_subgraph_sampler.py
imports: import unittest
  import backend
  import dgl.graphbolt
  import pytest
  import torch
  from ..None import gb_test_utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_InSubgraphSampler_homo() and returns: _indices