# Reducing a minimum cost edge-cover problem to minimum cost weighted bipartie perfect matching

I have a set of edges [m,n] of a bipartie graph U, V with a cost assigned to each edge and I need to find the minimum cost edge-cover covering all nodes in U, V. There is one additional constraint is that I should not have a length 3 path ( meaning if m in [m,n] is included in other edges then n should not happen on other edges than [m,n] )

I have read that this problem can be reduced to a minimum cost weighted bipartie perfect matching, but I could not find the way to do that.

The relation is not straightforward to me since a node m can be connected to different nodes in the right hand partie and vice versa.

-
It should be MAXIMUM matching； a minimum matching can be nothing than an empty set. Hint: An edge-cover is a superset of the max matching. Your additional constraint is redundant, and can be derived from the "minimum cost". –  Yixin Cao Dec 10 '12 at 14:06
I meant minimum cost of a weighted bipartie matching, if you are talking about the title. If so I can reformulate it this way –  Sadache Dec 10 '12 at 14:37
have you ever checked the definition of "matching"? –  Yixin Cao Dec 10 '12 at 18:19
Sadache, the confusion is that if all weights are positive, then the minimum cost matching is just an empty set. what makes more sense is consider the minimum cost matching of cardinality $k$. then a sensible choice for $k$ is the maximum cardinality of any matching in the graph. –  Sasho Nikolov Dec 10 '12 at 20:09
I think the problem of finding a minimum cost edge cover, without the path length constraint, would not be research level. But with the constraint (and with negative edges) it seems nontrivial enough to me, so I am upvoting this. –  David Eppstein Dec 31 '12 at 21:45

If all edge weights are non-negative, then the minimum weight set of edges that covers all the nodes automatically has the property that it has no three-edge paths, because the middle edge of any such path would be redundant. If we assign each vertex to an edge that covers it, some edges will cover both of their endpoints (forming a matching $M$) and others will cover only one of their endpoints (and must be the minimum weight edge adjacent to the covered endpoint). If we let $c_v$ be the cost of the minimum weight edge incident to vertex $v$, and $w_e$ be the weight of $e$, then the cost of a solution is $\sum_{v\in G} c_v + \sum_{(u,v)\in M} (w_{(u,v)}-c_u-c_v)$. The first sum doesn't depend on the choice of the cover, so the problem becomes one of finding a matching that maximizes the total weight, for edge weights $c_u+c_v-w_{(u,v)}$. If you really want this to be a minimum weight perfect matching problem, then instead use weights $w_{(u,v)}-c_u-c_v$ and add enough dummy edges with weight zero to guarantee that any matching with the real edges can be extended to a perfect matching by adding dummy edges.