class_docstr: Abstract base class for graph data generators.
  
  The supplied graph should be a StellarGraph object that is ready for
  machine learning.
  
  Do not use this base class: use a subclass specific to the method.
  
  Args:
      G (StellarGraph): The machine-learning ready graph.
      batch_size (int): Size of batch to return.
      schema (GraphSchema): [Optional] Schema for the graph, for heterogeneous graphs.
class_docstr_tok: ["Abstract","base","class","for","graph","data","generators",".","The","supplied","graph","should","be","a","StellarGraph","object","that","is","ready","for","machine","learning",".","Do","not","use","this","base","class",":","use","a","subclass","specific","to","the","method",".","Args",":","G","(","StellarGraph",")",":","The","machine-learning","ready","graph",".","batch_size","(","int",")",":","Size","of","batch","to","return",".","schema","(","GraphSchema",")",":","[","Optional","]","Schema","for","the","graph",",","for","heterogeneous","graphs","."]
docstr: Creates a generator/sequence object for training or evaluation
  with the supplied node ids and numeric targets.
  
  The node IDs are the nodes to train or inference on: the embeddings
  calculated for these nodes are passed to the downstream task. These
  are a subset of the nodes in the graph.
  
  The targets are an array of numeric targets corresponding to the
  supplied node_ids to be used by the downstream task. They should
  be given in the same order as the list of node IDs.
  If they are not specified (for example, for use in prediction),
  the targets will not be available to the downstream task.
  
  Note that the shuffle argument should be True for training and
  False for prediction.
  
  Args:
      node_ids: an iterable of node IDs
      targets: a 2D array of numeric targets with shape
          ``(len(node_ids), target_size)``
      shuffle (bool): If True the node_ids will be shuffled at each
          epoch, if False the node_ids will be processed in order.
  
  Returns:
      A NodeSequence object to use with with StellarGraph models
      in Keras methods ``fit``, ``evaluate``,
      and ``predict``
code: def flow(self, node_ids, targets=None, shuffle=False, seed=None):
      """
      Creates a generator/sequence object for training or evaluation
      with the supplied node ids and numeric targets.
  
      The node IDs are the nodes to train or inference on: the embeddings
      calculated for these nodes are passed to the downstream task. These
      are a subset of the nodes in the graph.
  
      The targets are an array of numeric targets corresponding to the
      supplied node_ids to be used by the downstream task. They should
      be given in the same order as the list of node IDs.
      If they are not specified (for example, for use in prediction),
      the targets will not be available to the downstream task.
  
      Note that the shuffle argument should be True for training and
      False for prediction.
  
      Args:
          node_ids: an iterable of node IDs
          targets: a 2D array of numeric targets with shape
              ``(len(node_ids), target_size)``
          shuffle (bool): If True the node_ids will be shuffled at each
              epoch, if False the node_ids will be processed in order.
  
      Returns:
          A NodeSequence object to use with with StellarGraph models
          in Keras methods ``fit``, ``evaluate``,
          and ``predict``
  
      """
      if self.head_node_types is not None:
          expected_node_type = self.head_node_types[0]
      else:
          expected_node_type = None
  
      node_ilocs = self.graph.node_ids_to_ilocs(node_ids)
      node_types = self.graph.node_type(node_ilocs, use_ilocs=True)
      invalid = node_ilocs[node_types != expected_node_type]
  
      if len(invalid) > 0:
          raise ValueError(
              f"node_ids: expected all nodes to be of type {expected_node_type}, "
              f"found some nodes with wrong type: {comma_sep(invalid, stringify=format)}"
          )
  
      return NodeSequence(
          self.sample_features,
          self.batch_size,
          node_ilocs,
          targets,
          shuffle=shuffle,
          seed=seed,
      )
  
imports: import warnings
  import operator
  import random
  import abc
  import warnings
  import numpy
  import itertools
  import networkx
  import scipy.sparse
  from tensorflow.keras import backend
  from functools import reduce
  from tensorflow.keras.utils import Sequence
  from collections import defaultdict
  from ..data import SampledBreadthFirstWalk, SampledHeterogeneousBreadthFirstWalk, DirectedBreadthFirstNeighbours
  from ..core.graph import StellarGraph, GraphSchema
  from ..core.utils import is_real_iterable
  from ..core.validation import comma_sep
  from .None import NodeSequence, Generator
  from ..random import SeededPerBatch
label_desc: Use image node_id 4 for calling the BatchedNodeGenerator obj's underlying member method code with example usage: obj.flow(node_ids, targets, shuffle, seed) and returns: NodeSequence