code: def test_3d_grid():
      """test the 6nn graph"""
      x0 = np.array([0, 0, 0])
      x1 = np.array(
          [
              [1, 0, 0],
              [0, 1, 0],
              [0, 0, 1],
              [-1, 0, 0],
              [0, -1, 0],
              [0, 0, -1],
          ]
      )
      x2 = np.array(
          [
              [1, 1, 0],
              [0, 1, 1],
              [1, 0, 1],
              [1, -1, 0],
              [0, 1, -1],
              [1, 0, -1],
              [-1, 1, 0],
              [0, -1, 1],
              [-1, 0, 1],
              [-1, -1, 0],
              [-1, 0, -1],
              [0, -1, -1],
          ]
      )
      x3 = np.array(
          [
              [1, 1, 1],
              [1, 1, -1],
              [1, -1, 1],
              [1, -1, -1],
              [-1, 1, 1],
              [-1, 1, -1],
              [-1, -1, 1],
              [-1, -1, -1],
          ]
      )
      for x in x1:
          xyz = np.vstack((x0, x))
          assert wgraph_from_3d_grid(xyz, 6).E == 2
          assert wgraph_from_3d_grid(xyz, 18).E == 2
          assert wgraph_from_3d_grid(xyz, 26).E == 2
          for x in x2:
              xyz = np.vstack((x0, x))
              assert wgraph_from_3d_grid(xyz, 6).E == 0
              assert wgraph_from_3d_grid(xyz, 18).E == 2
              assert wgraph_from_3d_grid(xyz, 26).E == 2
          for x in x3:
              xyz = np.vstack((x0, x))
              assert wgraph_from_3d_grid(xyz, 6).E == 0
              assert wgraph_from_3d_grid(xyz, 18).E == 0
              assert wgraph_from_3d_grid(xyz, 26).E == 2
  
imports: import numpy
  import numpy.random
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from ..graph import WeightedGraph, complete_graph, concatenate_graphs, eps_nn, knn, mst, wgraph_from_3d_grid, wgraph_from_adjacency, wgraph_from_coo_matrix
label_desc: Use image node_id 11 for calling a global function with example usage: test_3d_grid() without return types