class_docstr: A data generator for use with full-batch models on homogeneous graphs,
  e.g., GCN, GAT, SGC.
  The supplied graph G should be a StellarGraph object with node features.
  
  Use the :meth:`flow` method supplying the links as a list of ``(src, dst)`` tuples
  of node IDs and (optionally) targets.
  
  This generator will supply the features array and the adjacency matrix to a
  full-batch Keras graph ML model.  There is a choice to supply either a sparse
  adjacency matrix (the default) or a dense adjacency matrix, with the `sparse`
  argument.
  
  For these algorithms the adjacency matrix requires preprocessing and the
  'method' option should be specified with the correct preprocessing for
  each algorithm. The options are as follows:
  
  *   ``method='gcn'``: Normalizes the adjacency matrix for the GCN algorithm.
      This implements the linearized convolution of Eq. 8 in [1].
  *   ``method='sgc'``: This replicates the k-th order smoothed adjacency matrix
      to implement the Simplified Graph Convolutions of Eq. 8 in [2].
  *   ``method='self_loops'`` or ``method='gat'``: Simply sets the diagonal elements
      of the adjacency matrix to one, effectively adding self-loops to the graph. This is
      used by the GAT algorithm of [3].
  *   ``method='ppnp'``: Calculates the personalized page rank matrix of Eq. 2 in [4].
  
  [1] `Kipf and Welling, 2017 <https://arxiv.org/abs/1609.02907>`_.
  [2] `Wu et al. 2019 <https://arxiv.org/abs/1902.07153>`_.
  [3] `Veličković et al., 2018 <https://arxiv.org/abs/1710.10903>`_.
  [4] `Klicpera et al., 2018 <https://arxiv.org/abs/1810.05997>`_.
  
  Example::
  
      G_generator = FullBatchLinkGenerator(G)
      train_flow = G_generator.flow([(1,2), (3,4), (5,6)], [0, 1, 1])
  
      # Fetch the data from train_flow, and feed into a Keras model:
      x_inputs, y_train = train_flow[0]
      model.fit(x=x_inputs, y=y_train)
  
      # Alternatively, use the generator itself with model.fit:
      model.fit(train_flow, epochs=num_epochs)
  
  .. seealso::
  
     Models using this generator: :class:`.GCN`, :class:`.GAT`, :class:`.APPNP`, :class:`.PPNP`.
  
     Example using this generator: `link classification with GCN <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/gcn-link-prediction.html>`__.
  
     Related generator: :class:`.FullBatchNodeGenerator` for node classification and similar tasks.
  
  Args:
      G (StellarGraph): a machine-learning StellarGraph-type graph
      name (str): an optional name of the generator
      method (str): Method to preprocess adjacency matrix. One of ``gcn`` (default),
          ``sgc``, ``self_loops``, or ``none``.
      k (None or int): This is the smoothing order for the ``sgc`` method. This should be positive
          integer.
      transform (callable): an optional function to apply on features and adjacency matrix
          the function takes ``(features, Aadj)`` as arguments.
      sparse (bool): If True (default) a sparse adjacency matrix is used,
          if False a dense adjacency matrix is used.
      teleport_probability (float): teleport probability between 0.0 and 1.0. "probability"
          of returning to the starting node in the propagation step as in [4].
      weighted (bool, optional): if True, use the edge weights from ``G``; if False, treat the
          graph as unweighted.
