class_docstr: A Keras-compatible data generator for node inference using ClusterGCN model.
  Use this class with the Keras methods :meth:`keras.Model.fit`,
      :meth:`keras.Model.evaluate`, and
      :meth:`keras.Model.predict`.
  
  This class should be created using the :meth:`flow` method of
  :class:`.ClusterNodeGenerator`.
  
  Args:
      graph (StellarGraph): The graph
      clusters (list): A list of lists such that each sub-list indicates the nodes in a cluster.
          The length of this list, len(clusters) indicates the number of batches in one epoch.
      targets (np.ndarray, optional): An optional array of node targets of size (N x C),
          where C is the target size (e.g., number of classes for one-hot class targets)
      node_ids (iterable, optional): The node IDs for the target nodes. Required if targets is not None.
      normalize_adj (bool, optional): Specifies whether the adjacency matrix for each mini-batch should
          be normalized or not. The default is True.
      q (int, optional): The number of subgraphs to combine for each batch. The default value is
          1 such that the generator treats each subgraph as a batch.
      lam (float, optional): The mixture coefficient for adjacency matrix normalisation (the
          'diagonal enhancement' method). Valid values are in the interval [0, 1] and the default value is 0.1.
      name (str, optional): An optional name for this generator object.
class_docstr_tok: ["A","Keras-compatible","data","generator","for","node","inference","using","ClusterGCN","model",".","Use","this","class","with","the","Keras","methods",":","meth",":","`","keras.Model.fit","`",",",":","meth",":","`","keras.Model.evaluate","`",",","and",":","meth",":","`","keras.Model.predict","`",".","This","class","should","be","created","using","the",":","meth",":","`","flow","`","method","of",":","class",":","`",".ClusterNodeGenerator","`",".","Args",":","graph","(","StellarGraph",")",":","The","graph","clusters","(","list",")",":","A","list","of","lists","such","that","each","sub-list","indicates","the","nodes","in","a","cluster",".","The","length","of","this","list",",","len","(","clusters",")","indicates","the","number","of","batches","in","one","epoch",".","targets","(","np.ndarray",",","optional",")",":","An","optional","array","of","node","targets","of","size","(","N","x","C",")",",","where","C","is","the","target","size","(","e.g.",",","number","of","classes","for","one-hot","class","targets",")","node_ids","(","iterable",",","optional",")",":","The","node","IDs","for","the","target","nodes",".","Required","if","targets","is","not","None",".","normalize_adj","(","bool",",","optional",")",":","Specifies","whether","the","adjacency","matrix","for","each","mini-batch","should","be","normalized","or","not",".","The","default","is","True",".","q","(","int",",","optional",")",":","The","number","of","subgraphs","to","combine","for","each","batch",".","The","default","value","is","1","such","that","the","generator","treats","each","subgraph","as","a","batch",".","lam","(","float",",","optional",")",":","The","mixture","coefficient","for","adjacency","matrix","normalisation","(","the","'diagonal","enhancement","'","method",")",".","Valid","values","are","in","the","interval","[","0",",","1","]","and","the","default","value","is","0.1.","name","(","str",",","optional",")",":","An","optional","name","for","this","generator","object","."]
code: def __init__(
      self,
      graph,
      clusters,
      targets=None,
      node_ids=None,
      normalize_adj=True,
      q=1,
      lam=0.1,
      weighted=False,
      name=None,
  ):
      self.name = name
      self.clusters = list()
      self.clusters_original = copy.deepcopy(clusters)
      self.graph = graph
      self.node_list = list(graph.nodes())
      self.normalize_adj = normalize_adj
      self.q = q
      self.lam = lam
      self.weighted = weighted
      self.node_order = list()
      self._node_order_in_progress = list()
      self.__node_buffer = dict()
      self.target_ids = list()
  
      if len(clusters) % self.q != 0:
          raise ValueError(
              "The number of clusters should be exactly divisible by q. However, {} number of clusters is not exactly divisible by {}.".format(
                  len(clusters), q
              )
          )
  
      if node_ids is not None:
          self.target_ids = list(node_ids)
  
      if targets is not None:
          if node_ids is None:
              raise ValueError(
                  "Since targets is not None, node_ids must be given and cannot be None."
              )
  
          if len(node_ids) != len(targets):
              raise ValueError(
                  "When passed together targets and indices should be the same length."
              )
  
          self.targets = np.asanyarray(targets)
          self.target_node_lookup = dict(
              zip(self.target_ids, range(len(self.target_ids)))
          )
      else:
          self.targets = None
  
      self.on_epoch_end()
  
imports: import random
  import copy
  import numpy
  import networkx
  from tensorflow.keras.utils import Sequence
  from scipy import sparse
  from ..core.graph import StellarGraph
  from ..core.utils import is_real_iterable, normalize_adj
  from ..connector.neo4j.graph import Neo4jStellarGraph
  from .base import Generator
label_desc: Use image node_id 1 to create a new ClusterNodeSequence object from inherited base classes: Sequence with example: obj = ClusterNodeSequence(graph, clusters, targets, node_ids, normalize_adj, q, lam, weighted, name)