RELABEL-TO-FRONT ALGORITHM
The 'relabel-to-front algorithm' finds the maximum flow in a flow network in time. It is in the class of ''push-relabel algorithms'' for maximum flow which run in . For dense graphs it is more efficient than the Edmonds-Karp algorithm, which runs in time.
Given a flow network with capacity from node ''u'' to node ''v'' given as , and source ''s'' and sink ''t'', we want to find the maximum amount of flow you can send from ''s'' to ''t'' through the network. Two types of operations are performed on nodes, ''push'' and ''relabel''. Throughout we maintain:
★ . Flow from ''u'' to ''v''. Available capacity is .
★ . We only ''push'' from ''u'' to ''v'' if
★ . Sum of flow to and from ''u''.
After each step of the algorithm, the flow is a 'preflow', satisfying:
★ . The flow between and does not exceed the capacity.
★ . We maintain the net flow.
★ for all nodes . Only the source may produce flow.
Notice that the last condition for a preflow is relaxed from the corresponding condition for a legal flow in a regular flow network.
We observe that the longest possible path from ''s'' to ''t'' is nodes long. Therefore it must be possible to assign ''height'' to the nodes such that for any legal flow, and , and if there is a positive flow from ''u'' to ''v'', . As we adjust the height of the nodes, the flow goes through the network as water through a landscape. Differing from algorithms such as Ford-Fulkerson, the flow through the network is not necessarily a legal flow throughout the execution of the algorithm.
In short words, the heights of nodes (except ''s'' and ''t'') is adjusted, and flow is sent between nodes, until all possible flow has reached ''t''. Then we continue increasing the height of internal nodes until all the flow that went into the network, but did not reach ''t'', has flowed back into ''s''. A node can reach the height before this is complete, as the longest possible path back to ''s'' excluding ''t'' is long, and . The height of ''t'' is kept at 0.
A ''push'' from ''u'' to ''v'' means sending a part of the excess flow into ''u'' on to ''v''. Three conditions must be met for a ''push'' to take place:
★ . More flow into the node than out of it so far.
★ . Available capacity from ''u'' to ''v''.
★ . Can only send to lower node.
We send an amount of flow equal to .
Doing a ''relabel'' on a node ''u'' is increasing its height until it is higher than at least one of the nodes it has available capacity to. Conditions for a ''relabel'':
★ . There must be a point in relabelling.
★ for all ''v'' such that . The only nodes we have available capacity to are higher.
When relabelling ''u'', we set to be the lowest value such that for some ''v'' where .
''Push-relabel algorithms'' in general have the following layout:
# As long as there is legal ''push'' or ''relabel'' operation
## Perform a legal push, or
## a legal relabel.
The running time for these algorithms are in general (argument omitted).
In ''relabel-to-front'', a ''discharge'' on a node ''u'' is the following:
# As long as :
## If not all neighbours have been tried since last ''relabel'':
### Try to ''push'' flow to an untried neighbour.
## Else:
### ''Relabel'' ''u''
This requires that for each node, it is known which nodes have been tried since last ''relabel''.
In the ''relabel-to-front algorithm'', the order of the ''push'' and ''relabel'' operations is given:
# Send as much flow from ''s'' as possible.
# Build a list of all nodes except ''s'' and ''t''.
# As long as we have not traversed the entire list:
## ''Discharge'' the current node.
## If the height of the current node changed:
### Move the current node to the front of the list
### Restart the traversal from the start of the list.
The running time for ''relabel-to-front'' is (proof omitted).
Python implementation:
'def' relabel_to_front(C, source, sink):
n = len(C) ''# C is the capacity matrix''
F =
| Contents |
| Algorithm |
| Push |
| Relabel |
| Push-relabel algorithm |
| Discharge |
| Relabel-to-front algorithm |
| Sample implementation |
| References |
Algorithm
Given a flow network with capacity from node ''u'' to node ''v'' given as , and source ''s'' and sink ''t'', we want to find the maximum amount of flow you can send from ''s'' to ''t'' through the network. Two types of operations are performed on nodes, ''push'' and ''relabel''. Throughout we maintain:
★ . Flow from ''u'' to ''v''. Available capacity is .
★ . We only ''push'' from ''u'' to ''v'' if
★ . Sum of flow to and from ''u''.
After each step of the algorithm, the flow is a 'preflow', satisfying:
★ . The flow between and does not exceed the capacity.
★ . We maintain the net flow.
★ for all nodes . Only the source may produce flow.
Notice that the last condition for a preflow is relaxed from the corresponding condition for a legal flow in a regular flow network.
We observe that the longest possible path from ''s'' to ''t'' is nodes long. Therefore it must be possible to assign ''height'' to the nodes such that for any legal flow, and , and if there is a positive flow from ''u'' to ''v'', . As we adjust the height of the nodes, the flow goes through the network as water through a landscape. Differing from algorithms such as Ford-Fulkerson, the flow through the network is not necessarily a legal flow throughout the execution of the algorithm.
In short words, the heights of nodes (except ''s'' and ''t'') is adjusted, and flow is sent between nodes, until all possible flow has reached ''t''. Then we continue increasing the height of internal nodes until all the flow that went into the network, but did not reach ''t'', has flowed back into ''s''. A node can reach the height before this is complete, as the longest possible path back to ''s'' excluding ''t'' is long, and . The height of ''t'' is kept at 0.
Push
A ''push'' from ''u'' to ''v'' means sending a part of the excess flow into ''u'' on to ''v''. Three conditions must be met for a ''push'' to take place:
★ . More flow into the node than out of it so far.
★ . Available capacity from ''u'' to ''v''.
★ . Can only send to lower node.
We send an amount of flow equal to .
Relabel
Doing a ''relabel'' on a node ''u'' is increasing its height until it is higher than at least one of the nodes it has available capacity to. Conditions for a ''relabel'':
★ . There must be a point in relabelling.
★ for all ''v'' such that . The only nodes we have available capacity to are higher.
When relabelling ''u'', we set to be the lowest value such that for some ''v'' where .
Push-relabel algorithm
''Push-relabel algorithms'' in general have the following layout:
# As long as there is legal ''push'' or ''relabel'' operation
## Perform a legal push, or
## a legal relabel.
The running time for these algorithms are in general (argument omitted).
Discharge
In ''relabel-to-front'', a ''discharge'' on a node ''u'' is the following:
# As long as :
## If not all neighbours have been tried since last ''relabel'':
### Try to ''push'' flow to an untried neighbour.
## Else:
### ''Relabel'' ''u''
This requires that for each node, it is known which nodes have been tried since last ''relabel''.
Relabel-to-front algorithm
In the ''relabel-to-front algorithm'', the order of the ''push'' and ''relabel'' operations is given:
# Send as much flow from ''s'' as possible.
# Build a list of all nodes except ''s'' and ''t''.
# As long as we have not traversed the entire list:
## ''Discharge'' the current node.
## If the height of the current node changed:
### Move the current node to the front of the list
### Restart the traversal from the start of the list.
The running time for ''relabel-to-front'' is (proof omitted).
Sample implementation
Python implementation:
'def' relabel_to_front(C, source, sink):
n = len(C) ''# C is the capacity matrix''
F =
This article provided by Wikipedia. To edit the contents of this article, click here for original source.
psst.. try this: add to faves

العربية
中国
Français
Deutsch
Ελληνική
हिन्दी
Italiano
日本語
Português
Русский
Español