class_docstr: The synthetic graph classification dataset class.
  
  The datset contains 8 different types of graphs.
  
  - class 0 : cycle graph
  - class 1 : star graph
  - class 2 : wheel graph
  - class 3 : lollipop graph
  - class 4 : hypercube graph
  - class 5 : grid graph
  - class 6 : clique graph
  - class 7 : circular ladder graph
  
  Parameters
  ----------
  num_graphs: int
      Number of graphs in this dataset.
  min_num_v: int
      Minimum number of nodes for graphs
  max_num_v: int
      Maximum number of nodes for graphs
  seed: int, default is 0
      Random seed for data generation
  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.
  
  Attributes
  ----------
  num_graphs : int
      Number of graphs
  min_num_v : int
      The minimum number of nodes
  max_num_v : int
      The maximum number of nodes
  num_classes : int
      The number of classes
  
  Examples
  --------
  >>> data = MiniGCDataset(100, 16, 32, seed=0)
  
  The dataset instance is an iterable
  
  >>> len(data)
  100
  >>> g, label = data[64]
  >>> g
  Graph(num_nodes=20, num_edges=82,
        ndata_schemes={}
        edata_schemes={})
  >>> label
  tensor(5)
  
  Batch the graphs and labels for mini-batch training
  
  >>> graphs, labels = zip(*[data[i] for i in range(16)])
  >>> batched_graphs = dgl.batch(graphs)
  >>> batched_labels = torch.tensor(labels)
  >>> batched_graphs
  Graph(num_nodes=356, num_edges=1060,
        ndata_schemes={}
        edata_schemes={})
class_docstr_tok: ["The","synthetic","graph","classification","dataset","class",".","The","datset","contains","8","different","types","of","graphs",".","-","class","0",":","cycle","graph","-","class","1",":","star","graph","-","class","2",":","wheel","graph","-","class","3",":","lollipop","graph","-","class","4",":","hypercube","graph","-","class","5",":","grid","graph","-","class","6",":","clique","graph","-","class","7",":","circular","ladder","graph","Parameters","--","--","--","--","--","num_graphs",":","int","Number","of","graphs","in","this","dataset",".","min_num_v",":","int","Minimum","number","of","nodes","for","graphs","max_num_v",":","int","Maximum","number","of","nodes","for","graphs","seed",":","int",",","default","is","0","Random","seed","for","data","generation","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",".","Attributes","--","--","--","--","--","num_graphs",":","int","Number","of","graphs","min_num_v",":","int","The","minimum","number","of","nodes","max_num_v",":","int","The","maximum","number","of","nodes","num_classes",":","int","The","number","of","classes","Examples","--","--","--","--",">",">",">","data","=","MiniGCDataset","(","100",",","16",",","32",",","seed=0",")","The","dataset","instance","is","an","iterable",">",">",">","len","(","data",")","100",">",">",">","g",",","label","=","data","[","64","]",">",">",">","g","Graph","(","num_nodes=20",",","num_edges=82",",","ndata_schemes=","{","}","edata_schemes=","{","}",")",">",">",">","label","tensor","(","5",")","Batch","the","graphs","and","labels","for","mini-batch","training",">",">",">","graphs",",","labels","=","zip","(","*","[","data","[","i","]","for","i","in","range","(","16",")","]",")",">",">",">","batched_graphs","=","dgl.batch","(","graphs",")",">",">",">","batched_labels","=","torch.tensor","(","labels",")",">",">",">","batched_graphs","Graph","(","num_nodes=356",",","num_edges=1060",",","ndata_schemes=","{","}","edata_schemes=","{","}",")"]
code: def _gen_grid(self, n):
      for _ in range(n):
          num_v = np.random.randint(self.min_num_v, self.max_num_v)
          assert num_v >= 4, (
              "We require a grid graph to contain at least two "
              "rows and two columns, thus 4 nodes, got {:d} "
              "nodes".format(num_v)
          )
          n_rows = np.random.randint(2, num_v // 2)
          n_cols = num_v // n_rows
          g = nx.grid_graph([n_rows, n_cols])
          g = nx.convert_node_labels_to_integers(g)
          self.graphs.append(g)
          self.labels.append(5)
  
imports: import math
  import os
  import networkx
  import numpy
  from ..None import backend
  from ..convert import from_networkx
  from ..transforms import add_self_loop
  from .dgl_dataset import DGLDataset
  from .utils import load_graphs, makedirs, save_graphs
label_desc: Use image node_id 15 for calling the MiniGCDataset obj's underlying member method code with example usage: obj._gen_grid(n) without return types