public int CompareTo(Node other) { int res = Dist.CompareTo(other.Dist); //if res and other is equal then apply different CompareTo() value (OrderedSet deletes any State if if (res == 0) { return(uniqueIndex.CompareTo(other.uniqueIndex)); } return(res); }