docstr: Tests that the sampler behaves correctly when a root node is isolated with no self loop
  Returns:
docstr_tok: ["Tests","that","the","sampler","behaves","correctly","when","a","root","node","is","isolated","with","no","self","loop","Returns",":"]
code: def test_walk_generation_single_root_node_loner(self):
      """
      Tests that the sampler behaves correctly when a root node is isolated with no self loop
      Returns:
  
      """
      g = create_test_graph(self_loop=True)
      bfw = SampledHeterogeneousBreadthFirstWalk(g)
  
      nodes = g.node_ids_to_ilocs(
          [0]
      )  # this is an isolated user node with no self loop
      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] == g.node_ids_to_ilocs([0])[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
  
      # These test should return the same result as the one before regardless of the value of n_size
      n_size = [2, 3]
      subgraphs = bfw.run(nodes=nodes, n=n, n_size=n_size)
      assert len(subgraphs) == 1
      assert (
          len(subgraphs[0]) == 9
      )  # we return all fake samples in walk even if there are no neighbours
      assert (
          subgraphs[0][0][0] == g.node_ids_to_ilocs([0])[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 subgraphs with None should be returned
      assert len(subgraphs[0][1]) == 2
      assert all(
          [x == -1 for x in subgraphs[0][1]]
      )  # this should only be None
      assert len(subgraphs[0][2]) == 2
      assert all([x == -1 for x in subgraphs[0][2]])
  
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 2 for calling the TestSampledHeterogeneousBreadthFirstWalk obj's underlying member method code with example usage: obj.test_walk_generation_single_root_node_loner() without return types