### C++: Breadth First Search program using Adjacency Matrix

**Breadth-first search**(BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a 'search key'[1]) and explores the neighbor nodes first, before moving to the next level neighbours. [wikipedia]

//This program uses Adjacency Matrix #include<iostream>

#include<queue>

#include<limits>

#include<vector>

class Graph

{

int vertexCount;

//WHITE means Undiscovered, GRAY means Discovered, BLACK menas Processed

enumclass Color{ WHITE, GRAY, BLACK };

constint imax = std::numeric_limits<int>::max();

struct Vertex

{

int id;

Color color;

size_t distance;

Vertex(constint vertex, Color clr, int imax) : id(vertex),

color(clr),

distance(imax)

{};

};

std::vector< std::vector<bool> > adjMatrix; //adja…