function neighbours = regionQueryE(Sp, Am, n, Ec)
    
    E2 = Ec^2;   
    neighbours = [];
    
    % Get indices of all superpixels connected to superpixel n
    ind = find(Am(n,:));
    
    for i = ind
        % Test if distance^2 < E^2 
        v = Sp(i).value - Sp(n).value;

        if v'*v < E2 
            neighbours = [neighbours i];     
        end
    end