PrincetonUniversity / cpf

Collaborative Parallelization Framework (CPF)
MIT License
31 stars 4 forks source link

Bug fix in EdmondsKarp algorithm #43

Closed vgene closed 1 year ago

vgene commented 1 year ago

Fix bug in EdmonsKarp algorithm. The VertexAndFlow type was defined as std::pair<Vertex,double>, when a previous bug fix changes INFINITY to ~0UL instead of ~0U, the conversion from unsigned int to double then back to unsigned int will overflow and set to 0 ((unsigned int)(double)(~0UL) = 0).

Also in this fix, a clangd configuration file is added to warn this case by adding bugprone-* to ClangTidy.