template<class GR, class Item>
class lemon::Elevator< GR, Item >
A class for handling "labels" in push-relabel type algorithms.
Using this class you can assign "labels" (nonnegative integer numbers) to the edges or nodes of a graph, manipulate and query them through operations typically arising in "push-relabel" type algorithms.
Each item is either active or not, and you can also choose a highest level active item.
- See Also
- LinkedElevator
- Parameters
-
| GR | Type of the underlying graph. |
| Item | Type of the items the data is assigned to (GR::Node, GR::Arc or GR::Edge). |
|
| | Elevator (const GR &graph, int max_level) |
| | Constructor with given maximum level. More...
|
| |
| | Elevator (const GR &graph) |
| | Constructor. More...
|
| |
| void | activate (Item i) |
| | Activate item i. More...
|
| |
| void | deactivate (Item i) |
| | Deactivate item i. More...
|
| |
|
bool | active (Item i) const |
| | Query whether item i is active.
|
| |
|
int | operator[] (Item i) const |
| | Return the level of item i.
|
| |
|
int | onLevel (int l) const |
| | Return the number of items on level l.
|
| |
|
bool | emptyLevel (int l) const |
| | Return true if level l is empty.
|
| |
|
int | aboveLevel (int l) const |
| | Return the number of items above level l.
|
| |
|
int | activesOnLevel (int l) const |
| | Return the number of active items on level l.
|
| |
|
bool | activeFree (int l) const |
| | Return true if there is no active item on level l.
|
| |
|
int | maxLevel () const |
| | Return the maximum allowed level.
|
| |
| void | lift (Item i, int new_level) |
| | Lift an active item to a higher level. More...
|
| |
| void | dirtyTopButOne (Item i) |
| | Move an inactive item to the top but one level (in a dirty way). More...
|
| |
| void | liftToTop (int l) |
| | Lift all items on and above the given level to the top level. More...
|
| |
|
Functions for working with the highest level active item.
|
| Item | highestActive () const |
| | Return a highest level active item. More...
|
| |
| int | highestActiveLevel () const |
| | Return the highest active level. More...
|
| |
| void | liftHighestActive () |
| | Lift the highest active item by one. More...
|
| |
| void | liftHighestActive (int new_level) |
| | Lift the highest active item to the given level. More...
|
| |
| void | liftHighestActiveToTop () |
| | Lift the highest active item to the top level. More...
|
| |
|
Functions for working with the active items.
|
| Item | activeOn (int l) const |
| | Return an active item on level l. More...
|
| |
| Item | liftActiveOn (int level) |
| | Lift the active item returned by activeOn(level) by one. More...
|
| |
| void | liftActiveOn (int level, int new_level) |
| | Lift the active item returned by activeOn(level) to the given level. More...
|
| |
| void | liftActiveToTop (int level) |
| | Lift the active item returned by activeOn(level) to the top level. More...
|
| |
|
Using these functions you can initialize the levels of the items.
The initialization must be started with calling initStart(). Then the items should be listed level by level starting with the lowest one (level 0) using initAddItem() and initNewLevel(). Finally initFinish() must be called. The items not listed are put on the highest level.
|
|
void | initStart () |
| | Start the initialization process.
|
| |
|
void | initAddItem (Item i) |
| | Add an item to the current level.
|
| |
| void | initNewLevel () |
| | Start a new level. More...
|
| |
|
void | initFinish () |
| | Finalize the initialization process.
|
| |