code: def test_walk_generation_single_root_node_self_loner(self):
      g = create_test_graph(self_loop=True)
      bfw = SampledHeterogeneousBreadthFirstWalk(g)
  
      # this node is only connected with itself with an edge of type "friend"
      nodes = g.node_ids_to_ilocs([7])
      n = 1
  
      n_size = [0]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == 1
      assert len(subgraphs[0]) == 3
      assert (
          subgraphs[0][0][0] == nodes[0]
      )  # this should be the root node id
      # node 0 is of type 'user' and for the simple test graph it has 2 types of edges, rating, and friend,
      # so 2 empty subgraphs should be returned
      assert len(subgraphs[0][1]) == 0  # this should be empty list
      assert len(subgraphs[0][2]) == 0  # this should be the empty list
  
      n_size = [1]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == 1
      assert len(subgraphs[0]) == 3
      assert (
          subgraphs[0][0][0] == nodes[0]
      )  # this should be the root node id
  
      # node 0 is of type 'user' and for the simple test graph it has 2 types of edges, rating, and friend,
      # so 1 subgraph with the root id corresponding to friend type edge and 1 subgraph with None should be returned
      assert (
          subgraphs[0][1][0] == nodes[0]
      )  # this should be the root node id
      assert len(subgraphs[0][2]) == 1  # this should be None
      assert subgraphs[0][2] == [-1]  # this should be None
  
      n_size = [2, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      # The correct result should be:
      #  [[[7], [7, 7], [None, None], [7, 7], [None, None], [7, 7], [None, None], [None, None], [None, None]]]
      assert len(subgraphs) == 1
      assert len(subgraphs[0]) == 9
      for level in subgraphs[0]:
          assert type(level) == list
          if len(level) > 0:
              # All values should be rood_node_id or None
              for value in level:
                  assert (value == nodes[0]) or (value == -1)
  
      n_size = [2, 2, 3]
      subgraphs2 = bfw.run(nodes=nodes, n=n, n_size=n_size)
      # The correct result should be the same as previous output plus:
      #  [[7]*3, [None]*3, [7]*3, [None]*3, [None]*3,  [None]*3, [7]*3, [None]*3, [7]*3
      # concatenated with 10 [None]*3
      assert len(subgraphs2) == 1
      assert len(subgraphs2[0]) == 29
  
      # The previous list should be the same as start of this one
      assert all(
          [
              subgraphs[0][ii] == subgraphs2[0][ii]
              for ii in range(len(subgraphs))
          ]
      )
  
      for level in subgraphs2[0]:
          assert type(level) == list
          if len(level) > 0:
              for value in level:
                  assert (value == nodes[0]) or (value == -1)
  
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 3 for calling the TestSampledHeterogeneousBreadthFirstWalk obj's underlying member method code with example usage: obj.test_walk_generation_single_root_node_self_loner() without return types