class_docstr: The batch-wise influence-based data loader from the
  `"Influence-Based Mini-Batching for Graph Neural Networks"
  <https://arxiv.org/abs/2212.09083>`__ paper.
  
  First, the METIS graph partitioning algorithm separates the graph into
  :obj:`num_partitions` many partitions.
  Afterwards, input/seed nodes and their auxiliary nodes (found via
  topic-sensitive PageRank) are used to form a mini-batch.
  
  If :obj:`batch_size` is set to :obj:`1`, mini-batches are pre-calculated
  and cached in memory.
  Otherwise, only input nodes and their auxiliary nodes are pre-computed, and
  mini-batches are collated on-the-fly.
  
  Args:
      data (torch_geometric.data.Data): A
          :class:`~torch_geometric.data.Data` object.
      batch_order (str): A string indicating the batch order type (one of
          :obj:`"order"`, :obj:`"sample"` or :obj:`"rand"`).
          If :obj:`"order"`, calculates the pair-wise KL divergence between
          every two batches to organize an optimal order.
          If :obj:`"sample"`, samples the next batch w.r.t. the last one in
          which a batch with higher KL divergence score is more likely to be
          sampled.
          If :obj:`"rand"`, batches are generated randomly.
      num_partitions (int): The number of partitions.
      input_nodes (torch.Tensor): A vector containing the set of seed
          nodes.
      batch_expand_ratio (float, optional): The ratio between the returned
          batch size and the original partition size. For example, set it to
          :obj:`2.0` in case you would like the batch to have double the
          number of nodes as the size of its partition.
          (default: :obj:`1.0`)
      metis_input_node_weight (float, optional): The weights on the input
          nodes for METIS graph partitioning. (default: :obj:`None`)
      alpha (float, optional): The teleport probability of the PageRank
          calculation. (default: :obj:`0.2`)
      approximate_ppr_iterations (int, optional): The number of power
          iterations for PageRank calculation. (default: :obj:`50`)
      return_edge_index_type (str, optional): A string indicating the output
          type of edge indices (one of :obj:`"edge_index"` or :obj:`"adj"`).
          If set to :obj:`"adj"`, the :obj:`edge_index` of the batch will
          be a :class:`torch_sparse.SparseTensor`, otherwise a
          :class:`torch.Tensor`. (default: :obj:`"edge_index"`)
      **kwargs (optional): Additional arguments of
          :class:`torch.utils.data.DataLoader`, such as :obj:`batch_size`,
          :obj:`shuffle`, :obj:`drop_last` or :obj:`num_workers`.
