Gaussian estimates on networks with applications to optimal control