class_docstr: BA-COMMUNITY dataset from `GNNExplainer: Generating Explanations for Graph Neural Networks
  <https://arxiv.org/abs/1903.03894>`__
  
  This is a synthetic dataset for node classification. It is generated by performing the
  following steps in order.
  
  - Construct a base Barabási–Albert (BA) graph.
  - Construct a set of five-node house-structured network motifs.
  - Attach the motifs to randomly selected nodes of the base graph.
  - Perturb the graph by adding random edges.
  - Nodes are assigned to 4 classes. Nodes of label 0 belong to the base BA graph. Nodes of
    label 1, 2, 3 are separately at the middle, bottom, or top of houses.
  - Generate normally distributed features of length 10
  - Repeat the above steps to generate another graph. Its nodes are assigned to class
    4, 5, 6, 7. Its node features are generated with a distinct normal distribution.
  - Join the two graphs by randomly adding edges between them.
  
  Parameters
  ----------
  num_base_nodes : int, optional
      Number of nodes in each base BA graph. Default: 300
  num_base_edges_per_node : int, optional
      Number of edges to attach from a new node to existing nodes in constructing a base BA
      graph. Default: 4
  num_motifs : int, optional
      Number of house-structured network motifs to use in constructing each graph. Default: 80
  perturb_ratio : float, optional
      Number of random edges to add to a graph in perturbation divided by the number of original
      edges in it. Default: 0.01
  num_inter_edges : int, optional
      Number of random edges to add between the two graphs. Default: 350
  seed : integer, random_state, or None, optional
      Indicator of random number generation state. Default: None
  raw_dir : str, optional
      Raw file directory to store the processed data. Default: ~/.dgl/
  force_reload : bool, optional
      Whether to always generate the data from scratch rather than load a cached version.
      Default: False
  verbose : bool, optional
      Whether to print progress information. Default: True
  transform : callable, optional
      A transform that takes in a :class:`~dgl.DGLGraph` object and returns
      a transformed version. The :class:`~dgl.DGLGraph` object will be
      transformed before every access. Default: None
  
  Attributes
  ----------
  num_classes : int
      Number of node classes
  
  Examples
  --------
  
  >>> from dgl.data import BACommunityDataset
  >>> dataset = BACommunityDataset()
  >>> dataset.num_classes
  8
  >>> g = dataset[0]
  >>> label = g.ndata['label']
  >>> feat = g.ndata['feat']
class_docstr_tok: ["BA-COMMUNITY","dataset","from","`","GNNExplainer",":","Generating","Explanations","for","Graph","Neural","Networks","<","https",":","\/\/arxiv.org\/abs\/1903.03894",">","`","__","This","is","a","synthetic","dataset","for","node","classification",".","It","is","generated","by","performing","the","following","steps","in","order",".","-","Construct","a","base","Barab\u00e1si\u2013Albert","(","BA",")","graph",".","-","Construct","a","set","of","five-node","house-structured","network","motifs",".","-","Attach","the","motifs","to","randomly","selected","nodes","of","the","base","graph",".","-","Perturb","the","graph","by","adding","random","edges",".","-","Nodes","are","assigned","to","4","classes",".","Nodes","of","label","0","belong","to","the","base","BA","graph",".","Nodes","of","label","1",",","2",",","3","are","separately","at","the","middle",",","bottom",",","or","top","of","houses",".","-","Generate","normally","distributed","features","of","length","10","-","Repeat","the","above","steps","to","generate","another","graph",".","Its","nodes","are","assigned","to","class","4",",","5",",","6",",","7",".","Its","node","features","are","generated","with","a","distinct","normal","distribution",".","-","Join","the","two","graphs","by","randomly","adding","edges","between","them",".","Parameters","--","--","--","--","--","num_base_nodes",":","int",",","optional","Number","of","nodes","in","each","base","BA","graph",".","Default",":","300","num_base_edges_per_node",":","int",",","optional","Number","of","edges","to","attach","from","a","new","node","to","existing","nodes","in","constructing","a","base","BA","graph",".","Default",":","4","num_motifs",":","int",",","optional","Number","of","house-structured","network","motifs","to","use","in","constructing","each","graph",".","Default",":","80","perturb_ratio",":","float",",","optional","Number","of","random","edges","to","add","to","a","graph","in","perturbation","divided","by","the","number","of","original","edges","in","it",".","Default",":","0.01","num_inter_edges",":","int",",","optional","Number","of","random","edges","to","add","between","the","two","graphs",".","Default",":","350","seed",":","integer",",","random_state",",","or","None",",","optional","Indicator","of","random","number","generation","state",".","Default",":","None","raw_dir",":","str",",","optional","Raw","file","directory","to","store","the","processed","data",".","Default",":","~\/.dgl\/","force_reload",":","bool",",","optional","Whether","to","always","generate","the","data","from","scratch","rather","than","load","a","cached","version",".","Default",":","False","verbose",":","bool",",","optional","Whether","to","print","progress","information",".","Default",":","True","transform",":","callable",",","optional","A","transform","that","takes","in","a",":","class",":","`","~dgl.DGLGraph","`","object","and","returns","a","transformed","version",".","The",":","class",":","`","~dgl.DGLGraph","`","object","will","be","transformed","before","every","access",".","Default",":","None","Attributes","--","--","--","--","--","num_classes",":","int","Number","of","node","classes","Examples","--","--","--","--",">",">",">","from","dgl.data","import","BACommunityDataset",">",">",">","dataset","=","BACommunityDataset","(",")",">",">",">","dataset.num_classes","8",">",">",">","g","=","dataset","[","0","]",">",">",">","label","=","g.ndata","[","'label","'","]",">",">",">","feat","=","g.ndata","[","'feat","'","]"]
code: def has_cache(self):
      return os.path.exists(self.graph_path)
  
imports: import math
  import os
  import pickle
  import random
  import networkx
  import numpy
  from ..None import backend
  from ..batch import batch
  from ..convert import graph
  from ..transforms import reorder_graph
  from .dgl_dataset import DGLBuiltinDataset
  from .utils import _get_dgl_url, download, load_graphs, save_graphs
label_desc: Use image node_id 5 for calling the BACommunityDataset obj's underlying member method code with example usage: obj.has_cache() and returns: os