src/VertexColoring.Graphs/Edge.cs
/// <summary>
/// Compares two edges by comparing their smallest-id vertex and returning the result or, if the result is 0,
/// the result of comparing their other vertex.
/// </summary>
/// <param name="other">The edge to compare this instance to.</param>
/// <returns>0 if both vertices are the same, otherwise depending on numerical order of vertices, positive or negative.</returns>
Compares two edges by comparing their smallest-id vertex and returning the result or, if the result is 0,
the result of comparing their other vertex.
Compares two edges by comparing their smallest - id vertex and returning the result or if the result is 0 the result of comparing their other vertex .
public int CompareTo(Edge other)
        {
            if (other == null) return 1;
            if (ReferenceEquals(this, other)) return 0;
            var (x1, x2) = VerticesAsOrderedTuple();
            var (y1, y2) = other.VerticesAsOrderedTuple();
            var diffOn1 = x1.CompareTo(y1);
            return diffOn1 != 0 ? diffOn1 : x2.CompareTo(y2);
        }
public int CompareTo ( Edge other ) { if ( other == null ) return 1 ; if ( ReferenceEquals ( this , other ) ) return 0 ; var ( x1 , x2 ) = VerticesAsOrderedTuple ( ) ; var ( y1 , y2 ) = other . VerticesAsOrderedTuple ( ) ; var diffOn1 = x1 . CompareTo ( y1 ) ; return diffOn1 != 0 ? diffOn1 : x2 . CompareTo ( y2 ) ; }
Compares two edges by comparing their smallest-id vertex and returning the result or, if the result is 0,
the result of comparing their other vertex.
Compares two edges by comparing their smallest - id vertex and returning the result or if the result is 0 the result of comparing their other vertex .
0 if both vertices are the same, otherwise depending on numerical order of vertices, positive or negative.
0 if both vertices are the same otherwise depending on numerical order of vertices positive or negative .
other
Edge
The edge to compare this instance to.
The edge to compare this instance to .