Factor out the lexcomparator and make a method to get a partition from a centrality matrix