added graph cut and unit-test

make sure in general energy is negative.