added graph cut and unit-test

Not sure why add m_num_factors_at_order3. In fact, I am not sure how order 3 works here. Could you point out a reference for this?