class_docstr: A data generator for node representation prediction with Node2Vec models.
  
  At minimum, supply the StellarGraph and the batch size.
  
  The supplied graph should be a StellarGraph object that is ready for
  machine learning. Currently the model does not require node features for
  nodes in the graph.
  
  Use the :meth:`flow` method supplying the nodes to get an object
  that can be used as a Keras data generator.
  
  Example::
  
      G_generator = Node2VecNodeGenerator(G, 50)
      data_gen = G_generator.flow(node_ids)
  
  .. seealso::
  
     Model using this generator: :class:`.Node2Vec`.
  
     An example using this generator (see the model for more): `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/keras-node2vec-embeddings.html>`_.
  
     Related functionality: :class:`.Node2VecLinkGenerator` for training, link prediction, and related tasks.
  
  Args:
      G (StellarGraph): The machine-learning ready graph.
      batch_size (int): Size of batch to return.
      name (str or None): Name of the generator (optional).
class_docstr_tok: ["A","data","generator","for","node","representation","prediction","with","Node2Vec","models",".","At","minimum",",","supply","the","StellarGraph","and","the","batch","size",".","The","supplied","graph","should","be","a","StellarGraph","object","that","is","ready","for","machine","learning",".","Currently","the","model","does","not","require","node","features","for","nodes","in","the","graph",".","Use","the",":","meth",":","`","flow","`","method","supplying","the","nodes","to","get","an","object","that","can","be","used","as","a","Keras","data","generator",".","Example",":",":","G_generator","=","Node2VecNodeGenerator","(","G",",","50",")","data_gen","=","G_generator.flow","(","node_ids",")","..","seealso",":",":","Model","using","this","generator",":",":","class",":","`",".Node2Vec","`",".","An","example","using","this","generator","(","see","the","model","for","more",")",":","`","unsupervised","representation","learning","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/embeddings\/keras-node2vec-embeddings.html",">","`","_",".","Related","functionality",":",":","class",":","`",".Node2VecLinkGenerator","`","for","training",",","link","prediction",",","and","related","tasks",".","Args",":","G","(","StellarGraph",")",":","The","machine-learning","ready","graph",".","batch_size","(","int",")",":","Size","of","batch","to","return",".","name","(","str","or","None",")",":","Name","of","the","generator","(","optional",")","."]
docstr: Get the ids of the head nodes, and return these as a list of feature
  arrays for the Node2Vec algorithm.
  
  Args:
      head_nodes: An iterable of head nodes to perform sampling on.
  
  Returns:
      A list of feature arrays, with each element being the id of each
      head node.
code: def sample_features(self, head_nodes, batch_num):
      """
      Get the ids of the head nodes, and return these as a list of feature
      arrays for the Node2Vec algorithm.
  
      Args:
          head_nodes: An iterable of head nodes to perform sampling on.
  
      Returns:
          A list of feature arrays, with each element being the id of each
          head node.
      """
  
      return np.array(head_nodes)
  
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 2 for calling the Node2VecNodeGenerator obj's underlying member method code with example usage: obj.sample_features(head_nodes, batch_num) and returns: np