@@ -38,7 +38,11 @@ MatrixMax12d VertexVertexCandidate::compute_distance_hessian(
3838
3939bool VertexVertexCandidate::operator ==(const VertexVertexCandidate& other) const
4040{
41- return vertex0_id == other.vertex0_id && vertex1_id == other.vertex1_id ;
41+ // (i, j) == (i, j) || (i, j) == (j, i)
42+ return (this ->vertex0_id == other.vertex0_id
43+ && this ->vertex1_id == other.vertex1_id )
44+ || (this ->vertex0_id == other.vertex1_id
45+ && this ->vertex1_id == other.vertex0_id );
4246}
4347
4448bool VertexVertexCandidate::operator !=(const VertexVertexCandidate& other) const
@@ -48,10 +52,13 @@ bool VertexVertexCandidate::operator!=(const VertexVertexCandidate& other) const
4852
4953bool VertexVertexCandidate::operator <(const VertexVertexCandidate& other) const
5054{
51- if (vertex0_id == other.vertex0_id ) {
52- return vertex1_id < other.vertex1_id ;
55+ long this_min = std::min (this ->vertex0_id , this ->vertex1_id );
56+ long other_min = std::min (other.vertex0_id , other.vertex1_id );
57+ if (this_min == other_min) {
58+ return std::max (this ->vertex0_id , this ->vertex1_id )
59+ < std::max (other.vertex0_id , other.vertex1_id );
5360 }
54- return vertex0_id < other. vertex0_id ;
61+ return this_min < other_min ;
5562}
5663
5764} // namespace ipc
0 commit comments