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 __getitem__(self, index):
      # The next batch should be the adjacency matrix for the cluster and the corresponding feature vectors
      # and targets if available.
      cluster = self.clusters[index]
      adj_cluster = self.graph.to_adjacency_matrix(
          cluster, weighted=self.weighted
      )
  
      if self.normalize_adj:
          adj_cluster = self._diagonal_enhanced_normalization(
              adj_cluster
          )
      else:
          adj_cluster = adj_cluster.toarray()
  
      g_node_list = list(cluster)
  
      # Determine the target nodes that exist in this cluster
      target_nodes_in_cluster = np.asanyarray(
          list(set(g_node_list).intersection(self.target_ids))
      )
  
      self.__node_buffer[index] = target_nodes_in_cluster
  
      # Dictionary to store node indices for quicker node index lookups
      node_lookup = dict(zip(g_node_list, range(len(g_node_list))))
  
      # The list of indices of the target nodes in self.node_list
      target_node_indices = np.array(
          [node_lookup[n] for n in target_nodes_in_cluster]
      )
  
      if index == (len(self.clusters_original) // self.q) - 1:
          # last batch
          self.__node_buffer_dict_to_list()
  
      cluster_targets = None
      #
      if self.targets is not None:
          # Dictionary to store node indices for quicker node index lookups
          # The list of indices of the target nodes in self.node_list
          cluster_target_indices = np.array(
              [
                  self.target_node_lookup[n]
                  for n in target_nodes_in_cluster
              ],
              dtype=np.int64,
          )
          cluster_targets = self.targets[cluster_target_indices]
          cluster_targets = cluster_targets.reshape(
              (1,) + cluster_targets.shape
          )
  
      features = self.graph.node_features(g_node_list)
  
      features = np.reshape(features, (1,) + features.shape)
      adj_cluster = adj_cluster.reshape((1,) + adj_cluster.shape)
      target_node_indices = target_node_indices[np.newaxis, :]
  
      return [
          features,
          target_node_indices,
          adj_cluster,
      ], cluster_targets
  
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 4 for calling the ClusterNodeSequence obj's underlying member method code with example usage: obj.__getitem__(index) and returns: list,  cluster_targets