I have an exam coming up, and something we will be tested on is implementing the travelling salesman problem on undirected, weighted graphs. Here are examples of the type of problems we will be asked to solve:
Example 2: https://www.autonomousrobotslab.com/uploads/5/8/4/4/58449511/cs302_final_preparation_tsp.pdf
However, the vast majority of videos/code I have looked at solve tsp with a complete graph, like this example: https://www.geeksforgeeks.org/traveling-salesman-problem-tsp-implementation/
Both of the examples my professor wants us to be able to solve are examples of incomplete graphs. Is there some modifications that could be done to the implementation at geeksforgeeks to account for an incomplete graph? I thought about simply putting in zeros in the adjacency matrix where the vertices aren't connected, but the code at geeksforgeeks assumes that all the vertices are connected to every other vertex, when in an incomplete graph, they aren't. I assume I would need some way to find all the permutations of vertices that are connected, versus finding all the permutations of the vertices in general.