class_docstr_tok: ["The","batch-wise","influence-based","data","loader","from","the","`","``","Influence-Based","Mini-Batching","for","Graph","Neural","Networks","''","<","https",":","\/\/arxiv.org\/abs\/2212.09083",">","`","__","paper",".","First",",","the","METIS","graph","partitioning","algorithm","separates","the","graph","into",":","obj",":","`","num_partitions","`","many","partitions",".","Afterwards",",","input\/seed","nodes","and","their","auxiliary","nodes","(","found","via","topic-sensitive","PageRank",")","are","used","to","form","a","mini-batch",".","If",":","obj",":","`","batch_size","`","is","set","to",":","obj",":","`","1","`",",","mini-batches","are","pre-calculated","and","cached","in","memory",".","Otherwise",",","only","input","nodes","and","their","auxiliary","nodes","are","pre-computed",",","and","mini-batches","are","collated","on-the-fly",".","Args",":","data","(","torch_geometric.data.Data",")",":","A",":","class",":","`","~torch_geometric.data.Data","`","object",".","batch_order","(","str",")",":","A","string","indicating","the","batch","order","type","(","one","of",":","obj",":","`","``","order","''","`",",",":","obj",":","`","``","sample","''","`","or",":","obj",":","`","``","rand","''","`",")",".","If",":","obj",":","`","``","order","''","`",",","calculates","the","pair-wise","KL","divergence","between","every","two","batches","to","organize","an","optimal","order",".","If",":","obj",":","`","``","sample","''","`",",","samples","the","next","batch","w.r.t",".","the","last","one","in","which","a","batch","with","higher","KL","divergence","score","is","more","likely","to","be","sampled",".","If",":","obj",":","`","``","rand","''","`",",","batches","are","generated","randomly",".","num_partitions","(","int",")",":","The","number","of","partitions",".","input_nodes","(","torch.Tensor",")",":","A","vector","containing","the","set","of","seed","nodes",".","batch_expand_ratio","(","float",",","optional",")",":","The","ratio","between","the","returned","batch","size","and","the","original","partition","size",".","For","example",",","set","it","to",":","obj",":","`","2.0","`","in","case","you","would","like","the","batch","to","have","double","the","number","of","nodes","as","the","size","of","its","partition",".","(","default",":",":","obj",":","`","1.0","`",")","metis_input_node_weight","(","float",",","optional",")",":","The","weights","on","the","input","nodes","for","METIS","graph","partitioning",".","(","default",":",":","obj",":","`","None","`",")","alpha","(","float",",","optional",")",":","The","teleport","probability","of","the","PageRank","calculation",".","(","default",":",":","obj",":","`","0.2","`",")","approximate_ppr_iterations","(","int",",","optional",")",":","The","number","of","power","iterations","for","PageRank","calculation",".","(","default",":",":","obj",":","`","50","`",")","return_edge_index_type","(","str",",","optional",")",":","A","string","indicating","the","output","type","of","edge","indices","(","one","of",":","obj",":","`","``","edge_index","''","`","or",":","obj",":","`","``","adj","''","`",")",".","If","set","to",":","obj",":","`","``","adj","''","`",",","the",":","obj",":","`","edge_index","`","of","the","batch","will","be","a",":","class",":","`","torch_sparse.SparseTensor","`",",","otherwise","a",":","class",":","`","torch.Tensor","`",".","(","default",":",":","obj",":","`","``","edge_index","''","`",")","*","*","kwargs","(","optional",")",":","Additional","arguments","of",":","class",":","`","torch.utils.data.DataLoader","`",",","such","as",":","obj",":","`","batch_size","`",",",":","obj",":","`","shuffle","`",",",":","obj",":","`","drop_last","`","or",":","obj",":","`","num_workers","`","."]
code: def create_loader(self, graph: Data, adj: SparseTensor):
      partitions = get_partitions(
          adj,
          self.num_partitions,
          self.output_indices,
          graph.num_nodes,
          self.metis_output_weight,
      )
  
      # get output - auxiliary node pairs
      topk = math.ceil(
          self.batch_expand_ratio
          * graph.num_nodes
          / self.num_partitions
      )
      batch_wise_out_aux_pairs = create_batchwise_out_aux_pairs(
          adj,
          partitions,
          self.output_indices,
          topk,
          self.num_outnodeset_per_batch,
          self.alpha,
          self.approximate_ppr_iterations,
      )
  
      indices_complete_check(
          batch_wise_out_aux_pairs, self.output_indices
      )
      self.batch_wise_out_aux_pairs = batch_wise_out_aux_pairs
  
      if self.cache_data:
          self.subgraphs = self.prepare_cache(
              graph,
              batch_wise_out_aux_pairs,
              adj,
              self.return_edge_index_type,
          )
  
imports: import logging
  import math
  from typing import Callable, Iterator, List, NamedTuple, Optional, Tuple, Union
  import numpy
  import scipy.sparse
  import torch
  from torch import Tensor
  from tqdm import tqdm
  from torch_geometric.data import Data
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import get_ppr, is_undirected, subgraph
label_desc: Use image node_id 2 for calling the IBMBBatchLoader obj's underlying member method code with example usage: obj.create_loader(graph, adj) without return types