code: def test_two_hops(self, tree_graph):
      bfw = DirectedBreadthFirstNeighbours(tree_graph)
      # - The following case should be [[["root"], [None], [child*2], [None], [None*2], ["root"*2], [grandchild*4]]]
      in_size = [1, 1]
      out_size = [2, 2]
      node_ilocs = tree_graph.node_ids_to_ilocs(["root"])
      subgraph = bfw.run(
          nodes=node_ilocs, n=1, in_size=in_size, out_size=out_size
      )
  
      assert len(subgraph) == 1
      assert len(subgraph[0]) == 7
      assert len(subgraph[0][1]) == in_size[0]
      assert subgraph[0][1][0] == -1
      assert len(subgraph[0][2]) == out_size[0]
      for child in subgraph[0][2]:
          assert child in tree_graph.node_ids_to_ilocs(["0", 1, 2])
      assert len(subgraph[0][3]) == in_size[0] * in_size[1]
      assert subgraph[0][3][0] == -1
      assert len(subgraph[0][4]) == in_size[0] * out_size[1]
      for child in subgraph[0][4]:
          assert child == -1
      assert len(subgraph[0][5]) == out_size[0] * in_size[1]
      for parent in subgraph[0][5]:
          assert parent == tree_graph.node_ids_to_ilocs(["root"])[0]
      assert len(subgraph[0][6]) == out_size[0] * out_size[1]
      for grandchild in subgraph[0][6]:
          assert (
              grandchild
              in tree_graph.node_ids_to_ilocs(["c1.1", "c2.1", "c2.2"])
              or grandchild == -1
          )
      for idx, child in enumerate(subgraph[0][2]):
          grandchildren = subgraph[0][6][(2 * idx) : (2 * idx + 2)]
          if child == tree_graph.node_ids_to_ilocs(["0"])[0]:
              for grandchild in grandchildren:
                  assert grandchild == -1
          elif child == tree_graph.node_ids_to_ilocs([1])[0]:
              for grandchild in grandchildren:
                  assert (
                      grandchild
                      == tree_graph.node_ids_to_ilocs(["c1.1"])[0]
                  )
          else:  # child == 2
              for grandchild in grandchildren:
                  assert grandchild in tree_graph.node_ids_to_ilocs(
                      ["c2.1", "c2.2"]
                  )
      # - Check structure size for multiple start nodes
      # - For each start node, should be [[[node], [in], [out], [in.in], [in.out], [out.in], [out.out]]]
      nodes = tree_graph.node_ids_to_ilocs(list(tree_graph.nodes()))
      in_size = [2, 3]
      out_size = [4, 5]
      subgraph = bfw.run(
          nodes=nodes, n=1, in_size=in_size, out_size=out_size
      )
      assert len(subgraph) == len(nodes)
      for node_graph in subgraph:
          assert len(node_graph) == 7
          assert len(node_graph[0]) == 1  # 1 start node
          assert len(node_graph[1]) == in_size[0]
          assert len(node_graph[2]) == out_size[0]
          assert len(node_graph[3]) == in_size[0] * in_size[1]
          assert len(node_graph[4]) == in_size[0] * out_size[1]
          assert len(node_graph[5]) == out_size[0] * in_size[1]
          assert len(node_graph[6]) == out_size[0] * out_size[1]
  
file_path: stellargraph/tests/data/test_directed_breadth_first_sampler.py
imports: import random
  import pytest
  import pandas
  import numpy
  from stellargraph.data.explorer import DirectedBreadthFirstNeighbours
  from stellargraph.core.graph import 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 TestDirectedBreadthFirstNeighbours obj's underlying member method code with example usage: obj.test_two_hops(tree_graph) without return types