public int GetHashCode(WeightedEdge <T> obj) { unchecked { var hashCode = _comparer.GetHashCode(obj.Source) + _comparer.GetHashCode(obj.Destination); hashCode = (hashCode * 397) ^ obj.Weight; return(hashCode); } }
public bool Equals(WeightedEdge <T> left, WeightedEdge <T> right) { if (ReferenceEquals(left, right)) { return(true); } if (ReferenceEquals(left, null)) { return(false); } if (ReferenceEquals(right, null)) { return(false); } if (left.GetType() != right.GetType()) { return(false); } return(_comparer.Equals(left.Source, right.Source) && _comparer.Equals(left.Destination, right.Destination) && left.Weight == right.Weight); }