Search code examples
algorithmnetwork-flow

how to reduce Maximum cardinality bipartite matching to minimum path cover?


I have read these two questions : link1 link2

and also this wikipedia

but i can't understand how solving maximum matching problem can be used to solve minimum path cover. I know the solution is n-m where n is the number of vertices in G and m is the maximum matching but i can't find the reason


Solution

  • Here is an intuitive explanation of this fact(it is not a rigorous proof): Let's take a look at each path in a path cover. Every vertex, except the first one in a path, has a unique predecessor. Moreover, each vertex has exactly one successor(except the last on in each path). That's why we can say that each vertex is matched to its predecessor. If a vertex is not matched to anything, it is the first vertex in some path. That's why the number of paths is equal to the number of unmatched vertices(each path has exactly one first vertex). The number of unmatched vertices is obviously equal to the total number of vertices minus the number of matched vertices. That's how we get n - m formula. It is not possible to get less paths then the size of a maximum matching(otherwise n - m1 < n - m => m1 > m => m is not maximum). At the same time, we can construct a solution with n - m paths explicitly.