code: def test_walk_generation_single_root_node(self):
      g = create_test_graph()
      mrw = UniformRandomMetaPathWalk(g)
  
      nodes = ["0"]
      n = 1
      length = 15
      metapaths = [["s", "n", "n", "s"]]
      seed = 42
  
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == n
      assert len(walks[0]) <= length  # test against maximum walk length
  
      n = 5
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == n
      assert len(walks[0]) <= length  # test against maximum walk length
  
      metapaths = [["s", "n", "s"], ["s", "n", "n", "s"]]
      n = 1
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == n * len(metapaths)
      for walk in walks:
          assert len(walk) <= length  # test against maximum walk length
  
      metapaths = [["s", "n", "s"], ["s", "n", "n", "s"]]
      n = 5
      length = 100
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == n * len(metapaths)
      for walk in walks:
          assert len(walk) <= length  # test against maximum walk length
  
      nodes = [8]
      metapaths = [["s", "n", "s"], ["s", "n", "n", "s"]]
      n = 5
      length = 100
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == 0
  
file_path: stellargraph/tests/data/test_metapath_walker.py
imports: import pandas
  import numpy
  import pytest
  from stellargraph.data.explorer import UniformRandomMetaPathWalk
  from stellargraph.core.graph import StellarGraph
  from ..test_utils.graphs import example_graph_random
label_desc: Use image node_id 4 for calling the TestMetaPathWalk obj's underlying member method code with example usage: obj.test_walk_generation_single_root_node() without return types