In this work we present a three step procedure for generating a closed form
expression of the Green's function on both closed and open finite quantum
graphs with general self-adjoint matching conditions. We first generalize and
simplify the approach by Barra and Gaspard [Barra F and Gaspard P 2001, Phys.
Rev. E {\bf 65}, 016205] and then discuss the validity of the explicit
expressions. For compact graphs, we show that the explicit expression is
equivalent to the spectral decomposition as a sum over poles at the discrete
energy eigenvalues with residues that contain projector kernel onto the
corresponding eigenstate. The derivation of the Green's function is based on
the scattering approach, in which stationary solutions are constructed by
treating each vertex or subgraph as a scattering site described by a scattering
matrix. The latter can then be given in a simple closed form from which the
Green's function is derived. The relevant scattering matrices contain inverse
operators which are not well defined for wave numbers at which bound states in
the continuum exists. It is shown that the singularities in the scattering
matrix related to these bound states or perfect scars can be regularised.
Green's functions or scattering matrices can then be expressed as a sum of a
regular and a singular part where the singular part contains the projection
kernel onto the perfect scar