A combinatorial representation for the invariant measure of diffusion processes on metric graphs