The maximum s-t flow has a value of 6
A typical application of graphs is using them to represent networks of transportation infrastructure e.g. for distributing water, electricity or data. In order capture the limitations of the network it is useful to annotate the edges in the graph with capacities that model how much resource can be carried by that connection.
An interesting property of networks like this is how much of the resource can simulateneously be transported from one point to another - the maximum flow problem.
Node | |
S/T node | |
Edge with capacity 10 and flow 7. | |
Edge in the residual graph. | |
Edge on augmenting path. |
Click on a node to select it as the source/starting node s
Click on a node to select it as the target/sink node t
Now the algorithm can begin. Click on next to start it
Set f(e) = 0 for all edges in the graph.
The main loop repeatedly looks for augmenting paths to increase the total flow and adds them to the total flow.
We now look at the residual graph associated with the current flow. The algorithm looks for an augmenting path that connects s and t.
Check if the search is finished. Either finish by expanding t expanded, run out of nodes, or continue expaning.
Pick the next node from the queue to expand and mark the neighbours. Unvisited neighbours are added to the expansion list.
Clear the path and start reconstructing from t.
The flow is increased along the augmenting path until one edge in the residual graph saturates.
The algorithm terminated with a maximum flow value of:
s ← pick(v)
t ← pick(v)
BEGIN
(* Initializing the flow *)
FOR { e ∈ E } DO
f(e) ← 0
(* Main Loop *)
WHILE path might exist DO
path ← FIND_PATH(s,t)
augmentation ← min(e ∈ path)
FOR {e ∈ path}
flow(e) ← flow(e) + augmentation
END
path | augmentation |
---|---|
{} | 0 |
You can open the app in another browser window,f you want to keep reading in parallel.