  We analyse the accuracy of radio interferometric gridding of visibilities
with the aim to quantify the Epoch of Reionization (EoR) 21-cm power spectrum
bias caused by gridding, ultimately to determine the suitability of different
imaging algorithms and gridding settings for 21-cm power spectrum analysis. We
simulate realistic LOFAR data, and construct power spectra with convolutional
gridding and w-stacking, w-projection, image domain gridding and without
w-correction. These are compared against directly Fourier transformed data. The
influence of oversampling, kernel size, w-quantization, kernel windowing
function and image padding are quantified. The gridding excess power is
measured with a foreground subtraction strategy, for which foregrounds have
been subtracted using Gaussian progress regression, as well as with a
foreground avoidance strategy.
  Constructing a power spectrum that has a bias significantly lower compared to
the expected EoR signals is possible with the tested methods, but requires a
kernel oversampling factor > 4000 and, when using w-correction, > 500
w-quantization levels. These values are higher than typical values used for
imaging, but are computationally feasible. The kernel size and padding factor
parameters are less crucial. Among the tested methods, image domain gridding
shows the highest accuracy with the lowest imaging time.
  LOFAR 21-cm power spectrum results are not affected by gridding. Image domain
gridding is overall the most suitable algorithm for 21-cm EoR experiments,
including for future SKA EoR analyses. Nevertheless, convolutional gridding
with tuned parameters results in sufficient accuracy. This holds also for
w-stacking for wide-field imaging. The w-projection algorithm is less suitable
because of the kernel oversampling requirements, and a faceting approach is
unsuitable due to the resulting spatial discontinuities.
