code: def test_one_hop(self, tree_graph):
      bfw = DirectedBreadthFirstNeighbours(tree_graph)
      # - The following case should be [[["root"], [None], [child]]]
      nodes = tree_graph.node_ids_to_ilocs(["root"])
      subgraph = bfw.run(nodes=nodes, n=1, in_size=[1], out_size=[1])
      assert len(subgraph) == 1
      assert len(subgraph[0]) == 3
      assert len(subgraph[0][0]) == 1
      assert (
          subgraph[0][0][0] == tree_graph.node_ids_to_ilocs(["root"])[0]
      )
      assert len(subgraph[0][1]) == 1
      assert subgraph[0][1][0] == -1
      assert len(subgraph[0][2]) == 1
      assert subgraph[0][2][0] in tree_graph.node_ids_to_ilocs(
          ["0", 1, 2]
      )
      # - The following case should be [[["root"], [None], []]]
      subgraph = bfw.run(nodes=nodes, n=1, in_size=[1], out_size=[0])
      assert len(subgraph) == 1
      assert len(subgraph[0]) == 3
      assert len(subgraph[0][2]) == 0
      # - The following case should be [[["root"], [], []]]
      subgraph = bfw.run(nodes=nodes, n=1, in_size=[0], out_size=[0])
      assert len(subgraph) == 1
      assert len(subgraph[0]) == 3
      assert len(subgraph[0][1]) == 0
      # - The following case should be [[["root"], [None, None, None], [child, child, child, child]]]
      subgraph = bfw.run(nodes=nodes, n=1, in_size=[3], out_size=[4])
      assert len(subgraph) == 1
      assert len(subgraph[0]) == 3
      assert len(subgraph[0][1]) == 3
      for child in subgraph[0][1]:
          assert child == -1
      assert len(subgraph[0][2]) == 4
      for child in subgraph[0][2]:
          assert child in tree_graph.node_ids_to_ilocs(["0", 1, 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 3 for calling the TestDirectedBreadthFirstNeighbours obj's underlying member method code with example usage: obj.test_one_hop(tree_graph) without return types