class_docstr: TREE-CYCLES 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 balanced binary tree as the base graph.
  - Construct a set of cycle motifs.
  - Attach the motifs to randomly selected nodes of the base graph.
  - Perturb the graph by adding random edges.
  - Generate constant feature for all nodes, which is 1.
  - Nodes in the tree belong to class 0 and nodes in cycles belong to class 1.
  
  Parameters
  ----------
  tree_height : int, optional
      Height of the balanced binary tree. Default: 8
  num_motifs : int, optional
      Number of cycle motifs to use. Default: 60
  cycle_size : int, optional
      Number of nodes in a cycle motif. Default: 6
  perturb_ratio : float, optional
      Number of random edges to add in perturbation divided by the
      number of original edges in the graph. Default: 0.01
  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 TreeCycleDataset
  >>> dataset = TreeCycleDataset()
  >>> dataset.num_classes
  2
  >>> g = dataset[0]
  >>> label = g.ndata['label']
  >>> feat = g.ndata['feat']
class_docstr_tok: ["TREE-CYCLES","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","balanced","binary","tree","as","the","base","graph",".","-","Construct","a","set","of","cycle","motifs",".","-","Attach","the","motifs","to","randomly","selected","nodes","of","the","base","graph",".","-","Perturb","the","graph","by","adding","random","edges",".","-","Generate","constant","feature","for","all","nodes",",","which","is","1",".","-","Nodes","in","the","tree","belong","to","class","0","and","nodes","in","cycles","belong","to","class","1",".","Parameters","--","--","--","--","--","tree_height",":","int",",","optional","Height","of","the","balanced","binary","tree",".","Default",":","8","num_motifs",":","int",",","optional","Number","of","cycle","motifs","to","use",".","Default",":","60","cycle_size",":","int",",","optional","Number","of","nodes","in","a","cycle","motif",".","Default",":","6","perturb_ratio",":","float",",","optional","Number","of","random","edges","to","add","in","perturbation","divided","by","the","number","of","original","edges","in","the","graph",".","Default",":","0.01","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","TreeCycleDataset",">",">",">","dataset","=","TreeCycleDataset","(",")",">",">",">","dataset.num_classes","2",">",">",">","g","=","dataset","[","0","]",">",">",">","label","=","g.ndata","[","'label","'","]",">",">",">","feat","=","g.ndata","[","'feat","'","]"]
code: def __init__(
      self,
      tree_height=8,
      num_motifs=60,
      cycle_size=6,
      perturb_ratio=0.01,
      seed=None,
      raw_dir=None,
      force_reload=False,
      verbose=True,
      transform=None,
  ):
      self.tree_height = tree_height
      self.num_motifs = num_motifs
      self.cycle_size = cycle_size
      self.perturb_ratio = perturb_ratio
      self.seed = seed
      super(TreeCycleDataset, self).__init__(
          name="TREE-CYCLES",
          url=None,
          raw_dir=raw_dir,
          force_reload=force_reload,
          verbose=verbose,
          transform=transform,
      )
  
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 1 to create a new TreeCycleDataset object from inherited base classes: DGLBuiltinDataset with example: obj = TreeCycleDataset(tree_height, num_motifs, cycle_size, perturb_ratio, seed, raw_dir, force_reload, verbose, transform)