Okay, let's break down network flow.
What is Network Flow?
Network flow is a mathematical model used to represent and analyze the movement of something (like goods, traffic, data, electricity, etc.) through a network of interconnected nodes and edges.
Think of it like a system of pipes:
- Nodes (Vertices): These are points in the network (e.g., junctions, cities, routers).
- Edges (Arcs): These are the connections between nodes, usually directed (e.g., pipes, roads, network cables).
- Capacity: Each edge has a maximum limit on how much "stuff" can flow through it per unit of time (e.g., pipe diameter limits water flow, road size limits traffic).
- Source (s): A special node where the flow originates.
- Sink (t): A special node where the flow terminates.
The key principles governing a valid network flow are:
- Capacity Constraint: The amount of flow through any edge cannot exceed its capacity.
- Conservation of Flow: For any node except the source and the sink, the total flow entering the node must equal the total flow leaving the node. What goes in must come out.
- Non-negativity: The flow on any edge must be non-negative.
A common problem in network flow is finding the maximum flow – the largest total amount of flow that can be sent from the source to the sink while respecting the capacity constraints and conservation principles.
Example:
Let's consider a simple network with capacities on the edges:
- Source (s) to Node A: capacity 10
- Source (s) to Node B: capacity 5
- Node A to Node B: capacity 3
- Node A to Sink (t): capacity 7
- Node B to Sink (t): capacity 8
Now, let's define a specific flow through this network. Suppose we manage to send a total flow of 12 from s to t. A possible valid flow assignment on the edges could be:
- s -> A: flow = 7 (capacity 10)
- s -> B: flow = 5 (capacity 5)
- A -> B: flow = 0 (capacity 3) - Note: Conservation at A: 7 in (from s) - 0 out (to B) - 7 out (to t) = 0
- A -> t: flow = 7 (capacity 7) - Note: Conservation at A: 7 in (from s) = 0 out (to B) + 7 out (to t)
- B -> t: flow = 5 (capacity 8) - Note: Conservation at B: 5 in (from s) + 0 in (from A) = 5 out (to t)
Let's check:
- Flow conservation:
- At A: 7 in (from s) = 0 out (to B) + 7 out (to t). Holds.
- At B: 5 in (from s) + 0 in (from A) = 5 out (to t). Holds.
- Capacity constraints:
- s->A: 7 <= 10 (OK)
- s->B: 5 <= 5 (OK)
- A->B: 0 <= 3 (OK)
- A->t: 7 <= 7 (OK)
- B->t: 5 <= 8 (OK)
- Total flow from s: 7 + 5 = 12. Total flow to t: 7 + 5 = 12.
This is a valid flow of value 12. Now let's identify the types of edges based on this flow:
-
Saturated Edge:
- An edge is saturated if the flow through it is equal to its capacity. No more flow can be pushed along this edge in the current direction.
- In our example:
- Edge s -> B has flow 5 and capacity 5. It is saturated.
- Edge A -> t has flow 7 and capacity 7. It is saturated.
-
Unsaturated Edge:
- An edge is unsaturated if the flow through it is less than its capacity. There is remaining capacity on this edge, meaning potentially more flow could be pushed along it.
- In our example:
- Edge s -> A has flow 7 and capacity 10. It is unsaturated.
- Edge A -> B has flow 0 and capacity 3. It is unsaturated.
- Edge B -> t has flow 5 and capacity 8. It is unsaturated.
-
Slack:
- Slack is the amount of unused capacity on an edge. It is calculated as
Capacity - Flow. Slack is only meaningful for unsaturated edges (where it will be greater than 0). Saturated edges have a slack of 0.
- In our example (for the unsaturated edges):
- Edge s -> A: Slack = Capacity 10 - Flow 7 = 3
- Edge A -> B: Slack = Capacity 3 - Flow 0 = 3
- Edge B -> t: Slack = Capacity 8 - Flow 5 = 3
In summary, understanding saturated and unsaturated edges (and their slack) is crucial in network flow algorithms, especially when trying to find augmenting paths to increase the total flow from source to sink.