I am trying to print all the possible paths in graphs but not working properly.

#include

#include

using namespace std;

void print_path(int src, vector<vector> &adj, vector &visited, int dst, int path[], int path_idx)

{

visited[src] = true;

path[path_idx] = src;

path_idx++;

if (src == dst)

{

    for (int i = 0; i < path_idx; i++)

    {

        cout << path[i] << " ";

    }

    cout << endl;

    return;

}

else

{

    for (int i= 0; i <adj[src].size(); i++)

    {

        if (!visited[adj[src][i]])

        {

            print_path(adj[src][i], adj, visited, dst, path, path_idx);

        }

    }

}

visited[src] = false;

path_idx--;

}

int main()

{

int n, m;

cin >> n >> m;

vector<vector<int>> adj(n);

for (int i = 0; i < m; i++)

{

    int x, y;

    cin >> x >> y;

    adj[x].push_back(y);

    adj[y].push_back(x);

}

int src, dst;

cin >> src >> dst;

vector<bool> visited(n, 0);

int path[1000];

print_path(src, adj, visited, dst, path, 0);

return 0;

}

you arent really traversing the graph lmao, you have to include code to move to another vertex