2/8/2014: correct outout for format except for order of edges
2/8/14: modified sort methods to work with any array of pointers to edges