  We study zero modes of Laplacians on compact and non-compact metric graphs
with general self-adjoint vertex conditions. In the first part of the paper the
number of zero modes is expressed in terms of the trace of a unitary matrix
$\mathfrak{S}$ that encodes the vertex conditions imposed on functions in the
domain of the Laplacian. In the second part a Dirac operator is defined whose
square is related to the Laplacian. In order to accommodate Laplacians with
negative eigenvalues it is necessary to define the Dirac operator on a suitable
Kre\u{\i}n space. We demonstrate that an arbitrary, self-adjoint quantum graph
Laplacian admits a factorisation into momentum-like operators in a
Kre\u{\i}n-space setting. As a consequence, we establish an index theorem for
the associated Dirac operator and prove that the zero-mode contribution in the
trace formula for the Laplacian can be expressed in terms of the index of the
Dirac operator.
