class_docstr: The citation graph dataset, including cora, citeseer and pubmeb.
  Nodes mean authors and edges mean citation relationships.
  
  Parameters
  -----------
  name: str
    name can be 'cora', 'citeseer' or 'pubmed'.
  raw_dir : str
      Raw file directory to download/contains the input data directory.
      Default: ~/.dgl/
  force_reload : bool
      Whether to reload the dataset. Default: False
  verbose : bool
      Whether to print out progress information. Default: True.
  reverse_edge : bool
      Whether to add reverse edges in graph. 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.
  reorder : bool
      Whether to reorder the graph using :func:`~dgl.reorder_graph`. Default: False.
class_docstr_tok: ["The","citation","graph","dataset",",","including","cora",",","citeseer","and","pubmeb",".","Nodes","mean","authors","and","edges","mean","citation","relationships",".","Parameters","--","--","--","--","--","-","name",":","str","name","can","be","'cora","'",",","'citeseer","'","or","'pubmed","'",".","raw_dir",":","str","Raw","file","directory","to","download\/contains","the","input","data","directory",".","Default",":","~\/.dgl\/","force_reload",":","bool","Whether","to","reload","the","dataset",".","Default",":","False","verbose",":","bool","Whether","to","print","out","progress","information",".","Default",":","True",".","reverse_edge",":","bool","Whether","to","add","reverse","edges","in","graph",".","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",".","reorder",":","bool","Whether","to","reorder","the","graph","using",":","func",":","`","~dgl.reorder_graph","`",".","Default",":","False","."]
docstr: Loads input data from data directory and reorder graph for better locality
  
  ind.name.x => the feature vectors of the training instances as scipy.sparse.csr.csr_matrix object;
  ind.name.tx => the feature vectors of the test instances as scipy.sparse.csr.csr_matrix object;
  ind.name.allx => the feature vectors of both labeled and unlabeled training instances
      (a superset of ind.name.x) as scipy.sparse.csr.csr_matrix object;
  ind.name.y => the one-hot labels of the labeled training instances as numpy.ndarray object;
  ind.name.ty => the one-hot labels of the test instances as numpy.ndarray object;
  ind.name.ally => the labels for instances in ind.name.allx as numpy.ndarray object;
  ind.name.graph => a dict in the format {index: [index_of_neighbor_nodes]} as collections.defaultdict
      object;
  ind.name.test.index => the indices of test instances in graph, for the inductive setting as list object.
