class_docstr: Performs biased second order random walks (like those used in Node2Vec algorithm
  https://snap.stanford.edu/node2vec/) controlled by the values of two parameters p and q.
  
  .. seealso::
  
     Examples using this random walk:
  
     - unsupervised representation learning: `Node2Vec using Gensim Word2Vec <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/node2vec-embeddings.html>`__, `Node2Vec using StellarGraph <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/keras-node2vec-embeddings.html>`__
     - node classification: `Node2Vec using Gensim Word2Vec <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/node2vec-node-classification.html>`__, `Node2Vec using StellarGraph <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/keras-node2vec-node-classification.html>`__, `Node2Vec with edge weights <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/node2vec-weighted-node-classification.html>`__
     - link prediction: `Node2Vec <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/node2vec-link-prediction.html>`__, `comparison to CTDNE (TemporalRandomWalk) <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/ctdne-link-prediction.html>`__, `comparison of algorithms <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/homogeneous-comparison-link-prediction.html>`__
  
     Related functionality:
  
     - :class:`.UnsupervisedSampler` for transforming random walks into links for unsupervised training of link prediction models
     - :class:`.Node2Vec`, :class:`.Node2VecNodeGenerator` and :class:`.Node2VecLinkGenerator` for training a Node2Vec using only StellarGraph
     - Other random walks: :class:`.UniformRandomWalk`, :class:`.UniformRandomMetaPathWalk`, :class:`.TemporalRandomWalk`.
  
  Args:
      graph (StellarGraph): Graph to traverse
      n (int, optional): Total number of random walks per root node
      length (int, optional): Maximum length of each random walk
      p (float, optional): Defines probability, 1/p, of returning to source node
      q (float, optional): Defines probability, 1/q, for moving to a node away from the source node
      weighted (bool, optional): Indicates whether the walk is unweighted or weighted
      seed (int, optional): Random number generator seed
class_docstr_tok: ["Performs","biased","second","order","random","walks","(","like","those","used","in","Node2Vec","algorithm","https",":","\/\/snap.stanford.edu\/node2vec\/",")","controlled","by","the","values","of","two","parameters","p","and","q",".","..","seealso",":",":","Examples","using","this","random","walk",":","-","unsupervised","representation","learning",":","`","Node2Vec","using","Gensim","Word2Vec","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/embeddings\/node2vec-embeddings.html",">","`","__",",","`","Node2Vec","using","StellarGraph","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/embeddings\/keras-node2vec-embeddings.html",">","`","__","-","node","classification",":","`","Node2Vec","using","Gensim","Word2Vec","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/node-classification\/node2vec-node-classification.html",">","`","__",",","`","Node2Vec","using","StellarGraph","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/node-classification\/keras-node2vec-node-classification.html",">","`","__",",","`","Node2Vec","with","edge","weights","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/node-classification\/node2vec-weighted-node-classification.html",">","`","__","-","link","prediction",":","`","Node2Vec","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/node2vec-link-prediction.html",">","`","__",",","`","comparison","to","CTDNE","(","TemporalRandomWalk",")","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/ctdne-link-prediction.html",">","`","__",",","`","comparison","of","algorithms","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/homogeneous-comparison-link-prediction.html",">","`","__","Related","functionality",":","-",":","class",":","`",".UnsupervisedSampler","`","for","transforming","random","walks","into","links","for","unsupervised","training","of","link","prediction","models","-",":","class",":","`",".Node2Vec","`",",",":","class",":","`",".Node2VecNodeGenerator","`","and",":","class",":","`",".Node2VecLinkGenerator","`","for","training","a","Node2Vec","using","only","StellarGraph","-","Other","random","walks",":",":","class",":","`",".UniformRandomWalk","`",",",":","class",":","`",".UniformRandomMetaPathWalk","`",",",":","class",":","`",".TemporalRandomWalk","`",".","Args",":","graph","(","StellarGraph",")",":","Graph","to","traverse","n","(","int",",","optional",")",":","Total","number","of","random","walks","per","root","node","length","(","int",",","optional",")",":","Maximum","length","of","each","random","walk","p","(","float",",","optional",")",":","Defines","probability",",","1\/p",",","of","returning","to","source","node","q","(","float",",","optional",")",":","Defines","probability",",","1\/q",",","for","moving","to","a","node","away","from","the","source","node","weighted","(","bool",",","optional",")",":","Indicates","whether","the","walk","is","unweighted","or","weighted","seed","(","int",",","optional",")",":","Random","number","generator","seed"]
docstr: Checks that the parameter values are valid or raises ValueError exceptions with a message indicating the
  parameter (the first one encountered in the checks) with invalid value.
  
  Args:
      p: <float> The backward walk 'penalty' factor.
      q: <float> The forward walk 'penalty' factor.
      weighted: <False or True> Indicates whether the walk is unweighted or weighted.
docstr_tok: ["Checks","that","the","parameter","values","are","valid","or","raises","ValueError","exceptions","with","a","message","indicating","the","parameter","(","the","first","one","encountered","in","the","checks",")","with","invalid","value",".","Args",":","p",":","<","float",">","The","backward","walk","'penalty","'","factor",".","q",":","<","float",">","The","forward","walk","'penalty","'","factor",".","weighted",":","<","False","or","True",">","Indicates","whether","the","walk","is","unweighted","or","weighted","."]
code: def _check_weights(self, p, q, weighted):
      """
      Checks that the parameter values are valid or raises ValueError exceptions with a message indicating the
      parameter (the first one encountered in the checks) with invalid value.
  
      Args:
          p: <float> The backward walk 'penalty' factor.
          q: <float> The forward walk 'penalty' factor.
          weighted: <False or True> Indicates whether the walk is unweighted or weighted.
      """
      if p <= 0.0:
          raise ValueError(
              f"p: expected positive numeric value, found {p}"
          )
  
      if q <= 0.0:
          raise ValueError(
              f"q: expected positive numeric value, found {q}"
          )
  
      if type(weighted) != bool:
          raise ValueError(
              f"weighted: expected boolean value, found {weighted}"
          )
  
imports: import numpy
  import warnings
  from collections import defaultdict, deque
  from scipy import stats
  from scipy.special import softmax
  from ..core.schema import GraphSchema
  from ..core.graph import StellarGraph
  from ..core.utils import is_real_iterable
  from ..core.validation import require_integer_in_range, comma_sep
  from ..random import random_state
  from abc import ABC, abstractmethod
label_desc: Use image node_id 4 for calling the BiasedRandomWalk obj's underlying member method code with example usage: obj._check_weights(p, q, weighted) without return types