Posts

Showing posts with the label graph

DSPS: Revised version of GRAPHS (BFS)

#include<iostream> using namespace std; #define size 10 #define true 1 #define false 0 class graph { public:     int g[size][size];     int visit[size],rear,front,q[size];     int n,e; public:     graph();     void getmatrix();     void displaygraph();     void bfs(int); }; graph::graph() {  for(int i=0;i<size;i++)      {          for(int j=0;j<size;j++)          {              g[i][j]=false;          }      }  for(int i=0;i<size;i++)      {      visit[i]=false;      } } void graph::getmatrix() {     int v1,v2;     cout<<"Enter no. of n...