Optimize Boost's BK algorithm
Too many read and writes from the graph make performance about 5-10% slower. Caching values in local variables fixes it.