The Held–Karp algorithm has exponential time complexity $\Theta\left(2^n n^2\right)$, which is better than brute forcing the TSP which requires $\Theta(n !)$.
I'm interesting in amending the Held–Karp algorithm to determine the shortest path between each group of vertices. This is different from the TSP as it allows vertices to be travelled twice and not every vertix needs to be visited. Imagine, instead of visiting each city, visiting each country that each city is in.
I have an algorithm to brute force the solution, but this is very slow. Is it possible to adapt the Held–Karp algorithm to finding the shortest path between groups?
For example, in this weighted graph, here vertices 1 - 3 are in the red group, 4-6 in blue , 7-9 in green, and 10-12 is in purple. The shortest route is 4 <-> 10 <-> 3 <-> 7.