code: def test_walk_biases(self):
      # a square with a triangle:
      #   0-3
      #  /| |
      # 1-2-4
      nodes = pd.DataFrame(index=range(5))
      edges = pd.DataFrame(
          [(0, 1), (0, 2), (0, 3), (1, 2), (2, 4), (3, 4)],
          columns=["source", "target"],
      )
      graph = StellarGraph(nodes, edges)
      biasedrw = BiasedRandomWalk(graph)
  
      # there's 18 total walks of length 4 starting at 0 in `graph`,
      # and the non-tiny transition probabilities are always equal
      # so with a large enough sample, all the possible paths for a
      # given p, q should come up.
      nodes = [0]
      n = 1000
      seed = None
      length = 4
  
      always = 1e-20
      never = 1e20
  
      # always return to the last visited node
      p = always
      q = never
      walks = {
          tuple(w)
          for w in biasedrw.run(
              nodes=nodes, n=n, p=p, q=q, length=length, seed=seed
          )
      }
      assert walks == {(0, 1, 0, 1), (0, 2, 0, 2), (0, 3, 0, 3)}
  
      # always explore (when possible)
      p = never
      q = always
      walks = {
          tuple(w)
          for w in biasedrw.run(
              nodes=nodes, n=n, p=p, q=q, length=length, seed=seed
          )
      }
      assert walks == {
          # follow the square
          (0, 2, 4, 3),
          (0, 3, 4, 2),
          # go around the triangle (2 is a neighbour of 0 and so
          # isn't exploring, but q = never < 1)
          (0, 1, 2, 4),
      }
  
      # always go to a neighbour, if possible, otherwise equal
      # chance of returning or exploring
      p = never
      q = never
      walks = {
          tuple(w)
          for w in biasedrw.run(
              nodes=nodes, n=n, p=p, q=q, length=length, seed=seed
          )
      }
      assert walks == {
          # follow the triangle
          (0, 1, 2, 0),
          (0, 2, 1, 0),
          # all explorations around the square should appear (none
          # are neighbours)
          (0, 3, 0, 1),
          (0, 3, 0, 2),
          (0, 3, 0, 3),
          (0, 3, 4, 3),
          (0, 3, 4, 2),
      }
  
imports: import numpy
  import pandas
  import pytest
  import networkx
  from stellargraph.data.explorer import BiasedRandomWalk
  from stellargraph.core.graph import StellarGraph
  from ..test_utils.graphs import create_test_graph, example_graph_random
label_desc: Use image node_id 6 for calling the TestBiasedRandomWalk obj's underlying member method code with example usage: obj.test_walk_biases() without return types