Modifying Hopcroft-Karp algorithm to get approximate bipartite matching I am trying to find an algorithm to find an $\epsilon$-approximate maximum matching $M_{\epsilon}$ in a bipartite graph in $O(m/\epsilon)$. The partite groups are of equal size, they are $A$ and $B$.  So the graph is:

$$G(A ∪ B, E)\ \ where\ \  |A| = |B| = n, \ \ \ \ E ⊆ A × B \  \ \ and\ \ \  |E| = m$$

The algorithm should produce an $\epsilon$-approximate maximum matching $M_{\epsilon}$ such that:

$$|M_{\epsilon}| \geq (1-\epsilon)M_{optimal} \ \ \ for\ \ \ 0 \leq \epsilon \leq 1$$

I am aware that the Hopcroft-Karp algorithm can produce an $M_{optimal}$ but I have heard one can modify Hopcroft-Karp to produce an $\epsilon$-approximate maximum matching ($M_{\epsilon}$) instead.  I am currently out of ideas in how to approach this.

To clarify: I am only concerned about unweighted matchings.
This is a combination of comments from me and Chandra Chekuri above, elaborated a bit.

As background, if you have a partial matching then its symmetric difference with the optimal matching can be decomposed into disjoint alternating paths (and possibly also some alternating cycles but those can be ignored). Hopcroft–Karp maintains a partial matching as it proceeds in a sequence of stages. Each stage exhausts all the shortest alternating paths left over from the previous stage, and increases the shortest alternating path length by at least two (because the length must be odd). Each stage takes linear time. The exact algorithm can be proven to take $O(\sqrt n)$ stages, leading to a nonlinear total runtime.

First, the additive approximation. If the shortest alternating path length is $k$, then the symmetric difference between your matching and optimal can have at most $n/k$ disjoint alternating paths, so the difference in cardinality between your matching and optimal is at most $n/k$. So if you set $k=1/\epsilon$ for your favorite constant $\epsilon$, and stop after $k/2$ stages, you should get an additive approximation of $\epsilon n$ to the optimal matching, in time $O((m+n)/\epsilon=O(m+n)$.

Now, for a multiplicative approximation, again suppose that the shortest alternating path length is $k$, and observe that each alternating path includes at least $(k-1)/2$ edges that are already part of your matching. So the ratio between the number of edges you already have in the alternating paths and the number you can get by adding one more edge per alternating path is at most $$\frac{k-1}{2}\left/\left(\frac{k-1}{2}+1\right)\right.\approx 1-\frac{2}{k}.$$ Therefore, if you set $k\approx 2/\epsilon$, and again do only $k/2$ stages before stopping, you will get a $(1-\epsilon)$-approximation, again in time $O(m+n)$.