* --- automaton to minimise
* @return --- minimised automaton
*/
public final static Automaton minimise(Automaton automaton) {
// First, determine equivalence classes
BinaryMatrix equivs = new BinaryMatrix(automaton.size(),automaton.size(),true);
determineEquivalenceClasses(equivs,automaton);
// TODO: optimise the case when all equivalence classes have unit size.
// Second, determine representative nodes for each equivalence class.
int oldSize = automaton.size();
int[] mapping = new int[oldSize];
int newSize = 0;
for(int i=0;i!=oldSize;++i) {
int classRep = i;
for(int j=0;j<i;++j) {
if(equivs.get(i,j)) {
classRep = j;
break;
}
}
if(i == classRep) {