Shortest path problem -bfs

#include<bits/stdc++.h>
using namespace std;

template
class Graph{

map<T,list> adlist;

public:
Graph()
{

}


void addEdge( T u, T v, bool bidirectional=true)
{
    adlist[u].push_back(v);
    if(bidirectional)
        adlist[v].push_back(u);



}

void print()
{

for( auto t:adlist)
{


    cout<<t.first<<"-->";


    for( T x:t.second)
        cout<<x<<",";
    cout<<endl;
}

}

void bfs( T src)
{
queue q;
map<T, int> distance;
map<T,T> parent;

for(auto i: adlist){

    distance[i.first]=INT_MAX;
}


distance[src]=0;

q.push(src);
parent[src]=src;

while(!q.empty())
{


    T node=q.front();
   // cout<<node<<" ";
    q.pop();
   // visited[node]=true;

    for( int neighbour:adlist[node])
    {


        if(distance[neighbour]==INT_MAX)
        {

            //visited[neighbour]=true;
            q.push(neighbour);

distance[neighbour]=distance[node]+6;

parent[neighbour]=node;
}
}

}



  for(auto i:adlist)
{

    T node=i.first;

if(i.first==src)
continue;
else
cout<< distance[node]<< " “;
}
cout<<-1 <<” ";

}

};
int main()
{

int t;
cin>>t;
while(t–)
{
int ex,vx;
cin>>ex>>vx;
int ux,ver;
Graph g;
for(int i=0;i<vx;i++){
cin>>ux>>ver;
g.addEdge(ux,ver);
}
int src;
cin>>src;
g.bfs(src);
}
return 0;
}

It is giving wrong answer on submission. Please check

Please run your code on https://ide.codingblocks.com/ and share the link so that your code becomes readable

Here is your corrected code https://ide.codingblocks.com/s/187328

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.