code: def test_three_hops(self):
      g = create_test_graph(is_directed=True)
      bfw = DirectedBreadthFirstNeighbours(g)
      graph_nodes = g.node_ids_to_ilocs(list(g.nodes()))
      for _ in range(50):
          node = random.choice(graph_nodes)
          in_size = [random.randint(0, 2) for _ in range(3)]
          out_size = [random.randint(0, 2) for _ in range(3)]
          subgraph = bfw.run(
              nodes=[node], n=1, in_size=in_size, out_size=out_size
          )
          assert len(subgraph) == 1
          assert len(subgraph[0]) == 15  # 2**(num_hops+1) - 1 = 15
          assert len(subgraph[0][0]) == 1
          assert len(subgraph[0][1]) == in_size[0]
          assert len(subgraph[0][2]) == out_size[0]
          assert len(subgraph[0][3]) == in_size[0] * in_size[1]
          assert len(subgraph[0][4]) == in_size[0] * out_size[1]
          assert len(subgraph[0][5]) == out_size[0] * in_size[1]
          assert len(subgraph[0][6]) == out_size[0] * out_size[1]
          assert (
              len(subgraph[0][7])
              == in_size[0] * in_size[1] * in_size[2]
          )
          assert (
              len(subgraph[0][8])
              == in_size[0] * in_size[1] * out_size[2]
          )
          assert (
              len(subgraph[0][9])
              == in_size[0] * out_size[1] * in_size[2]
          )
          assert (
              len(subgraph[0][10])
              == in_size[0] * out_size[1] * out_size[2]
          )
          assert (
              len(subgraph[0][11])
              == out_size[0] * in_size[1] * in_size[2]
          )
          assert (
              len(subgraph[0][12])
              == out_size[0] * in_size[1] * out_size[2]
          )
          assert (
              len(subgraph[0][13])
              == out_size[0] * out_size[1] * in_size[2]
          )
          assert (
              len(subgraph[0][14])
              == out_size[0] * out_size[1] * out_size[2]
          )
  
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 5 for calling the TestDirectedBreadthFirstNeighbours obj's underlying member method code with example usage: obj.test_three_hops() without return types