bfs
bfs
#define MAX 20
#include<queue>
#include<fstream>
char vertext[MAX] = {'A','B','C','D','E','F'};
int bfs[MAX];
int a[MAX][MAX];
int nbfs = 0;
int n;
int C[MAX];
using namespace std;
//struct node
//{
// int info;
// node* next;
//};
//struct Queue
//{
// node *head;
// node *tail;
//};
//void init(Queue &q)
//{
// q.head = q.tail = NULL;
//}
//bool empty(Queue q)
//{
// return q.head == NULL?true :false;
//}
//node * createNode(int x)
//{
// node * p = new node;
// p->info = x;
// p->next = NULL;
// return p;
//}
//void enQueue(Queue &q,int x)
//{
// node * p = createNode(x);
// if (empty(q)) {
// q.head = p;
// }
// else
// {
// node *last = q.head;
// while (last->next!=NULL)
// {
// last = last->next;
// }
// last->next = p;
// q.tail = p;
// }
//
//}
//void deQueue(Queue &q)
//{
// if (!empty(q))
// {
// node * p = q.head;
// q.head = p->next;
// delete p;
//
//
// }
//}
void intput(int a[][MAX],int & n)
{
do {
cout << "nhap so dinh:";
cin >> n;
} while (n <= 0 || n > MAX);
cout << "Nhap ten dinh:";
/*intput(a, n);*/
inf();
output(a, n);
khoitaochuaxet();
BFS(0);
outputbfs();
system("pause");
return 0;
}