patternMinor
Run Christofides algorithm by hand with wrong result
Viewed 0 times
resulthandwithalgorithmwrongchristofidesrun
Problem
I am following this algorithm example: https://en.wikipedia.org/wiki/Christofides_algorithm#example
The graph:
Calculate minimum spanning tree T:
Calculate the set of vertices O with odd degree in T.
They are the same as "the minimum spanning tree T" as the degree of all vertices are odd.
Form the subgraph of G using only the vertices of O (as all are odd, this should give us the original graph):
Construct a minimum-weight perfect matching M in this subgraph
(I am not sure if I did this right)
Unite matching and spanning tree T ∪ M to form an Eulerian multigraph
This is definitely not right. What went wrong?
The graph:
Calculate minimum spanning tree T:
Calculate the set of vertices O with odd degree in T.
They are the same as "the minimum spanning tree T" as the degree of all vertices are odd.
Form the subgraph of G using only the vertices of O (as all are odd, this should give us the original graph):
Construct a minimum-weight perfect matching M in this subgraph
(I am not sure if I did this right)
Unite matching and spanning tree T ∪ M to form an Eulerian multigraph
This is definitely not right. What went wrong?
Solution
In fact, you have been correct all along. However, you have not finished Christofides algorithm yet.
The next step is "Calculate Euler tour".
In the last picture, you have obtained a multigraph all of whose vertices have even degrees. So it must have an Eulerian path. For example, let us select the Eulerian path A -> F -> A -> C -> B -> D -> E -> D -> A.
The last step is "Remove repeated vertices, giving the algorithm's output".
Removing the second A and the second D on that above path, we obtain a wanted output, A -> F -> C -> B -> D -> E -> A. Done.
Please note it is not very meaningful to apply Christofides algorithm on the given graph.
"The Christofides algorithm is an algorithm for finding approximate solutions to the travelling salesman problem, on instances where the distances form a metric space (they are symmetric and obey the triangle inequality". The given distances do not obey the triangle inequality, since d(B,D) + d(D, E) = 1 + 4 < 6 = d(B,E). Moreover, the (direct) distance between A and B is not given, raising doubt whether this is a travelling salesman problem at all.
The next step is "Calculate Euler tour".
In the last picture, you have obtained a multigraph all of whose vertices have even degrees. So it must have an Eulerian path. For example, let us select the Eulerian path A -> F -> A -> C -> B -> D -> E -> D -> A.
The last step is "Remove repeated vertices, giving the algorithm's output".
Removing the second A and the second D on that above path, we obtain a wanted output, A -> F -> C -> B -> D -> E -> A. Done.
Please note it is not very meaningful to apply Christofides algorithm on the given graph.
"The Christofides algorithm is an algorithm for finding approximate solutions to the travelling salesman problem, on instances where the distances form a metric space (they are symmetric and obey the triangle inequality". The given distances do not obey the triangle inequality, since d(B,D) + d(D, E) = 1 + 4 < 6 = d(B,E). Moreover, the (direct) distance between A and B is not given, raising doubt whether this is a travelling salesman problem at all.
Context
StackExchange Computer Science Q#100033, answer score: 3
Revisions (0)
No revisions yet.