class_docstr: The synthetic graph classification dataset used in
  `Higher-Order Explanations of Graph Neural Networks via Relevant Walks <https://arxiv.org/abs/2006.03589>`_.
  The first class in :class:`~BA_LRP` is Barabási–Albert(BA) graph which connects a new node :math:`\mathcal{V}` from
  current graph :math:`\mathcal{G}`.
  
  .. math:: p(\mathcal{V}) = \frac{Degree(\mathcal{V})}{\sum_{\mathcal{V}' \in \mathcal{G}} Degree(\mathcal{V}')}
  
  The second class in :class:`~BA_LRP` has a slightly higher growth model and nodes are selected
  without replacement with the inverse preferential attachment model.
  
  .. math:: p(\mathcal{V}) = \frac{Degree(\mathcal{V})^{-1}}{\sum_{\mathcal{V}' \in \mathcal{G}} Degree(\mathcal{V}')^{-1}}
  
  Args:
      root (:obj:`str`): Root data directory to save datasets
      num_per_class (:obj:`int`): The number of the graphs for each class.
      transform (:obj:`Callable`, :obj:`None`): A function/transform that takes in an
          :class:`torch_geometric.data.Data` object and returns a transformed
          version. The data object will be transformed before every access.
          (default: :obj:`None`)
      pre_transform (:obj:`Callable`, :obj:`None`):  A function/transform that takes in
          an :class:`torch_geometric.data.Data` object and returns a
          transformed version. The data object will be transformed before
          being saved to disk. (default: :obj:`None`)
  
  .. note:: :class:`~BA_LRP` will automatically generate the dataset
    if the dataset file is not existed in the root directory.
  
  Example:
      >>> dataset = BA_LRP(root='./datasets')
      >>> loader = Dataloader(dataset, batch_size=32)
      >>> data = next(iter(loader))
      # Batch(batch=[640], edge_index=[2, 1344], x=[640, 1], y=[32, 1])
  
  Where the attributes of data indices:
  
  - :obj:`batch`: The assignment vector mapping each node to its graph index
  - :obj:`x`: The node features
  - :obj:`edge_index`: The edge matrix
  - :obj:`y`: The graph label
class_docstr_tok: ["The","synthetic","graph","classification","dataset","used","in","`","Higher-Order","Explanations","of","Graph","Neural","Networks","via","Relevant","Walks","<","https",":","\/\/arxiv.org\/abs\/2006.03589",">","`","_",".","The","first","class","in",":","class",":","`","~BA_LRP","`","is","Barab\u00e1si\u2013Albert","(","BA",")","graph","which","connects","a","new","node",":","math",":","`","\\mathcal","{","V","}","`","from","current","graph",":","math",":","`","\\mathcal","{","G","}","`",".","..","math",":",":","p","(","\\mathcal","{","V","}",")","=","\\frac","{","Degree","(","\\mathcal","{","V","}",")","}","{","\\sum_","{","\\mathcal","{","V","}","'","\\in","\\mathcal","{","G","}","}","Degree","(","\\mathcal","{","V","}","'",")","}","The","second","class","in",":","class",":","`","~BA_LRP","`","has","a","slightly","higher","growth","model","and","nodes","are","selected","without","replacement","with","the","inverse","preferential","attachment","model",".","..","math",":",":","p","(","\\mathcal","{","V","}",")","=","\\frac","{","Degree","(","\\mathcal","{","V","}",")","^","{","-1","}","}","{","\\sum_","{","\\mathcal","{","V","}","'","\\in","\\mathcal","{","G","}","}","Degree","(","\\mathcal","{","V","}","'",")","^","{","-1","}","}","Args",":","root","(",":","obj",":","`","str","`",")",":","Root","data","directory","to","save","datasets","num_per_class","(",":","obj",":","`","int","`",")",":","The","number","of","the","graphs","for","each","class",".","transform","(",":","obj",":","`","Callable","`",",",":","obj",":","`","None","`",")",":","A","function\/transform","that","takes","in","an",":","class",":","`","torch_geometric.data.Data","`","object","and","returns","a","transformed","version",".","The","data","object","will","be","transformed","before","every","access",".","(","default",":",":","obj",":","`","None","`",")","pre_transform","(",":","obj",":","`","Callable","`",",",":","obj",":","`","None","`",")",":","A","function\/transform","that","takes","in","an",":","class",":","`","torch_geometric.data.Data","`","object","and","returns","a","transformed","version",".","The","data","object","will","be","transformed","before","being","saved","to","disk",".","(","default",":",":","obj",":","`","None","`",")","..","note",":",":",":","class",":","`","~BA_LRP","`","will","automatically","generate","the","dataset","if","the","dataset","file","is","not","existed","in","the","root","directory",".","Example",":",">",">",">","dataset","=","BA_LRP","(","root='.\/datasets","'",")",">",">",">","loader","=","Dataloader","(","dataset",",","batch_size=32",")",">",">",">","data","=","next","(","iter","(","loader",")",")","#","Batch","(","batch=","[","640","]",",","edge_index=","[","2",",","1344","]",",","x=","[","640",",","1","]",",","y=","[","32",",","1","]",")","Where","the","attributes","of","data","indices",":","-",":","obj",":","`","batch","`",":","The","assignment","vector","mapping","each","node","to","its","graph","index","-",":","obj",":","`","x","`",":","The","node","features","-",":","obj",":","`","edge_index","`",":","The","edge","matrix","-",":","obj",":","`","y","`",":","The","graph","label"]
code: def process(self):
      if files_exist(self.raw_paths):
          shutil.copyfile(self.raw_paths[0], self.processed_paths[0])
          return
  
      data_list = []
      for i in tqdm.tqdm(range(self.num_per_class)):
          data_list.append(self.gen_class1())
          data_list.append(self.gen_class2())
  
      data, slices = self.collate(data_list)
      torch.save((data, slices), self.processed_paths[0])
  
imports: import os
  import torch
  import pickle
  import numpy
  import os.path
  import tqdm
  from torch_geometric.utils import dense_to_sparse
  from torch_geometric.data import Data, InMemoryDataset, download_url, extract_zip
  from torch_geometric.data.dataset import files_exist
  import shutil
label_desc: Use image node_id 9 for calling the BA_LRP obj's underlying member method code with example usage: obj.process() without return types