@decorator_util.jit()<EOL>def voronoi_neighbors_from_pixels_and_ridge_points(pixels, ridge_points):
pixel_neighbors_size = np.zeros(shape=(pixels))<EOL>for ridge_index in range(ridge_points.shape[<NUM_LIT:0>]):<EOL><INDENT>pair0 = ridge_points[ridge_index, <NUM_LIT:0>]<EOL>pair1 = ridge_points[ridge_index, <NUM_LIT:1>]<EOL>pixel_neighbors_size[pair0] += <NUM_LIT:1><EOL>pixel_neighbors_size[pair1] += <NUM_LIT:1><EOL><DEDENT>pixel_neighbors_index = np.zeros(shape=(pixels))<EOL>pixel_neighbors = -<NUM_LIT:1> * np.ones(shape=(pixels, int(np.max(pixel_neighbors_size))))<EOL>for ridge_index in range(ridge_points.shape[<NUM_LIT:0>]):<EOL><INDENT>pair0 = ridge_points[ridge_index, <NUM_LIT:0>]<EOL>pair1 = ridge_points[ridge_index, <NUM_LIT:1>]<EOL>pixel_neighbors[pair0, int(pixel_neighbors_index[pair0])] = pair1<EOL>pixel_neighbors[pair1, int(pixel_neighbors_index[pair1])] = pair0<EOL>pixel_neighbors_index[pair0] += <NUM_LIT:1><EOL>pixel_neighbors_index[pair1] += <NUM_LIT:1><EOL><DEDENT>return pixel_neighbors, pixel_neighbors_size<EOL>
Compute the neighbors of every pixel as a list of the pixel index's each pixel shares a vertex with.

    The ridge points of the Voronoi grid are used to derive this.

    Parameters
    ----------
    ridge_points : scipy.spatial.Voronoi.ridge_points
        Each Voronoi-ridge (two indexes representing a pixel mapping_matrix).