code: def test_walk_generation_many_root_nodes(self):
      g = create_test_graph(self_loop=True)
      bfw = SampledHeterogeneousBreadthFirstWalk(g)
  
      def _conv(ns):
          return [
              -1 if n is None else g.node_ids_to_ilocs([n])[0]
              for n in ns
          ]
  
      nodes = _conv([0, 7])  # both nodes are type user
      n = 1
      n_size = [0]
  
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == len(nodes) * n
      for i, subgraph in enumerate(subgraphs):
          assert len(subgraph) == 3
          assert (
              subgraph[0][0] == nodes[i]
          )  # should equal the root node
  
      n_size = [1]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == len(nodes) * n
      for i, subgraph in enumerate(subgraphs):
          assert len(subgraph) == 3
  
      n_size = [2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == len(nodes) * n
      for i, subgraph in enumerate(subgraphs):
          assert len(subgraph) == 3
  
      valid_result = [
          [_conv([0]), [-1, -1], [-1, -1]],
          [_conv([7]), _conv([7, 7]), [-1, -1]],
      ]
      assert _recursive_items_equal(valid_result, subgraphs)
  
      n_size = [2, 2]
      nodes = _conv([0, 4])
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == len(nodes) * n
      assert subgraphs[0][0][0] == nodes[0]
      valid_result = [
          [
              [0],
              [None, None],
              [None, None],
              [None, None],
              [None, None],
              [None, None],
              [None, None],
              [None, None],
              [None, None],
          ],
          [
              [4],
              ["5", 1],
              [2, 2],
              [1, 1],
              [6, 3],
              [4, 4],
              [2, 3],
              [1, 1],
              [4, 4],
          ],
      ]
      valid_result = [[_conv(x) for x in y] for y in valid_result]
      assert _recursive_items_equal(subgraphs, valid_result)
  
      n_size = [2, 3]
      nodes = _conv([1, 6])  # a user and a movie node respectively
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == len(nodes) * n
      assert subgraphs[0][0][0] == nodes[0]
      valid_result = [
          [
              [1],
              ["5", 4],
              [3, 3],
              [1, 1, "5"],
              [2, 2, 2],
              [1, 4, 1],
              [3, 6, 6],
              [1, "5", "5"],
              [1, "5", 1],
          ],
          [[6], ["5", "5"], [4, 4, 1], [6, 3, 6], [4, 4, 1], [6, 6, 3]],
      ]
  
      valid_result = [[_conv(x) for x in y] for y in valid_result]
      assert _recursive_items_equal(subgraphs, valid_result)
  
      n = 5
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == len(nodes) * n
  
      #
      # Test with multi-graph
      #
      g = create_test_graph(multi=True)
      bfw = SampledHeterogeneousBreadthFirstWalk(g)
  
      nodes = _conv([1, 6])
      n = 1
      n_size = [2]
  
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == n * len(nodes)
      valid_result = [[[1], [4, 4], [4, 4], [2, 2]], [[6], ["5", "5"]]]
      valid_result = [[_conv(x) for x in y] for y in valid_result]
  
      assert _recursive_items_equal(subgraphs, valid_result)
  
      n = 1
      n_size = [2, 3]
  
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == n * len(nodes)
  
      nodes = _conv([4, "5", 0])
      n = 1
      n_size = [3, 3, 1]
  
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == n * len(nodes)
  
      n = 99
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size, seed=999)
      assert len(subgraphs) == n * len(nodes)
  
file_path: stellargraph/tests/data/test_heterogeneous_breadth_first_walker.py
imports: import pandas
  import numpy
  import pytest
  from stellargraph.data.explorer import SampledHeterogeneousBreadthFirstWalk
  from stellargraph.core.graph import StellarGraph
  from ..test_utils.graphs import example_graph_random
label_desc: Use image node_id 5 for calling the TestSampledHeterogeneousBreadthFirstWalk obj's underlying member method code with example usage: obj.test_walk_generation_many_root_nodes() and returns: unknown