The issue with `grid_to_graph` is that it does not include diagonal "neighbors". Say we had a 2D image, each pixel (excluding edges) would have 4 neighbors (or 5 if you include itself): the pixels to the north, south, east, and west. Matti's code also would include northeast, northwest, southeast, and southwest, for a total of 8 (plus self). This is why the 3D neighborhood in this code has 26 elements: 9 from the adjacent plane above, 9 from the adjacent plane below, and 8 from the current plane (excluding self). I haven't thought about it too hard, but I can't think of a quick way to get `grid_to_graph` to include diagonals.