I can already find the "cost" of the tour with my code, but I would like know the tour that is being followed, for example my code is trying to find the lowest cost in this graph:

![graph](https://cdn.discordapp.com/attachments/633110754761113641/909644289397641277/codes.png)

but I want to know the tour, so ideally I would get either 1-2-4-3-1 or 1-3-4-2-1 both with a 80 of cost.
any way to modify the code to get one of those paths?
So instead of returning the cost or in my code the "min\_path", I would like to return maybe a vector with the tour...

code:

```
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <float.h>

using namespace std;

int travllingSalesmanProblem(vector<vector<int>> graph, int s, int n)
{
    vector<int> vertex;
    for (int i = 0; i < n; i++)
        if (i != s)
            vertex.push_back(i);
    int min_path = INT_MAX;
    vector<int> solution_path;

    do {

        int current_pathweight = 0;

        int k = s;
        for (int i = 0; i < vertex.size(); i++) {
            current_pathweight += graph[k][vertex[i]];
            //cout << graph[k][vertex[i]] << endl;
            k = vertex[i];
        }

        current_pathweight += graph[k][s];
        //cout << graph[k][s] << endl;

        min_path = min(min_path, current_pathweight);
    if(min_path == current_pathweight)
        solution_path = vertex;

    } while (
        next_permutation(vertex.begin(), vertex.end()));

    return min_path;
}

int main()
{
    int n =4;
    vector<vector<int>> graph =  { { 0, 10, 15, 20 },
                       { 10, 0, 35, 25 },
                       { 15, 35, 0, 30 },
                       { 20, 25, 30, 0 } };
    int s = 0;
    int solution = travllingSalesmanProblem(graph, s, n);
    cout << solution<< endl;
    return 0;
}

```

Any help appreciated!