class_docstr: A plain python object modeling a list of :class:`deepsnap.graph.Graph` 
  objects with various (optional) attributes.
  
  Args:
      graphs (list, optional): A list of :class:`deepsnap.graph.Graph`.
      task (str): The task that this :class:`GraphDataset` is used for
          (task = `node` or `edge` or `link_pred` or `graph`).
      custom_split_graphs (list): A list of 2 (train and val)
          or 3 (train, val and test) lists of splitted graphs, used in
          custom split of the `graph` task.
      edge_negative_sampling_ratio (float): The number of negative
          samples compared to that of positive edges. Default value 
          is 1.
      edge_message_ratio (float): The number of message passing edges
          compared to that of training supervision edges. Default value 
          is 0.8.
      edge_train_mode (str): Use `all` or `disjoint`. In `all` 
          mode, training supervision edges are same with the message 
          passing edges. In `disjoint` mode, training supervision 
          objectives are different from the message passing edges. 
          The difference between these two modes please see 
          the `DeepSNAP link prediction Colab <https://colab.research.
          google.com/drive/1ycdlJuse7l2De7wi51lFd_nCuaWgVABc?
          usp=sharing>`_.
      edge_split_mode (str): Use `exact` or `approximate`. This mode is 
          designed for the heterogeneous graph. If the mode is `exact`, 
          split the heterogeneous graph according to both the ratio
          and the split type. If the mode is `approximate`, split the 
          heterogeneous graph regardless of the split type.
      minimum_node_per_graph (int): If the number of nodes of a graph
          is smaller than the minimum node per graph, that graph will 
          be filtered out.
      generator (:class:`Generator`): The dataset will be on-the-fly 
          generated. The on-the-fly generator will be used, if the 
          :obj:`self.graphs` is empty or `None`, and the generator 
          (:class:`Generator`) is provided with an overwritten 
          :meth:`generate` method.
      resample_negatives (bool): Whether to resample negative edges in
          each iteration of the `link_pred` task. User needs to set this
          variable in the case of tensor backend for the custom split.
      resample_disjoint (bool): Whether to resample disjoint training 
          edges in the `disjonint` `link_pred` task.
      resample_disjoint_period (int): The number of iterations after
          which the training edges in the `disjoint` mode are resampled.
      negative_label_val (int, optional): The value of negative edges 
          generated in link_pred task. User needs to set this variable 
          in the case of tensor backend custom split.
      netlib (types.ModuleType, optional): The graph backend module. 
          Currently DeepSNAP supports the NetworkX and SnapX (for 
          SnapX only the undirected homogeneous graph) as the graph 
          backend. Default graph backend is the NetworkX.
