Code not working

#include
#include
#include
#include
#include
using namespace std;

template

class Graph{

map<T,list<T>> l;

public:
void addEdge(int x,int y){
    l[x].push_back(y);
    l[y].push_back(x);
}

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

    for(auto node_pair:l){
        T node=node_pair.first;
        distance[node]=INT_MAX;
    }

    q.push(src);
    distance[src]=0;

    while(!q.empty()){
        T node=q.front();
        // cout<<node<<" ";
        q.pop();

        for(int nbr:l[node]){
            if(distance[nbr]==INT_MAX){
                q.push(nbr);
                distance[nbr] = distance[node]+1;
                // cout<<distance[nbr]<<" "<<distance[node]<<" ";
            }
        }
    }

    for(auto node_pair:l){
        T node=node_pair.first;
        int d=distance[node];
        cout<<"distance of node "<<node<<" is "<<d<<endl;
    }


}

};

int main(){

 Graph<int> g;

g.addEdge(0,1);
g.addEdge(1,2);
g.addEdge(2,3);
g.addEdge(3,4);
g.addEdge(4,5);

g.bfs(0);

return 0;

}

Hi @pulkit2489k_5b80ff7832cec21c,
Please tell your email id as the doubt is not getting to portal, still I’ll be checking it but send it on ide.codingblocks.com
Write, save and send the url of the page

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.