Potential theory on graphs and applications to continuous problems