How to get the cut-set using the Edmonds–Karp algorithm?
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.
Introduction
In the world of network flow problems, the cut-set and flow augmenting path concepts are crucial. One of the most well-known algorithms for solving flow problems is the Edmonds–Karp algorithm. This article explores the Edmonds-Karp algorithm and how it can be utilized to find the cut-set in a network graph.
Understanding the Edmonds-Karp Algorithm
The Edmonds-Karp algorithm is an implementation of the Ford-Fulkerson method for computing the maximum flow in a flow network. It uses a breadth-first search (BFS) approach to repeatedly find the shortest augmenting paths from the source (S) to the sink (T), maximizing the flow along these paths until no more augmenting paths exist.
Key Steps in the Algorithm
- Initialize Flow to 0: Start by initializing the flow from the source to the sink as zero.
- Breadth-First Search: Perform a BFS to find the shortest path (in terms of edge count) from the source to the sink with available capacity.
- Augment Flow: Once an augmenting path is found, increase the flow along the path by the minimum residual capacity of the edges in the path.
- Update Residual Graph: Update the residual capacities of the edges and reverse edges along the path.
- Repeat: Continue the process until no more augmenting paths exist in the residual graph.
The algorithm terminates when a BFS is unable to find an augmenting path, indicating that the current flow is maximum.
Finding the Cut-Set
Once the Edmonds-Karp algorithm has found the maximum flow, we can identify the cut-set in the network. The cut-set in a flow network is a partition of the vertices into two disjoint subsets (S, T), where one subset (S) contains the source, and the other subset (T) contains the sink.
Process for Finding the Cut-Set
- Final Residual Graph: After determining the maximum flow, examine the final residual graph.
- Reachable Vertices via BFS from Source: Use BFS starting from the source node to discover all nodes that are reachable in the residual graph with available capacity.
- Define Partition: The set of nodes reachable from the source forms the set S, and all other nodes form set T.
- Cut-Set Edges: The cut-set comprises edges going from nodes in S to nodes in T in the original graph. These are the edges that are fully utilized at full capacity.
Example
Consider a simple network with:
• Nodes: Source (S), A, B, Sink (T) • Edges and capacities: • S -> A: 10 • S -> B: 5 • A -> B: 15 • A -> T: 10 • B -> T: 10
By applying the Edmonds-Karp algorithm, we find a maximum flow. After running a BFS on the residual graph from S, assume nodes S and A are reachable, forming set S, and nodes B and T form set T.
Thus, the cut-set edges would be from: • A to T (capacity fully used)
Technical Explanation
The cut-set can be formally described using set notation as follows:
• Let be the graph, where is the set of vertices and is the set of edges. • A cut (S, T) is a partition of V such that S includes the source and T includes the sink. • The capacity of the cut is defined as where is the capacity of edge (u, v). • The Min-Cut Max-Flow theorem states that the maximum flow in the network is equal to the capacity of the minimum cut.
Summary Table
Below is a table that summarizes the key points of the Edmonds-Karp algorithm and the cut-set identification process:
| Step | Description |
| Initialize Flow | Start with a flow of 0 |
| Breadth-First Search | Find shortest augmenting path using BFS |
| Augment Flow | Add flow using the smallest residual capacity |
| Update Residual Graph | Update capacities for forward and backward edges |
| Termination | Stop when no augmenting paths are found |
| Find Cut-Set | Use BFS on final residual graph to identify reachable nodes for S |
Additional Details
Complexity
The Edmonds-Karp algorithm operates with a time complexity of , where is the number of vertices and is the number of edges. This is efficient for many practical applications.
Applications
The cut-set is instrumental in various applications: • Network reliability • Communication network design • Understanding connectivity in neural networks
Drawbacks
While the Edmonds-Karp algorithm is robust, it may not be as efficient on extremely large networks with high edge density compared to more sophisticated algorithms like Dinic's Algorithm.
Conclusion
The Edmonds-Karp algorithm provides a reliable method to compute the maximum flow in a network graph and find the associated cut-set. Understanding these concepts is vital for solving complex network flow problems in computer science, logistics, and communications.
Related reading
- How to get the iterator for a successful binary_search?
- How to get the K smallest Products from pairs from two sorted Arrays?
- How to get the smallest in lexicographical order?
- How to implement 3 stacks with one array?
- How to get the difference between two arrays in JavaScript?
- How to get the dimensions of a tensor in TensorFlow at graph construction time?
- How to implement a better sliding window algorithm?
- How to implement a binary tree?

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.