fixed graph sorting algorithm. 12F 24E