A Factor Graph Approach to Automated Design of Bayesian Signal Processing Algorithms