Add parent child case selection graph cycle detection

Addresses: http://manage.dimagi.com/default.asp?136721

Adds a build error if there are cycles in the parent child selection graph. I was also inspired by the dev summit to write a test :stuck_out_tongue_winking_eye: