I am new to algorithms and data structures. This code is from the class I missed and now I am having difficulty understanding this. I could not understand what is happening after it asked for the initial vertex. Below is the code
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int i, j, k, e, n, f, r, v, c[10][10], q[10], visit[10], visited[10];
int main() {
//clrscr();
cout << "Enter number of nodes: ";
cin >> n;
cout << "Enter number of edges: ";
cin >> e;
cout << "enter edge details";
for (k = 1; k <= e; k++) {
cin >> i >> j;
c[i][j] = 1;
}
cout << "enter initials vertex:";
cin >> v;
cout << "\n visited vertices are:" << v << "";
visited[v] = 1;
k = 1;
while (k < n) {
for (j = 1; j <= n; j++)
if ((c[v][j] != 0) && (visited[j] != 1) && (visit[j] != 1)) {
visit[j] = 1;
q[r++] = j;
}
v = q[f++];
cout << v << "";
k++;
visit[v] = 0;
visited[v] = 1;
}
}