class_docstr: The node-wise influence-based data loader from the
  `"Influence-Based Mini-Batching for Graph Neural Networks"
  <https://arxiv.org/abs/2212.09083>`__ paper.
  
  First, the Personalized PageRank (PPR) score for each input node is
  computed, for which the :obj:`k` nodes with the highest scores are taken
  auxiliary nodes.
  Afterwards, input nodes are merged according to their pair-wise PPR scores.
  
  Similar to :class:`~torch_geometric.loader.IBMBBatchLoader`, subgraphs are
  cached in memory for :obj:`batch_size = 1`, and collated on-the-fly
  otherwise.
  
  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.
      input_nodes (torch.Tensor): A vector containing the set of seed
          nodes.
      num_auxiliary_nodes (int): The number of auxiliary nodes per input
          node.
      num_nodes_per_batch (int): The number of seed nodes per batch.
      alpha (float, optional): The teleport probability of the PageRank
          calculation. (default: :obj:`0.2`)
      eps (float, optional): The threshold for stopping the PPR calculation
          The smaller :obj`eps` is, the more accurate are the results of
          PPR calculation, but it also takes longer.
          (default: :obj:`1e-5`)
      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","node-wise","influence-based","data","loader","from","the","`","``","Influence-Based","Mini-Batching","for","Graph","Neural","Networks","''","<","https",":","\/\/arxiv.org\/abs\/2212.09083",">","`","__","paper",".","First",",","the","Personalized","PageRank","(","PPR",")","score","for","each","input","node","is","computed",",","for","which","the",":","obj",":","`","k","`","nodes","with","the","highest","scores","are","taken","auxiliary","nodes",".","Afterwards",",","input","nodes","are","merged","according","to","their","pair-wise","PPR","scores",".","Similar","to",":","class",":","`","~torch_geometric.loader.IBMBBatchLoader","`",",","subgraphs","are","cached","in","memory","for",":","obj",":","`","batch_size","=","1","`",",","and","collated","on-the-fly","otherwise",".","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",".","input_nodes","(","torch.Tensor",")",":","A","vector","containing","the","set","of","seed","nodes",".","num_auxiliary_nodes","(","int",")",":","The","number","of","auxiliary","nodes","per","input","node",".","num_nodes_per_batch","(","int",")",":","The","number","of","seed","nodes","per","batch",".","alpha","(","float",",","optional",")",":","The","teleport","probability","of","the","PageRank","calculation",".","(","default",":",":","obj",":","`","0.2","`",")","eps","(","float",",","optional",")",":","The","threshold","for","stopping","the","PPR","calculation","The","smaller",":","obj","`","eps","`","is",",","the","more","accurate","are","the","results","of","PPR","calculation",",","but","it","also","takes","longer",".","(","default",":",":","obj",":","`","1e-5","`",")","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 __init__(
      self,
      data: Data,
      batch_order: str,
      input_nodes: torch.Tensor,
      num_auxiliary_nodes: int,
      num_nodes_per_batch: int,
      alpha: float = 0.2,
      eps: float = 1e-5,
      return_edge_index_type: str = "edge_index",
      **kwargs,
  ):
      self.subgraphs = []
      self.node_wise_out_aux_pairs = []
  
      assert is_undirected(
          data.edge_index, num_nodes=data.num_nodes
      ), "Assume the graph to be undirected"
      assert batch_order in [
          "rand",
          "sample",
          "order",
      ], f"Unsupported batch order: {batch_order}"
  
      if return_edge_index_type == "adj":
          adj = self.create_adj_from_edge_index(
              data.edge_index, data.num_nodes, normalization="rw"
          )
      else:
          adj = None
  
      self.cache_data = kwargs["batch_size"] == 1
      self._batchsize = kwargs["batch_size"]
      self.output_indices = input_nodes.numpy()
      assert return_edge_index_type in ["adj", "edge_index"]
      self.return_edge_index_type = return_edge_index_type
      self.num_auxiliary_node_per_output = num_auxiliary_nodes
      self.num_output_nodes_per_batch = num_nodes_per_batch
      self.alpha = alpha
      self.eps = eps
  
      self.create_loader(data, adj)
  
      if (
          len(self.node_wise_out_aux_pairs) > 2
      ):  # <= 2 order makes no sense
          ys = [
              data.y[out].numpy()
              for out, _ in self.node_wise_out_aux_pairs
          ]
          sampler = define_sampler(
              batch_order, ys, data.y.max().item() + 1
          )
      else:
          sampler = None
  
      if not self.cache_data:
          cached_graph = data  # need to cache the original graph
          cached_adj = adj
      else:
          cached_graph = None
          cached_adj = None
  
      super().__init__(
          self.subgraphs
          if self.cache_data
          else self.node_wise_out_aux_pairs,
          cached_graph,
          cached_adj,
          return_edge_index_type,
          sampler=sampler,
          **kwargs,
      )
  
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 1 to create a new IBMBNodeLoader object from inherited base classes: IBMBBaseLoader with example: obj = IBMBNodeLoader(data, batch_order, input_nodes, num_auxiliary_nodes, num_nodes_per_batch, alpha, eps, return_edge_index_type)