Remove self loops in RAG

- Removes self loops in RAG
- Handles NCut case where self loops are required

This will result in much cleaner code, as seen in #1100