Added a contains function to the FactorGraph interface