views:

51

answers:

2

Is there any efficient algorithm to find the set of edges with the following properties, in a complete weighted graph with an even number of vertices.

  • the set has the smallest, maximum edge weight for any set that meats the other criteria possible
  • every vertex is connected to exactly one edge in the set

All weights are positive

dI cannot think of one better than brute force, but I do not recognise it as NP hard.

A: 

try this (I just thought this up so I've got neither the proof that it will give an optimum answer or whether it will produce a solution in every cases):

  1. search for the heaviest vertices V(A, B)
  2. remove vertice V from the graph
  3. if A is only connected to a single other vertice T(A, C) then remove all other edges connected to C, repeat step 3 with those edges as well
  4. if B is only connected to a single other vertice S(B, D) then remove all other edges connected to D, repeat step 4 with those edges as well
  5. repeat from step #1
Lie Ryan
This is the greedy algorithm that I have. I do not think that it will give the correct answer, as it is possible for the solution set to not hold the heaviest edge.
ashaw
@ashaw: yep, it does not always give an optimal result...
Lie Ryan
Example ABCD, AB:100, BC:10, CD:10, DA:10, AC:10, BD:10. A solution set would be AC, BD, and this does not contain the heaviest edge AB.
ashaw
@ashaw: Actually, in that case, the algorithm would remove AB, and be left with an optimal 20-weight solution. A graph where my algorithm does not work is this: ABCD, AB:100, CD:10, AC:80, BD:80, AD:80, BC:80. The optimal solution set is (AB,CD)=110, but the algorithm will produce suboptimal 160 solution, because it decided early on that 100 is not in the solution set.
Lie Ryan
ah, but that is not the problem, because we are trying to find the set with the smallest maximum edge.
ashaw
@ashaw: I think I've misunderstood something, can you give several example graphs, and their respective expected solutions? And can you define the "smallest maximum edge" more rigorously?
Lie Ryan
the solution above solves the problem properly. The problem is to find the perfect matching containing the smallest maximum weight value. The algorithm is probably very close to correct, but the answer above is very good.
ashaw
+2  A: 

One way to solve this problem in polynomial time is as follows:

  1. Sort the edge weights in O(E log E) time
  2. For each edge, assign it a pseudo-weight E' = 2^{position in the ordering} in ~O(E) time
  3. Find the minimum weight perfect matching among pseudo-weights in something like O(V^3) time (depending on the algorithm you pick, it could be slower or faster)

This minimizes the largest edge that the perfect matching contains, which is exactly what you're looking for in something like O(V^3) time.

Sources for how to do part 3 are given below
[1] http://www2.isye.gatech.edu/~wcook/papers/match_ijoc.pdf
[2] http://www.cs.illinois.edu/class/sp10/cs598csc/Lectures/Lecture11.pdf
[3] http://www.cs.ucl.ac.uk/staff/V.Kolmogorov/papers/blossom5.ps

with sample C++ source available at http://ciju.wordpress.com/2008/08/10/min-cost-perfect-matching/

Yonatan N
This is not an answer to the question that I have. I am not trying to find the minimum sum of edges but the set with the lowest maximum edge, I have edited the question to make this more clear
ashaw
The point of taking 2^position in the ordering is to guarantee that this does find the lowest maximum edge, since the pseudo-weight of any edge is greater than the sum of pseudoweights for lesser edges, forcing the algorithm to avoid large edges at all costs.
Yonatan N
ah, cool I misunderstood that.
ashaw