code: def process(self):
      """Loads input data from data directory and reorder graph for better locality
  
      ind.name.x => the feature vectors of the training instances as scipy.sparse.csr.csr_matrix object;
      ind.name.tx => the feature vectors of the test instances as scipy.sparse.csr.csr_matrix object;
      ind.name.allx => the feature vectors of both labeled and unlabeled training instances
          (a superset of ind.name.x) as scipy.sparse.csr.csr_matrix object;
      ind.name.y => the one-hot labels of the labeled training instances as numpy.ndarray object;
      ind.name.ty => the one-hot labels of the test instances as numpy.ndarray object;
      ind.name.ally => the labels for instances in ind.name.allx as numpy.ndarray object;
      ind.name.graph => a dict in the format {index: [index_of_neighbor_nodes]} as collections.defaultdict
          object;
      ind.name.test.index => the indices of test instances in graph, for the inductive setting as list object.
      """
      root = self.raw_path
      objnames = ["x", "y", "tx", "ty", "allx", "ally", "graph"]
      objects = []
      for i in range(len(objnames)):
          with open(
              "{}/ind.{}.{}".format(root, self.name, objnames[i]), "rb"
          ) as f:
              objects.append(_pickle_load(f))
  
      x, y, tx, ty, allx, ally, graph = tuple(objects)
      test_idx_reorder = _parse_index_file(
          "{}/ind.{}.test.index".format(root, self.name)
      )
      test_idx_range = np.sort(test_idx_reorder)
  
      if self.name == "citeseer":
          # Fix citeseer dataset (there are some isolated nodes in the graph)
          # Find isolated nodes, add them as zero-vecs into the right position
          test_idx_range_full = range(
              min(test_idx_reorder), max(test_idx_reorder) + 1
          )
          tx_extended = sp.lil_matrix(
              (len(test_idx_range_full), x.shape[1])
          )
          tx_extended[test_idx_range - min(test_idx_range), :] = tx
          tx = tx_extended
          ty_extended = np.zeros((len(test_idx_range_full), y.shape[1]))
          ty_extended[test_idx_range - min(test_idx_range), :] = ty
          ty = ty_extended
  
      features = sp.vstack((allx, tx)).tolil()
      features[test_idx_reorder, :] = features[test_idx_range, :]
  
      if self.reverse_edge:
          graph = nx.DiGraph(nx.from_dict_of_lists(graph))
          g = from_networkx(graph)
      else:
          graph = nx.Graph(nx.from_dict_of_lists(graph))
          edges = list(graph.edges())
          u, v = map(list, zip(*edges))
          g = dgl_graph((u, v))
  
      onehot_labels = np.vstack((ally, ty))
      onehot_labels[test_idx_reorder, :] = onehot_labels[
          test_idx_range, :
      ]
      labels = np.argmax(onehot_labels, 1)
  
      idx_test = test_idx_range.tolist()
      idx_train = range(len(y))
      idx_val = range(len(y), len(y) + 500)
  
      train_mask = generate_mask_tensor(
          _sample_mask(idx_train, labels.shape[0])
      )
      val_mask = generate_mask_tensor(
          _sample_mask(idx_val, labels.shape[0])
      )
      test_mask = generate_mask_tensor(
          _sample_mask(idx_test, labels.shape[0])
      )
  
      g.ndata["train_mask"] = train_mask
      g.ndata["val_mask"] = val_mask
      g.ndata["test_mask"] = test_mask
      g.ndata["label"] = F.tensor(labels)
      g.ndata["feat"] = F.tensor(
          _preprocess_features(features),
          dtype=F.data_type_dict["float32"],
      )
      self._num_classes = onehot_labels.shape[1]
      self._labels = labels
      if self._reorder:
          self._g = reorder_graph(
              g,
              node_permute_algo="rcmk",
              edge_permute_algo="dst",
              store_ids=False,
          )
      else:
          self._g = g
  
      if self.verbose:
          print("Finished data loading and preprocessing.")
          print("  NumNodes: {}".format(self._g.num_nodes()))
          print("  NumEdges: {}".format(self._g.num_edges()))
          print("  NumFeats: {}".format(self._g.ndata["feat"].shape[1]))
          print("  NumClasses: {}".format(self.num_classes))
          print(
              "  NumTrainingSamples: {}".format(
                  F.nonzero_1d(self._g.ndata["train_mask"]).shape[0]
              )
          )
          print(
              "  NumValidationSamples: {}".format(
                  F.nonzero_1d(self._g.ndata["val_mask"]).shape[0]
              )
          )
          print(
              "  NumTestSamples: {}".format(
                  F.nonzero_1d(self._g.ndata["test_mask"]).shape[0]
              )
          )
  
imports: from __future__ import absolute_import
  import os, sys
  import pickle
  import warnings
  import networkx
  import numpy
  import scipy.sparse
  from ..None import backend, batch, convert
  from ..convert import from_networkx, graph, to_networkx
  from ..transforms import reorder_graph
  from .dgl_dataset import DGLBuiltinDataset
  from .utils import _get_dgl_url, deprecate_function, deprecate_property, generate_mask_tensor, load_graphs, load_info, makedirs, save_graphs, save_info
label_desc: Use image node_id 2 for calling the CitationGraphDataset obj's underlying member method code with example usage: obj.process() without return types