... | ... |
@@ -576,12 +576,18 @@ |
576 | 576 |
void startFirstPhase() { |
577 | 577 |
_phase = true; |
578 | 578 |
|
579 |
Node n = _level->highestActive(); |
|
580 |
int level = _level->highestActiveLevel(); |
|
581 |
while ( |
|
579 |
while (true) { |
|
582 | 580 |
int num = _node_num; |
583 | 581 |
|
584 |
|
|
582 |
Node n = INVALID; |
|
583 |
int level = -1; |
|
584 |
|
|
585 |
while (num > 0) { |
|
586 |
n = _level->highestActive(); |
|
587 |
if (n == INVALID) goto first_phase_done; |
|
588 |
level = _level->highestActiveLevel(); |
|
589 |
--num; |
|
590 |
|
|
585 | 591 |
Value excess = (*_excess)[n]; |
586 | 592 |
int new_level = _level->maxLevel(); |
587 | 593 |
|
... | ... |
@@ -647,14 +653,22 @@ |
647 | 653 |
} else { |
648 | 654 |
_level->deactivate(n); |
649 | 655 |
} |
650 |
|
|
651 |
n = _level->highestActive(); |
|
652 |
level = _level->highestActiveLevel(); |
|
653 |
--num; |
|
654 | 656 |
} |
655 | 657 |
|
656 | 658 |
num = _node_num * 20; |
657 |
while (num > 0 |
|
659 |
while (num > 0) { |
|
660 |
while (level >= 0 && _level->activeFree(level)) { |
|
661 |
--level; |
|
662 |
} |
|
663 |
if (level == -1) { |
|
664 |
n = _level->highestActive(); |
|
665 |
level = _level->highestActiveLevel(); |
|
666 |
if (n == INVALID) goto first_phase_done; |
|
667 |
} else { |
|
668 |
n = _level->activeOn(level); |
|
669 |
} |
|
670 |
--num; |
|
671 |
|
|
658 | 672 |
Value excess = (*_excess)[n]; |
659 | 673 |
int new_level = _level->maxLevel(); |
660 | 674 |
|
... | ... |
@@ -720,19 +734,9 @@ |
720 | 734 |
} else { |
721 | 735 |
_level->deactivate(n); |
722 | 736 |
} |
723 |
|
|
724 |
while (level >= 0 && _level->activeFree(level)) { |
|
725 |
--level; |
|
726 |
} |
|
727 |
if (level == -1) { |
|
728 |
n = _level->highestActive(); |
|
729 |
level = _level->highestActiveLevel(); |
|
730 |
} else { |
|
731 |
n = _level->activeOn(level); |
|
732 |
} |
|
733 |
--num; |
|
734 | 737 |
} |
735 | 738 |
} |
739 |
first_phase_done:; |
|
736 | 740 |
} |
737 | 741 |
|
738 | 742 |
/// \brief Starts the second phase of the preflow algorithm. |
0 comments (0 inline)