vector<int>BFS(intV,vector<int>adj[]){intvisited[V]={0};visited[0]=1;//start from node 0queue<int>q;q.push(0);vector<int>bfs_nodes;while(!q.empty()){intnode=q.front();q.pop();bfs.push_back(node);for(intnbr:adj[node]){if(!visited[nbr]){visited[nbr]=1;q.push(nbr);}}}returnbfs_nodes;}