java.lang.Object | +--PushRelabel
| Constructor Summary | |
PushRelabel(Digraph g,
EdgeRProperty capacity,
Vertex s,
Vertex t,
PushRelabelVisitor visitor)
Prepares an instance for the MAX-FLOW-PROBLEM. |
|
| Method Summary | |
EdgeRProperty |
getFlow()
|
void |
init()
Prepares this instance to execute the Preflow-Push-Relabel algorithm once. |
static void |
main(String[] argv)
Reads file argv[0] which should contain properties capacity and label, constructs new PushRelabel instance, calls run and getFlow on it. |
void |
run()
Executes the Preflow-Push-Relabel algorithm to construct a maximal flow for the network encoded by this instance. |
static boolean |
targetReachableFromSource(Digraph g,
Vertex source,
Vertex target)
Just performs a recursive depth-first-search to decide whether there exists a directed source->target path in
the digraph g. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PushRelabel(Digraph g,
EdgeRProperty capacity,
Vertex s,
Vertex t,
PushRelabelVisitor visitor)
throws IllegalArgumentException
run(), the result is available through getFlow().
null.
capacity-property must be defined for
the given digraph g, as well as s
and t must belong to g.
capacity-property must be
convertable to an integer edge property.
t must be reachable from
the source s
g - the digraph in which you want to construct a MAX-FLOWcapacity - the upper capacities of the edges, where we
assume the lower capacities to be always zeros - the source of the MAX-FLOW to be constructedt - the target of the MAX-FLOW to be constructedvisitor - a visitor for logging important steps of the algorithmIllegalArgumentException - iff one of the above preconditions
mentioned above is not fulfilled by the parametersrun(),
getFlow(),
targetReachableFromSource(Digraph, Vertex, Vertex),
GraphPropertyFactory#convert2IntEdgeProperty(gabl.hier.EdgeListGraph, EdgeRProperty)| Method Detail |
public static boolean targetReachableFromSource(Digraph g,
Vertex source,
Vertex target)
source->target path in
the digraph g.public void init()
init in interface AnimatedAlgorithmpublic void run()
getFlow().
As this is an intelligent run, it calls init(),
if necessary.run in interface AnimatedAlgorithmgetFlow(),
init()
public EdgeRProperty getFlow()
throws IllegalStateException
IllegalStateException - if either there is no flow available
because run() has not yet been invoked,
or an internal error prevented PushRelabel to construct a flowpublic static void main(String[] argv)