class_docstr: Implementation of the Node2Vec algorithm of A. Grover and J. Leskovec with Keras layers.
  see: https://snap.stanford.edu/node2vec/
  
  The model minimally requires specification of the embedding size and a generator object.
  
  .. seealso::
  
     Examples using Node2Vec:
  
     - `node classification <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/keras-node2vec-node-classification.html>`__
     - `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/keras-node2vec-embeddings.html>`__
     - `comparison of link prediction algorithms <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/homogeneous-comparison-link-prediction.html>`__
     - using Gensim Word2Vec, not this class: `node classification <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/node2vec-node-classification.html>`__, `node classification with edge weights <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/node2vec-weighted-node-classification.html>`__, `link prediction <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/node2vec-link-prediction.html>`__, `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/node2vec-embeddings.html>`__.
  
     Appropriate data generators: :class:`.Node2VecNodeGenerator`, :class:`.Node2VecLinkGenerator`.
  
     Related functionality: :class:`.BiasedRandomWalk` does the underlying random walks.
  
  Args:
      emb_size (int): The dimension of node embeddings.
      generator (Sequence): A NodeSequence or LinkSequence.
      node_num(int, optional): The number of nodes in the given graph.
      multiplicity (int, optional): The number of nodes to process at a time. This is 1 for a node inference
        and 2 for link inference (currently no others are supported).
docstr: Builds a Node2Vec model for link or node pair prediction.
  
  Returns:
      tuple: (x_inp, x_out) where ``x_inp`` is a list of Keras input tensors for (src, dst) nodes in the node pairs
      and ``x_out`` is a list of output tensors for (src, dst) nodes in the node pairs.
docstr_tok: ["Builds","a","Node2Vec","model","for","link","or","node","pair","prediction",".","Returns",":","tuple",":","(","x_inp",",","x_out",")","where","``","x_inp","``","is","a","list","of","Keras","input","tensors","for","(","src",",","dst",")","nodes","in","the","node","pairs","and","``","x_out","``","is","a","list","of","output","tensors","for","(","src",",","dst",")","nodes","in","the","node","pairs","."]
code: def _link_model(self):
      """
      Builds a Node2Vec model for link or node pair prediction.
  
      Returns:
          tuple: (x_inp, x_out) where ``x_inp`` is a list of Keras input tensors for (src, dst) nodes in the node pairs
          and ``x_out`` is a list of output tensors for (src, dst) nodes in the node pairs.
  
      """
      # Expose input and output sockets of the model, for source node:
      x_inp_src, x_out_src = self._node_model("target")
      x_inp_dst, x_out_dst = self._node_model("context")
  
      x_inp = [x_inp_src, x_inp_dst]
      x_out = [x_out_src, x_out_dst]
      return x_inp, x_out
  
file_path: stellargraph/stellargraph/layer/node2vec.py
imports: from tensorflow.keras import Input
  from tensorflow.keras.layers import Reshape, Embedding
  import math
  from tensorflow import keras
  import warnings
  from .misc import deprecated_model_function
  from ..mapper import Node2VecLinkGenerator, Node2VecNodeGenerator
label_desc: Use image node_id 5 for calling the Node2Vec obj's underlying member method code with example usage: obj._link_model() and returns: x_inp,  x_out