class_docstr: A data generator for use with the Watch Your Step algorithm [1]. It calculates and returns the first ``num_powers``
  of the adjacency matrix row by row.
  
  .. seealso::
  
     Model using this generator: :class:`.WatchYourStep`.
  
     Example using this generator: `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/watch-your-step-embeddings.html>`__
  
  Args:
      G (StellarGraph): a machine-learning StellarGraph-type graph
      num_powers (int): the number of adjacency powers to calculate. Defaults
          to 10 as this value was found to perform well by the authors of the paper.
      weighted (bool, optional): if True, use the edge weights from ``G``; if False, treat the
          graph as unweighted.
code: def __init__(self, G, num_powers=10, weighted=False):
      if not isinstance(G, StellarGraph):
          raise TypeError("G must be a StellarGraph object.")
  
      require_integer_in_range(num_powers, "num_powers", min_val=1)
  
      Aadj = G.to_adjacency_matrix(weighted=weighted)
  
      def tfify(matrix):
          matrix = matrix.tocoo(copy=False)
          return tf.sparse.SparseTensor(
              # construct the transpose
              indices=np.column_stack([matrix.col, matrix.row]),
              values=matrix.data.astype(np.float32),
              dense_shape=matrix.shape,
          )
  
      self.Aadj_T = tfify(Aadj)
  
      self.transition_matrix_T = tfify(
          normalize_adj(Aadj, symmetric=False)
      )
  
      self.num_powers = num_powers
  
file_path: stellargraph/stellargraph/mapper/adjacency_generators.py
imports: import tensorflow
  from tensorflow.keras import backend
  import numpy
  from ..core import StellarGraph
  from ..core.validation import require_integer_in_range
  from ..core.utils import normalize_adj
  from .base import Generator
label_desc: Use image node_id 1 to create a new AdjacencyPowerGenerator object from inherited base classes: Generator with example: obj = AdjacencyPowerGenerator(G, num_powers, weighted)