Functions for normalised cut
Main code for normalised cut