Everything you need to understand network flow theory and use the FlowNet visualizer effectively.
Network flow theory is a branch of combinatorial optimization studying flows through networks. A flow network is a directed graph where each edge has a capacity, and the goal is to determine the maximum amount of "flow" that can be sent from a designated source node to a sink node without exceeding any edge's capacity.
FlowNet provides an interactive environment to build flow networks, run algorithms, and observe how flow moves through the graph step by step — making it ideal for students, educators, and researchers.
To create and analyze your first flow network:
1. Add Nodes — In "Add Node" mode, click anywhere on the canvas. The first node becomes the source (S), the last becomes the sink (T). Right-click any node to toggle its type.
2. Add Edges — Switch to "Add Edge" mode, click the source node, then the target. Enter the edge capacity in the prompt.
3. Run Max-Flow — Select an algorithm from the dropdown and click "Run Max Flow." The result is displayed immediately. Use "Step Forward" to walk through each augmenting path one at a time.
You can also load a preset graph using the "Presets" panel on the left.
| Mode | Action | Shortcut |
|---|---|---|
| Add Node | Click canvas to place node | N |
| Add Edge | Click two nodes to connect | E |
| Move | Drag nodes to reposition | M |
| Delete | Click node/edge to remove | Del |
Right-clicking any node cycles its type: Normal → Source → Sink. Source nodes are highlighted in cyan, sinks in orange.
Formally, a flow network G = (V, E) is a directed graph with a capacity function c: E → ℝ≥0, a source s ∈ V, and a sink t ∈ V. A flow f is a function f: E → ℝ that satisfies:
The value of a flow |f| is the total flow leaving the source: |f| = Σ f(s,v) for all v adjacent to s.
The maximum flow problem asks: given a flow network, what is the maximum value of flow that can be routed from source s to sink t? This is one of the most fundamental combinatorial optimization problems with applications ranging from transportation logistics to computer networks and bipartite matching.
One of the most elegant results in graph theory: the maximum value of any flow equals the minimum capacity of any cut separating s from t.
A cut (S, T) partitions V into S (containing s) and T (containing t). The capacity of cut (S, T) is the sum of capacities of edges going from S to T. The max-flow min-cut theorem states that these two quantities are always equal.
The residual graph G_f of a flow network G with respect to flow f contains:
An augmenting path is any path from s to t in the residual graph. The bottleneck of the path is the minimum residual capacity on the path. Pushing flow along this path increases total flow by the bottleneck amount.
The foundational max-flow algorithm, introduced by Ford and Fulkerson in 1956.
The DFS variant may not terminate with irrational capacities. The BFS variant (Edmonds-Karp) always finds the shortest augmenting path and runs in O(VE²).
Dinic's algorithm achieves O(V²E) time by using layered (level) graphs and blocking flows. It is the fastest general-purpose max-flow algorithm for dense graphs.
For unit-capacity networks (all capacities = 1), Dinic's runs in O(E√V), making it extremely efficient for bipartite matching.
Instead of augmenting along paths, push-relabel works locally by maintaining a preflow (allows excess at nodes) and a height labeling.
The HLPPS (Highest Label Pre-flow Push) variant processes the highest active node first, achieving O(V²√E) in practice.
Maximum bipartite matching can be reduced to max-flow. Given bipartite graph G=(L∪R, E):
This runs in O(E√V) with Dinic's algorithm. Load the "Bipartite Match" preset in the Visualizer to see this in action.
| Domain | Application | Model |
|---|---|---|
| Transportation | Road/rail capacity planning | Edge = road segment, capacity = vehicles/hour |
| Networking | Internet bandwidth allocation | Edge = link capacity in Mbps |
| Scheduling | Job-machine assignment | Bipartite matching reduction |
| Image Segmentation | Foreground/background separation | Grid graph, min-cut = segmentation boundary |
| Supply Chain | Distribution optimization | Min-cost max-flow on supply network |
| Baseball Elimination | Team elimination checking | Flow constraint feasibility test |