class_docstr_tok: ["A","plain","python","object","modeling","a","list","of",":","class",":","`","deepsnap.graph.Graph","`","objects","with","various","(","optional",")","attributes",".","Args",":","graphs","(","list",",","optional",")",":","A","list","of",":","class",":","`","deepsnap.graph.Graph","`",".","task","(","str",")",":","The","task","that","this",":","class",":","`","GraphDataset","`","is","used","for","(","task","=","`","node","`","or","`","edge","`","or","`","link_pred","`","or","`","graph","`",")",".","custom_split_graphs","(","list",")",":","A","list","of","2","(","train","and","val",")","or","3","(","train",",","val","and","test",")","lists","of","splitted","graphs",",","used","in","custom","split","of","the","`","graph","`","task",".","edge_negative_sampling_ratio","(","float",")",":","The","number","of","negative","samples","compared","to","that","of","positive","edges",".","Default","value","is","1.","edge_message_ratio","(","float",")",":","The","number","of","message","passing","edges","compared","to","that","of","training","supervision","edges",".","Default","value","is","0.8.","edge_train_mode","(","str",")",":","Use","`","all","`","or","`","disjoint","`",".","In","`","all","`","mode",",","training","supervision","edges","are","same","with","the","message","passing","edges",".","In","`","disjoint","`","mode",",","training","supervision","objectives","are","different","from","the","message","passing","edges",".","The","difference","between","these","two","modes","please","see","the","`","DeepSNAP","link","prediction","Colab","<","https",":","\/\/colab.research",".","google.com\/drive\/1ycdlJuse7l2De7wi51lFd_nCuaWgVABc","?","usp=sharing",">","`","_",".","edge_split_mode","(","str",")",":","Use","`","exact","`","or","`","approximate","`",".","This","mode","is","designed","for","the","heterogeneous","graph",".","If","the","mode","is","`","exact","`",",","split","the","heterogeneous","graph","according","to","both","the","ratio","and","the","split","type",".","If","the","mode","is","`","approximate","`",",","split","the","heterogeneous","graph","regardless","of","the","split","type",".","minimum_node_per_graph","(","int",")",":","If","the","number","of","nodes","of","a","graph","is","smaller","than","the","minimum","node","per","graph",",","that","graph","will","be","filtered","out",".","generator","(",":","class",":","`","Generator","`",")",":","The","dataset","will","be","on-the-fly","generated",".","The","on-the-fly","generator","will","be","used",",","if","the",":","obj",":","`","self.graphs","`","is","empty","or","`","None","`",",","and","the","generator","(",":","class",":","`","Generator","`",")","is","provided","with","an","overwritten",":","meth",":","`","generate","`","method",".","resample_negatives","(","bool",")",":","Whether","to","resample","negative","edges","in","each","iteration","of","the","`","link_pred","`","task",".","User","needs","to","set","this","variable","in","the","case","of","tensor","backend","for","the","custom","split",".","resample_disjoint","(","bool",")",":","Whether","to","resample","disjoint","training","edges","in","the","`","disjonint","`","`","link_pred","`","task",".","resample_disjoint_period","(","int",")",":","The","number","of","iterations","after","which","the","training","edges","in","the","`","disjoint","`","mode","are","resampled",".","negative_label_val","(","int",",","optional",")",":","The","value","of","negative","edges","generated","in","link_pred","task",".","User","needs","to","set","this","variable","in","the","case","of","tensor","backend","custom","split",".","netlib","(","types.ModuleType",",","optional",")",":","The","graph","backend","module",".","Currently","DeepSNAP","supports","the","NetworkX","and","SnapX","(","for","SnapX","only","the","undirected","homogeneous","graph",")","as","the","graph","backend",".","Default","graph","backend","is","the","NetworkX","."]
docstr: Split the dataset assuming training process is inductive.
  
  Args:
      split_ratio: number of data splitted into train, validation
          (and test) set.
  
  Returns:
      List[Graph]: a list of 3 (2) lists of graph object corresponding
      to train, validation (and test) set.
