3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

Merge pull request #1799 from c-cube/fix-union-find

fix(union-find): keep values and representative in consistent order
This commit is contained in:
Nikolaj Bjorner 2018-08-18 05:51:01 -07:00 committed by GitHub
commit d6298b089d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,8 +122,10 @@ public:
TRACE("union_find", tout << "merging " << r1 << " " << r2 << "\n";);
if (r1 == r2)
return;
if (m_size[r1] > m_size[r2])
if (m_size[r1] > m_size[r2]) {
std::swap(r1, r2);
std::swap(v1, v2);
}
m_ctx.merge_eh(r2, r1, v2, v1);
m_find[r1] = r2;
m_size[r2] += m_size[r1];