Breadth First Search

28 Comments

C++ programs for the implementation of Breadth First Search(BFS) for a given graph

/* Write C++ programs for the implementation of BFS for a given graph */ #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; int cost[10][10],i,j,k,n,qu[10],front,rare,v,visit[10],visited[10];   main() { int m; cout <<"enterno of vertices"; cin >> n; cout <<"ente no of edges"; cin >> m; cout <<"\nEDGES \n"; for(k=1;k<=m;k++) { cin >>i>>j; cost[i][j]=1; }   cout <<"enter initial […]