Added comparator method to the edge class.