In Remark 6.3 of their paper on the spectral gap of a quantum graph, Kennedy, Kurasov, Malenová and Mugnolo bound the spectral gap μ₂ of the Kirchhoff Laplacian on a compact metric graph with diameter D and E edges by π²/E² ≤ μ₂D² ≤ 4π²E², and ask for the optimal constants and optimisers for each E. We determine both constants to leading order, and exactly with their optimisers for E ≤ 4. The largest value of μ₂D² is (1+o(1)) log²E: every graph satisfies √μ₂·D ≤ log(8e²(E+1)), and chains of bundles of parallel edges with exponentially decaying sizes attain the coefficient 1. The smallest value is (16+o(1))/E: every graph satisfies μ₂D² ≥ 16/(E+9), and two bundles of loops joined by an edge give less than 16/(E−2). With δ = arctan(1/(2√2)), the minima for two, three and four edges are (π−δ)², 16 arctan²(1/√2) and 4(arctan(1/√2)+arctan(1/2))², and the maxima are (π+δ)², (π+δ)² and (π+2δ)², each with a unique optimiser; the four-edge maximum has a computer-assisted proof. For the first eigenvalue λ₁ with Dirichlet conditions on a nonempty vertex set and the inradius R, the extreme values of λ₁R² over graphs with E edges are (1/4+o(1)) log²E and (2+o(1))/E. The upper bounds hold also in terms of the first Betti number and of total length; for the mean distance ρ, μ₂ρ² is of order log²E, attained by Ramanujan graphs. The proofs use the coarea formula, a Riccati inequality, torsion functions, Prüfer angles and Green functions.
