  We study the problem of minimizing or maximizing the fundamental spectral gap
of Schr\"odinger operators on metric graphs with either a convex potential or a
``single-well'' potential on an appropriate specified subset. (In the case of
metric trees, such a subset can be the entire graph.) In the convex case we
find that the minimizing and maximizing potentials are piecewise linear with
only a finite number of points of non-smoothness, but give examples showing
that the optimal potentials need not be constant. This is a significant
departure from the usual scenarios on intervals and domains where the constant
potential is typically minimizing. In the single-well case we show that the
optimal potentials are piecewise constant with a finite number of jumps, and in
both cases give an explicit estimate on the number of points of non-smoothness,
respectively jumps, the minimizing potential can have. Furthermore, we show
that, unlike on domains, it is not generally possible to find nontrivial bounds
on the fundamental gap in terms of the diameter of the graph alone, within the
given classes.
