Maximum Bipartite Matching
Maximum Bipartite Matching
You are given a bipartite graph with n left nodes and m right nodes. Edges are pairs [u, v] connecting left node u to right node v. Return the size of a maximum matching.
Function signature
func MaxBipartiteMatching(n int, m int, edges [][]int) int
Example
n = 3, m = 3
edges = [[0,0],[0,1],[1,1],[1,2],[2,0]]
output = 3
Constraints
- 0 <= n, m <= 200_000
- 0 <= len(edges) <= 200_000
- 0 <= u < n
- 0 <= v < m
Notes
- Use augmenting paths (Hopcroft-Karp) for efficiency.
Run tests to see results
No issues detected