docstr_tok: ["Split","the","dataset","assuming","training","process","is","inductive",".","Args",":","split_ratio",":","number","of","data","splitted","into","train",",","validation","(","and","test",")","set",".","Returns",":","List","[","Graph","]",":","a","list","of","3","(","2",")","lists","of","graph","object","corresponding","to","train",",","validation","(","and","test",")","set","."]
code: def _split_inductive(
      self,
      split_ratio: List[float],
      split_types: List[str] = None,
      shuffle: bool = True,
  ) -> List[Graph]:
      r"""
      Split the dataset assuming training process is inductive.
  
      Args:
          split_ratio: number of data splitted into train, validation
              (and test) set.
  
      Returns:
          List[Graph]: a list of 3 (2) lists of graph object corresponding
          to train, validation (and test) set.
      """
      if self.general_splits_mode == "custom":
          split_graphs = self.custom_split_graphs
      elif self.general_splits_mode == "random":
          num_graphs = len(self.graphs)
          if num_graphs < len(split_ratio):
              raise ValueError(
                  "in _split_inductive num of graphs are smaller than the "
                  "number of splitted parts"
              )
  
          if shuffle:
              self._shuffle()
          # a list of num_splits list of graphs
          # (e.g. [train graphs, val graphs, test graphs])
          split_graphs = []
  
          # If the `default split` policy would result in empty splited
          # graphs, `secure split` policy would be used instead
          split_empty_flag = False
  
          split_offset = 0
          # perform `default split`
          for i, split_ratio_i in enumerate(split_ratio):
              if i != len(split_ratio) - 1:
                  num_split_i = int(split_ratio_i * num_graphs)
                  graphs_split_i = self.graphs[
                      split_offset : split_offset + num_split_i
                  ]
                  split_offset += num_split_i
              else:
                  graphs_split_i = self.graphs[split_offset:]
              if len(graphs_split_i) == 0:
                  split_empty_flag = True
                  split_offset = 0
                  split_graphs = []
                  break
              split_graphs.append(graphs_split_i)
  
          if split_empty_flag:
              # perform `secure split` s.t. guarantees all splitted graph
              # list contains at least one graph.
              for i, split_ratio_i in enumerate(split_ratio):
                  if i != len(split_ratio) - 1:
                      num_split_i = 1 + int(
                          split_ratio_i
                          * (num_graphs - len(split_ratio))
                      )
                      graphs_split_i = self.graphs[
                          split_offset : split_offset + num_split_i
                      ]
                      split_offset += num_split_i
                  else:
                      graphs_split_i = self.graphs[split_offset:]
                  split_graphs.append(graphs_split_i)
  
      # create objectives for link_pred task
      if self.task == "link_pred":
          # if disjoint, this will split all graph's edges into 2:
          # message passing and objective edges
          # which is returned by the [1] of the split graphs
          if self.edge_train_mode == "disjoint":
              split_start = 0
          # in all mode, train graph has all edges used for both
          # message passing and objective.
          elif self.edge_train_mode == "all":
              split_start = 1
          for i in range(split_start, len(split_graphs)):
              for j in range(len(split_graphs[i])):
                  graph_temp = split_graphs[i][j]
                  if isinstance(graph_temp, Graph):
                      # store the original edge_label
                      graph_edge_label = None
                      if (
                          self.resample_disjoint
                          and (i == 0)
                          and hasattr(graph_temp, "edge_label")
                      ):
                          graph_edge_label = graph_temp.edge_label
  
                      if isinstance(graph_temp, HeteroGraph):
                          graph_temp = graph_temp.split_link_pred(
                              split_types,
                              self.edge_message_ratio,
                              self.edge_split_mode,
                          )[1]
                      else:
                          graph_temp = graph_temp.split_link_pred(
                              self.edge_message_ratio
                          )[1]
  
                      # save the original edge_label
                      if graph_edge_label is not None:
                          graph_temp._edge_label = copy.deepcopy(
                              graph_edge_label
                          )
                      else:
                          graph_temp._edge_label = None
  
                      # set is_train flag
                      if i == 0:
                          graph_temp._is_train = True
  
                      split_graphs[i][j] = graph_temp
                  else:
                      raise TypeError(
                          "element in self.graphs of unexpected type."
                      )
  
      # list of num_splits datasets
      dataset_return = []
      for graphs in split_graphs:
          dataset_current = copy.copy(self)
          dataset_current.graphs = graphs
          if self.task == "link_pred":
              for graph_temp in dataset_current.graphs:
                  if isinstance(graph_temp, Graph):
                      if isinstance(graph_temp, HeteroGraph):
                          graph_temp._create_neg_sampling(
                              negative_sampling_ratio=(
                                  self.edge_negative_sampling_ratio
                              ),
                              split_types=split_types,
                          )
                      else:
                          graph_temp._create_neg_sampling(
                              self.edge_negative_sampling_ratio
                          )
                  else:
                      raise TypeError(
                          "element in self.graphs of unexpected type"
                      )
          dataset_return.append(dataset_current)
  
      # resample negatives for train split (only for link prediction)
      dataset_return[0].resample_negatives = True
  
      return dataset_return
  
imports: import copy
  import math
  import types
  import random
  import networkx
  import numpy
  import torch
  import deepsnap
  from deepsnap.graph import Graph
  from deepsnap.hetero_graph import HeteroGraph
  import pdb
  from typing import Dict, List, Union
  import warnings
label_desc: Use image node_id 16 for calling the GraphDataset obj's underlying member method code with example usage: obj._split_inductive(split_ratio, split_types, shuffle) and returns: dataset_return