public int Compare(Node x, Node y) { if (Math.Abs(x.Distance - y.Distance) < Geom.GetPrecision() && x == y) { return(0); } int res = x.Distance.CompareTo(y.Distance); if (res == 0) { return(x.CompareTo(y)); } return(res); }