BSF
#include<iostream> #include<queue> #include<vector> using namespace std; int main() { int edges,a,b; vector<int>nodes[1000]; cout<<"Enter the no of edges"<<endl; cin>>edges; for(int i=0; i<edges; i++) { cin>>a>>b; nodes[a].push_back(b); nodes[b].push_back(a); } cout<<endl; //Adj list representation for(int i=0; i<1000; i++) { if(!nodes[i].empty()) { cout<<"[ "<<i<<" ]"<<"-->"; for(vector<int>::iterator it=nodes[i].begin(); ...