|
|
Construct a subgraph graph G consisting of the "best cost edges"; // We will discuss what is a "best cost edge" later Find a maximal matching M in subgraph G repeat until M is a complete matching { Add the "next best cost edges" to G; // Notice the quotes: it's more complex that just // looking at the cost of an edge Find a maximal matching M in (modified) subgraph G; } |
|
The least cost edge in the graph is (a1, b1):
However, the minimum cost solution does not contain the edge (a1, b1):
Reason:
|
|
|
The minimum cost incurred to match a2 = 5 (by matching a2 to b1)
Compute the additional incurred cost when using non-optimal edged by subtracting the minimum cost from the other edges that is incident to that same node:
Subtract min cost: | Result: |
---|---|
The 0-weight edges are the best edges to match a1 and a2 when nothing else matters
However, we know that something else does matter:
|
How to read the cost 3 and 4:
|
Now you can tell exactly what you need to do:
|
Therefore:
|
|
|
|
|
|
|
|
|
|