Assume that two metric graphs are joined by gluing a few vertices. We investigate the behaviour of the spectral gap for the corresponding standard Laplacians. It appears that a precise answer can be given in terms of the corresponding Titchmarsh-Weyl (matrix) functions of the two subgraphs, more precisely in terms of their negative spectral subspaces. We illustrate our results by considering explicit examples.