Download presentation
Presentation is loading. Please wait.
Published byShavonne Powell Modified over 9 years ago
1
Reducing Knapsack to TSP Professor Pasi Franti
2
Step 1: Equivalent Graph Construction Given Knapsack instance: –KP={2,3,5,7,11} Draw A node in the plane for each item: 2 3 7 11 5
3
Given Knapsack instance: –KP={2,3,5,7,11} Add starting node and ending node: Note: total of n+2 nodes required for a Knapsack instance of n items Step 1: Equivalent Graph Construction 2 3 7 11 5 0n+1
4
Given Knapsack instance: –KP={2,3,5,7,11} Draw links from each smaller node to the bigger node with the weight w equal to destination node: 2 3 7 11 5 0n+1 Step 1: Equivalent Graph Construction 2 7 5 3 7 n+1 11 5 5 7 n+1 11
5
Given Knapsack instance: –KP={2,3,5,7,11} Assume for each node that going back cost is 0 and going up cost is w: 2 3 7 11 5 0n+1 Step 1: Equivalent Graph Construction 2 7 5 3 7 5 5 7 11 0 7 7 7 0 0 0 0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.