DONE: factor_graph.py