_source->distance_from_source = 0;
_source->decrease_distance_in_heap(_heap);
- while(heap_size > 1) {
+ while(heap_size > 1) {
// Get the closest to the source
v = _heap[0];
}
while(already_processed < front) {
+ // Here, nodes before already_processed can be ignored, nodes
+ // before front were set to 0 predecessors during the previous
+ // iteration. During this new iteration, we have to visit the
+ // successors of these ones only, since they are the only ones
+ // which may end up with no predecessors.
new_front = front;
while(already_processed < front) {
v = *(already_processed++);