code: def test_walk_generation_single_root_node_self_loner(self):
      g = create_test_graph()
      bfw = SampledBreadthFirstWalk(g)
  
      nodes = g.node_ids_to_ilocs(["self loner"])
      n = 1
  
      n_size = [0]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n_size = [1]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n_size = [2, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n_size = [3, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n = 3
      n_size = [0]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n * len(nodes)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n_size = [1]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n * len(nodes)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n_size = [2, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n * len(nodes)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should be same node
      assert nodes[0] in set(subgraphs[0])
  
      n_size = [3, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n * len(nodes)
      assert len(subgraphs[0]) == expected_bfw_size(n_size=n_size)
      assert (
          len(set(subgraphs[0])) == 1
      )  # all elements should the same node
      assert nodes[0] in set(subgraphs[0])
  
file_path: stellargraph/tests/data/test_breadth_first_walker.py
imports: import pandas
  import pytest
  import numpy
  from stellargraph.data.explorer import SampledBreadthFirstWalk
  from stellargraph.core.graph import StellarGraph, StellarDiGraph
  from ..test_utils.graphs import create_test_graph, tree_graph, example_graph_random, weighted_tree
label_desc: Use image node_id 4 for calling the TestBreadthFirstWalk obj's underlying member method code with example usage: obj.test_walk_generation_single_root_node_self_loner() without return types