<p>We derive attainable upper bounds on the algebraic connectivity (spectral gap) of a regular graph in terms of its diameter and girth. This bound agrees with the well-known Alon–Boppana–Friedman bound for graphs of even diameter, but is an improvement for graphs of odd diameter. For the girth bound, we show that only Moore graphs can attain it, and these only exist for well-known special cases. For the diameter bound, we use a combination of stochastic algorithms and exhaustive search to find graphs which attain it. For 3-regular graphs, we find attainable graphs for all diameters <span></span><math>