![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
Example for computing the maximum flow using a Ford-Fulkerson type algorithm. More...
Public Member Functions | |
MaxFlowExample () | |
create application More... | |
void | computeMaxFlow (MyGraph g) |
main algorithm (calls findAugmentingPath and addPath More... | |
![]() | |
SingleStepper (JFrame parent) | |
create new instance More... | |
SingleStepper (String caption) | |
create new instance More... | |
JFrame | parent () |
get parent widget More... | |
void | halt (String text, int timeout) |
display text and wait for user or timeout More... | |
void | setTimeout (int timeout) |
Set global timeout. More... | |
SingleStepper | whereAmI () |
print location of calling code More... | |
SingleStepper | showSource () |
jmp to caller's location in editor (emacs only) More... | |
void | halt (String text) |
display text and wait for user (or global timeout) More... | |
void | halt () |
wait for user More... | |
Static Public Member Functions | |
static void | main (String[] args) |
example (see also usage ) More... | |
static void | main (String[] args) |
Protected Member Functions | |
void | onHalt () |
![]() | |
JComponent | createComponents () |
void | onNext () |
call on button pressed More... | |
void | println (String text) |
print to both, text area and stdout More... | |
void | onHalt () |
Static Protected Member Functions | |
static void | usage () |
static MyGraph | createGraph () |
create a small example graph More... | |
Protected Attributes | |
DotViewer | viewer_ |
![]() | |
JFrame | frame |
JTextArea | history |
JButton | next |
Object | monitor = new Object() |
int | timeout = 0 |
Example for computing the maximum flow using a Ford-Fulkerson type algorithm.
Actually, the class implements the Edmonds-Karp algorithm, which uses a breadth-first search to find augmenting paths.
The main part of the algorithm is found in computeMaxFlow
calling #findAugmentingPath
and #addPath
The implementation manipulates the graph and temporarily adds backward edges to model the return flow.
Definition at line 21 of file MaxFlowExample.java.
create application
Definition at line 34 of file MaxFlowExample.java.
void aud.example.graph.MaxFlowExample.computeMaxFlow | ( | MyGraph | g | ) |
main algorithm (calls findAugmentingPath
and addPath
Definition at line 60 of file MaxFlowExample.java.
|
staticprotected |
create a small example graph
Definition at line 239 of file MaxFlowExample.java.
References aud.graph.GraphAM< Node extends AbstractNode, Edge extends AbstractEdge >.addEdge(), aud.graph.GraphAM< Node extends AbstractNode, Edge extends AbstractEdge >.addNode(), aud.graph.SimpleNode.setLabel(), and aud.graph.SimpleNode.setPosition().
|
static |
example (see also usage
)
Reimplemented from aud.util.SingleStepper.
Definition at line 257 of file MaxFlowExample.java.
|
protected |
Reimplemented from aud.util.SingleStepper.
Definition at line 29 of file MaxFlowExample.java.
References aud.util.DotViewer.display(), and aud.example.graph.MaxFlowExample.viewer_.
|
staticprotected |
Definition at line 231 of file MaxFlowExample.java.
|
protected |
Definition at line 26 of file MaxFlowExample.java.
Referenced by aud.example.graph.MaxFlowExample.onHalt().