Microsoft Word Document
Microsoft Word Document
#include <queue>
#include <stack>
}
cout << endl;
degrees[i] = 0;
degrees[i] += graph[i][j];
int totalEdges = 0;
totalEdges += degrees[i];
stack<int> s;
s.push(start);
while (!s.empty()) {
if (!visited[current]) {
visited[current] = true;
s.push(i);
queue<int> q;
q.push(start);
visited[start] = true;
while (!q.empty()) {
q.pop();
q.push(i);
visited[i] = true;
int main() {
int graph[N][N] = {
{0, 1, 0, 0, 0, 0, 0, 1},
{1, 0, 1, 1, 1, 1, 1, 0},
{0, 1, 0, 1, 0, 1, 0, 1},
{0, 1, 1, 0, 1, 1, 0, 0},
{0, 1, 0, 1, 0, 1, 0, 0},
{0, 1, 1, 1, 1, 0, 1, 0},
{0, 1, 0, 0, 0, 1, 0, 1},
{1, 0, 1, 0, 0, 0, 1, 0}
};
printMatrix(graph);
int degrees[N];
calculateDegrees(graph, degrees);
cout << "Cho'qqi " << i << ": " << degrees[i] << endl;
}
if (saturation == (N * (N - 1)) / 2) {
} else {
depthFirstSearch(graph, 0);
breadthFirstSearch(graph, 0);
return 0;
}
#include <iostream>
#include <queue>
#include <stack>
degrees[i] = 0;
degrees[i] += graph[i][j];
}
}
int totalEdges = 0;
totalEdges += degrees[i];
stack<int> s;
s.push(start);
while (!s.empty()) {
s.pop();
if (!visited[current]) {
visited[current] = true;
s.push(i);
}
}
queue<int> q;
q.push(start);
visited[start] = true;
while (!q.empty()) {
q.pop();
q.push(i);
visited[i] = true;
int main() {
int graph[N][N] = {
{0, 1, 0, 0, 0, 0, 0, 1},
{1, 0, 1, 1, 1, 1, 1, 0},
{0, 1, 0, 1, 0, 1, 0, 1},
{0, 1, 1, 0, 1, 1, 0, 0},
{0, 1, 0, 1, 0, 1, 0, 0},
{0, 1, 1, 1, 1, 0, 1, 0},
{0, 1, 0, 0, 0, 1, 0, 1},
{1, 0, 1, 0, 0, 0, 1, 0}
};
printMatrix(graph);
int degrees[N];
calculateDegrees(graph, degrees);
cout << "Cho'qqi " << i << ": " << degrees[i] << endl;
if (saturation == (N * (N - 1)) / 2) {
} else {
depthFirstSearch(graph, 0);
breadthFirstSearch(graph, 0);
return 0;