Breadth first


C++ programs to implement Graph Traversal Techniques – Depth First Search/Breadth First Search

a)Program to implement Breadth first Search algorithm. #include<iostream.h> #include<conio.h> #include<stdlib.h> int cost[10][10],i,j,k,n,queue[10],front,rear,v,visit[10],visited[10]; void main() { int m; clrscr(); 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 vertex"; cin >>v; cout <<"Visitied vertices\n"; cout << v; visited[v]=1; […]