code: def test_walk_generation_single_root_node_loner(self):
      g = create_test_graph()
      bfw = SampledBreadthFirstWalk(g)
  
      nodes = g.node_ids_to_ilocs(["loner"])
      n = 1
      n_size = [0]
  
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      assert len(subgraphs[0]) == 1  # all elements should the same node
      assert subgraphs[0][0] == g.node_ids_to_ilocs(["loner"])[0]
  
      n_size = [1]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      assert len(subgraphs[0]) == expected_bfw_size(
          n_size
      )  # "loner" plus None
      assert subgraphs[0][0] == g.node_ids_to_ilocs(["loner"])[0]
      assert subgraphs[0][1] == -1
  
      n_size = [2, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      # "loner" plus 2 * None + 2 * 2 * None
      assert len(subgraphs[0]) == expected_bfw_size(n_size)
      assert subgraphs[0][0] == g.node_ids_to_ilocs(["loner"])[0]
      assert subgraphs[0][1] == -1
      assert subgraphs[0][2] == -1
      assert subgraphs[0][6] == -1
  
      n_size = [3, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      # "loner" plus 3 * None + 3 * 2 * None
      assert len(subgraphs[0]) == expected_bfw_size(n_size)
      assert subgraphs[0][0] == g.node_ids_to_ilocs(["loner"])[0]
  
      n = 3
      n_size = [0]
  
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      for subgraph in subgraphs:
          assert len(subgraph) == 1  # root node only
          assert subgraph[0] == g.node_ids_to_ilocs(["loner"])[0]
  
      n_size = [1]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      for subgraph in subgraphs:
          # "loner" plus None
          assert len(subgraph) == expected_bfw_size(n_size)
          assert subgraph[0] == g.node_ids_to_ilocs(["loner"])[0]
  
      n = 99
      n_size = [2, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      for subgraph in subgraphs:
          # "loner" plus 2 * None + 2 * 2 * None
          assert len(subgraph) == expected_bfw_size(n_size)
          assert subgraph[0] == g.node_ids_to_ilocs(["loner"])[0]
  
      n = 17
      n_size = [3, 2]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == n
      for subgraph in subgraphs:
          # "loner" plus 3 * None + 3 * 2 * None
          assert len(subgraph) == expected_bfw_size(n_size)
          assert subgraph[0] == g.node_ids_to_ilocs(["loner"])[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 2 for calling the TestBreadthFirstWalk obj's underlying member method code with example usage: obj.test_walk_generation_single_root_node_loner() without return types