build_ugm in undirected_graphical_model now includes building factor graph.