class_docstr_tok: ["A","data","generator","for","use","with","full-batch","models","on","homogeneous","graphs",",","e.g.",",","GCN",",","GAT",",","SGC",".","The","supplied","graph","G","should","be","a","StellarGraph","object","with","node","features",".","Use","the",":","meth",":","`","flow","`","method","supplying","the","links","as","a","list","of","``","(","src",",","dst",")","``","tuples","of","node","IDs","and","(","optionally",")","targets",".","This","generator","will","supply","the","features","array","and","the","adjacency","matrix","to","a","full-batch","Keras","graph","ML","model",".","There","is","a","choice","to","supply","either","a","sparse","adjacency","matrix","(","the","default",")","or","a","dense","adjacency","matrix",",","with","the","`","sparse","`","argument",".","For","these","algorithms","the","adjacency","matrix","requires","preprocessing","and","the","'method","'","option","should","be","specified","with","the","correct","preprocessing","for","each","algorithm",".","The","options","are","as","follows",":","*","``","method='gcn","'","``",":","Normalizes","the","adjacency","matrix","for","the","GCN","algorithm",".","This","implements","the","linearized","convolution","of","Eq",".","8","in","[","1","]",".","*","``","method='sgc","'","``",":","This","replicates","the","k-th","order","smoothed","adjacency","matrix","to","implement","the","Simplified","Graph","Convolutions","of","Eq",".","8","in","[","2","]",".","*","``","method='self_loops","'","``","or","``","method='gat","'","``",":","Simply","sets","the","diagonal","elements","of","the","adjacency","matrix","to","one",",","effectively","adding","self-loops","to","the","graph",".","This","is","used","by","the","GAT","algorithm","of","[","3","]",".","*","``","method='ppnp","'","``",":","Calculates","the","personalized","page","rank","matrix","of","Eq",".","2","in","[","4","]",".","[","1","]","`","Kipf","and","Welling",",","2017","<","https",":","\/\/arxiv.org\/abs\/1609.02907",">","`","_",".","[","2","]","`","Wu","et","al",".","2019","<","https",":","\/\/arxiv.org\/abs\/1902.07153",">","`","_",".","[","3","]","`","Veli\u010dkovi\u0107","et","al.",",","2018","<","https",":","\/\/arxiv.org\/abs\/1710.10903",">","`","_",".","[","4","]","`","Klicpera","et","al.",",","2018","<","https",":","\/\/arxiv.org\/abs\/1810.05997",">","`","_",".","Example",":",":","G_generator","=","FullBatchLinkGenerator","(","G",")","train_flow","=","G_generator.flow","(","[","(","1,2",")",",","(","3,4",")",",","(","5,6",")","]",",","[","0",",","1",",","1","]",")","#","Fetch","the","data","from","train_flow",",","and","feed","into","a","Keras","model",":","x_inputs",",","y_train","=","train_flow","[","0","]","model.fit","(","x=x_inputs",",","y=y_train",")","#","Alternatively",",","use","the","generator","itself","with","model.fit",":","model.fit","(","train_flow",",","epochs=num_epochs",")","..","seealso",":",":","Models","using","this","generator",":",":","class",":","`",".GCN","`",",",":","class",":","`",".GAT","`",",",":","class",":","`",".APPNP","`",",",":","class",":","`",".PPNP","`",".","Example","using","this","generator",":","`","link","classification","with","GCN","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/gcn-link-prediction.html",">","`","__",".","Related","generator",":",":","class",":","`",".FullBatchNodeGenerator","`","for","node","classification","and","similar","tasks",".","Args",":","G","(","StellarGraph",")",":","a","machine-learning","StellarGraph-type","graph","name","(","str",")",":","an","optional","name","of","the","generator","method","(","str",")",":","Method","to","preprocess","adjacency","matrix",".","One","of","``","gcn","``","(","default",")",",","``","sgc","``",",","``","self_loops","``",",","or","``","none","``",".","k","(","None","or","int",")",":","This","is","the","smoothing","order","for","the","``","sgc","``","method",".","This","should","be","positive","integer",".","transform","(","callable",")",":","an","optional","function","to","apply","on","features","and","adjacency","matrix","the","function","takes","``","(","features",",","Aadj",")","``","as","arguments",".","sparse","(","bool",")",":","If","True","(","default",")","a","sparse","adjacency","matrix","is","used",",","if","False","a","dense","adjacency","matrix","is","used",".","teleport_probability","(","float",")",":","teleport","probability","between","0.0","and","1.0",".","``","probability","''","of","returning","to","the","starting","node","in","the","propagation","step","as","in","[","4","]",".","weighted","(","bool",",","optional",")",":","if","True",",","use","the","edge","weights","from","``","G","``",";","if","False",",","treat","the","graph","as","unweighted","."]
docstr: Creates a generator/sequence object for training or evaluation
  with the supplied node ids and numeric targets.
  
  Args:
      link_ids: an iterable of link ids specified as tuples of node ids
          or an array of shape (N_links, 2) specifying the links.
      targets: a 1D or 2D array of numeric node targets with shape ``(len(node_ids),)``
          or ``(len(node_ids), target_size)``
      use_ilocs (bool): if True, node_ids are represented by ilocs,
          otherwise node_ids need to be transformed into ilocs
  
  Returns:
      A NodeSequence object to use with GCN or GAT models
      in Keras methods :meth:`fit`, :meth:`evaluate`,
      and :meth:`predict`
docstr_tok: ["Creates","a","generator\/sequence","object","for","training","or","evaluation","with","the","supplied","node","ids","and","numeric","targets",".","Args",":","link_ids",":","an","iterable","of","link","ids","specified","as","tuples","of","node","ids","or","an","array","of","shape","(","N_links",",","2",")","specifying","the","links",".","targets",":","a","1D","or","2D","array","of","numeric","node","targets","with","shape","``","(","len","(","node_ids",")",",",")","``","or","``","(","len","(","node_ids",")",",","target_size",")","``","use_ilocs","(","bool",")",":","if","True",",","node_ids","are","represented","by","ilocs",",","otherwise","node_ids","need","to","be","transformed","into","ilocs","Returns",":","A","NodeSequence","object","to","use","with","GCN","or","GAT","models","in","Keras","methods",":","meth",":","`","fit","`",",",":","meth",":","`","evaluate","`",",","and",":","meth",":","`","predict","`"]
code: def flow(self, link_ids, targets=None, use_ilocs=False):
      """
      Creates a generator/sequence object for training or evaluation
      with the supplied node ids and numeric targets.
  
      Args:
          link_ids: an iterable of link ids specified as tuples of node ids
              or an array of shape (N_links, 2) specifying the links.
          targets: a 1D or 2D array of numeric node targets with shape ``(len(node_ids),)``
              or ``(len(node_ids), target_size)``
          use_ilocs (bool): if True, node_ids are represented by ilocs,
              otherwise node_ids need to be transformed into ilocs
  
      Returns:
          A NodeSequence object to use with GCN or GAT models
          in Keras methods :meth:`fit`, :meth:`evaluate`,
          and :meth:`predict`
  
      """
      return super().flow(link_ids, targets, use_ilocs)
  
imports: import warnings
  import operator
  import random
  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 .None import Generator, FullBatchSequence, SparseFullBatchSequence, RelationalFullBatchNodeSequence, GraphSAGENodeGenerator, DirectedGraphSAGENodeGenerator
  from ..core.graph import StellarGraph
  from ..core.utils import is_real_iterable
  from ..core.utils import GCN_Aadj_feats_op, PPNP_Aadj_feats_op
  from ..core.validation import comma_sep
label_desc: Use image node_id 1 for calling the FullBatchLinkGenerator obj's underlying member method code with example usage: obj.flow(link_ids, targets, use_ilocs) and returns: super