378 copy(i,_first[new_level]); |
378 copy(i,_first[new_level]); |
379 _level[i]=new_level; |
379 _level[i]=new_level; |
380 if(new_level>_highest_active) _highest_active=new_level; |
380 if(new_level>_highest_active) _highest_active=new_level; |
381 } |
381 } |
382 |
382 |
383 ///Mark the node as it did not reach the max level |
383 ///Move an inactive item to the top but one level (in a dirty way). |
384 |
384 |
385 ///Mark the node as it did not reach the max level. It sets the |
385 ///This function moves an inactive item to the top but one level. |
386 ///level to the under the max level value. The node will be never |
386 ///It makes the underlying datastructure corrupt, so use is only if |
387 ///more activated because the push operation from the maximum |
387 ///you really know what it is for. |
388 ///level is forbidden in the push-relabel algorithms. The node |
388 ///\pre The item is on the top level. |
389 ///should be lifted previously to the top level. |
389 void dirtyTopButOne(Item i) { |
390 void markToBottom(Item i) { |
|
391 _level[i] = _max_level - 1; |
390 _level[i] = _max_level - 1; |
392 } |
391 } |
393 |
392 |
394 ///Lift all nodes on and above a level to the top (and deactivate them). |
393 ///Lift all items on and above a level to the top (and deactivate them). |
395 |
394 |
396 ///This function lifts all nodes on and above level \c l to \c |
395 ///This function lifts all items on and above level \c l to \c |
397 ///maxLevel(), and also deactivates them. |
396 ///maxLevel(), and also deactivates them. |
398 void liftToTop(int l) |
397 void liftToTop(int l) |
399 { |
398 { |
400 const Vit f=_first[l]; |
399 const Vit f=_first[l]; |
401 const Vit tl=_first[_max_level]; |
400 const Vit tl=_first[_max_level]; |
747 } |
746 } |
748 |
747 |
749 ///Lift the highest active to top. |
748 ///Lift the highest active to top. |
750 |
749 |
751 ///Lift the item returned by highestActive() to the top level and |
750 ///Lift the item returned by highestActive() to the top level and |
752 ///deactivates the node. |
751 ///deactivates the item. |
753 /// |
752 /// |
754 void liftHighestActiveToTop() { |
753 void liftHighestActiveToTop() { |
755 Item i = _first[_highest_active]; |
754 Item i = _first[_highest_active]; |
756 _level.set(i, _max_level); |
755 _level.set(i, _max_level); |
757 if (_next[i] != INVALID) { |
756 if (_next[i] != INVALID) { |
895 if (_highest_active < new_level) { |
894 if (_highest_active < new_level) { |
896 _highest_active = new_level; |
895 _highest_active = new_level; |
897 } |
896 } |
898 } |
897 } |
899 |
898 |
900 ///Mark the node as it did not reach the max level |
899 ///Move an inactive item to the top but one level (in a dirty way). |
901 |
900 |
902 ///Mark the node as it did not reach the max level. It sets the |
901 ///This function moves an inactive item to the top but one level. |
903 ///level to the under the max level value. The node will be never |
902 ///It makes the underlying datastructure corrupt, so use is only if |
904 ///more activated because the push operation from the maximum |
903 ///you really know what it is for. |
905 ///level is forbidden in the push-relabel algorithms. The node |
904 ///\pre The item is on the top level. |
906 ///should be lifted previously to the top level. |
905 void dirtyTopButOne(Item i) { |
907 void markToBottom(Item i) { |
|
908 _level.set(i, _max_level - 1); |
906 _level.set(i, _max_level - 1); |
909 } |
907 } |
910 |
908 |
911 ///Lift all nodes on and above a level to the top (and deactivate them). |
909 ///Lift all items on and above a level to the top (and deactivate them). |
912 |
910 |
913 ///This function lifts all nodes on and above level \c l to \c |
911 ///This function lifts all items on and above level \c l to \c |
914 ///maxLevel(), and also deactivates them. |
912 ///maxLevel(), and also deactivates them. |
915 void liftToTop(int l) { |
913 void liftToTop(int l) { |
916 for (int i = l + 1; _first[i] != INVALID; ++i) { |
914 for (int i = l + 1; _first[i] != INVALID; ++i) { |
917 Item n = _first[i]; |
915 Item n = _first[i]; |
918 while (n != INVALID) { |
916 while (n != INVALID) { |