Changeset 2518:4c0a23bd70b5 in lemon-0.x
- Timestamp:
- 11/21/07 14:34:38 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3394
- Location:
- lemon
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/elevator.h
r2512 r2518 51 51 class Elevator 52 52 { 53 p rivate:53 public: 54 54 55 55 typedef Item Key; 56 56 typedef int Value; 57 58 private: 57 59 58 60 typedef typename std::vector<Item>::iterator Vit; … … 377 379 _level[i]=new_level; 378 380 if(new_level>_highest_active) _highest_active=new_level; 381 } 382 383 ///Mark the node as it did not reach the max level 384 385 ///Mark the node as it did not reach the max level. It sets the 386 ///level of the node to a low value, which is not connected to the 387 ///real levels of elevator. The node should be lifted previously 388 ///to the top level. 389 void markToBottom(Item i) { 390 _level[i] = - _max_level; 379 391 } 380 392 … … 492 504 template <class Graph, class Item> 493 505 class LinkedElevator { 494 p rivate:506 public: 495 507 496 508 typedef Item Key; 497 509 typedef int Value; 510 511 private: 498 512 499 513 typedef typename ItemSetTraits<Graph,Item>:: … … 883 897 } 884 898 899 ///Mark the node as it did not reach the max level 900 901 ///Mark the node as it did not reach the max level. It sets the 902 ///level of the node to a low value, which is not connected to the 903 ///real levels of elevator. The node should be lifted previously 904 ///to the top level. 905 void markToBottom(Item i) { 906 _level[i] = - _max_level; 907 } 908 885 909 ///Lift all nodes on and above a level to the top (and deactivate them). 886 910 -
lemon/goldberg_tarjan.h
r2514 r2518 396 396 _node_num = countNodes(_graph); 397 397 398 _max_tree_size = (double(_node_num) * double(_node_num)) /399 double(countEdges(_graph));398 _max_tree_size = int((double(_node_num) * double(_node_num)) / 399 double(countEdges(_graph))); 400 400 401 401 if (!_flow) { … … 828 828 829 829 for (NodeIt n(_graph); n != INVALID; ++n) { 830 if ((*_excess)[n] > 0 && _target != n) { 830 if (!reached[n]) { 831 _level->markToBottom(n); 832 } else if ((*_excess)[n] > 0 && _target != n) { 831 833 _level->activate(n); 832 834 } -
lemon/preflow.h
r2514 r2518 712 712 _phase = false; 713 713 714 typename Graph::template NodeMap<bool> reached(_graph , false);714 typename Graph::template NodeMap<bool> reached(_graph); 715 715 for (NodeIt n(_graph); n != INVALID; ++n) { 716 716 reached.set(n, (*_level)[n] < _level->maxLevel()); … … 752 752 753 753 for (NodeIt n(_graph); n != INVALID; ++n) { 754 if ((*_excess)[n] > 0 && _target != n) { 754 if (!reached[n]) { 755 _level->markToBottom(n); 756 } else if ((*_excess)[n] > 0 && _target != n) { 755 757 _level->activate(n); 756 758 }
Note: See TracChangeset
for help on using the changeset viewer.