/// <summary> /// Indicates whether the current <see cref="DirectedWeightedEdge{TVertex}"/> /// is equal to another <see cref="DirectedWeightedEdge{TVertex}"/>. /// </summary> /// <param name="other"> /// The <see cref="DirectedWeightedEdge{TVertex}"/> to compare with this /// object. /// </param> /// <returns> /// <see langword="true"/> if the other /// <see cref="DirectedWeightedEdge{TVertex}"/> is equal to this /// <see cref="DirectedWeightedEdge{TVertex}"/>; otherwise, /// <see langword="false"/>. /// </returns> /// <seealso cref="IEquatable{T}.Equals(T)"/> public bool Equals(DirectedWeightedEdge <TVertex> other) { if (other == null) { return(false); } return((SourceVertex.Equals(other.SourceVertex) && DestinationVertex.Equals(other.DestinationVertex)) && Weight.Equals(other.Weight)); }
/// <summary> /// Gets a hash code for this <see cref="DirectedWeightedEdge{TVertex}"/>. /// </summary> /// <returns> /// A hash code for the current <see cref="DirectedWeightedEdge{TVertex}"/>. /// </returns> public override int GetHashCode() { return(SourceVertex.GetHashCode() ^ DestinationVertex.GetHashCode() ^ Weight.GetHashCode()); }