code: def test_grid_3d_4():
      nx, ny, nz = 10, 10, 10
      xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T
      G = wgraph_from_3d_grid(xyz, 26)
      D = G.weights
      # 6 * 9 * 10 * 10
      assert sum(D == 1) == 5400
      # 26 * 8 ** 3 + 6 * 8 ** 2 * 17 + 12 * 8 * 11 + 8 * 7
      assert np.size(D) == 20952
      # 18 * 8 ** 3 + 6 * 8 ** 2 * 13 + 12 * 8 * 9 + 8 * 6
      assert sum(D < 1.5) == 15120
  
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 15 for calling a global function with example usage: test_grid_3d_4() without return types