  We investigate existence and nonexistence of action ground states and nodal
action ground states for the nonlinear Schr\"odinger equation on noncompact
metric graphs with rather general boundary conditions. We first obtain abstract
sufficient conditions for existence, typical of problems with lack of
compactness, in terms of ``levels at infinity'' for the action functional
associated with the problems. Then we analyze in detail two relevant classes of
graphs. For noncompact graphs with finitely many edges, we detect purely
topological sharp conditions preventing the existence of ground states or of
nodal ground states. We also investigate analogous conditions of metrical
nature. The negative results are complemented by several sufficient conditions
to ensure existence, either of topological or metrical nature, or a combination
of the two. For graphs with infinitely many edges, all bounded, we focus on
periodic graphs and infinite trees. In these cases, our results completely
describe the phenomenology. Furthermore, we study nodal domains and nodal sets
of nodal ground states and we show that the situation on graphs can be totally
different from that on domains of $\mathbb{R}^N$.
