Edmonds–Karp
cut-set
algorithm
network flow
graph theory

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.

Practice algorithms

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

  1. Initialize Flow to 0: Start by initializing the flow from the source to the sink as zero.
  2. 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.
  3. 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.
  4. Update Residual Graph: Update the residual capacities of the edges and reverse edges along the path.
  5. 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

  1. Final Residual Graph: After determining the maximum flow, examine the final residual graph.
  2. 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.
  3. Define Partition: The set of nodes reachable from the source forms the set S, and all other nodes form set T.
  4. 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 G=(V,E)G = (V, E) be the graph, where VV is the set of vertices and EE 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 c(S,T)=uS,vTc(u,v)c(S, T) = \sum_{u \in S, v \in T} c(u,v) where c(u,v)c(u,v) 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:

StepDescription
Initialize FlowStart with a flow of 0
Breadth-First SearchFind shortest augmenting path using BFS
Augment FlowAdd flow using the smallest residual capacity
Update Residual GraphUpdate capacities for forward and backward edges
TerminationStop when no augmenting paths are found
Find Cut-SetUse BFS on final residual graph to identify reachable nodes for S

Additional Details

Complexity

The Edmonds-Karp algorithm operates with a time complexity of O(VE2)O(VE^2), where VV is the number of vertices and EE 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
Course
Intermediate
27 lessons
15 hours
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 course
Track 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.

Practice algorithms

All Rights Reserved.