The c++ code from the LFR paper is... it needs help. Several things need addressing from the code (which is almost entirely a direct copy from what is provided on their website):
Reformatting, the code looks hideous.
Redundancy, a lot of the code is redundant and could be reduced to a handful of key functions.
Style, a lot of the code does not follow modern (or even pre-modern, or even prehistoric) coding conventions for c++
Bugs, there is still an infinite loop bug somewhere.
Rewriting, realistically, the entire LFR c++ code section needs a complete rewrite from the ground up.
The c++ code from the LFR paper is... it needs help. Several things need addressing from the code (which is almost entirely a direct copy from what is provided on their website):