Variational construction of connecting orbits between Legendrian graphs