Edited createFactorGraph()