Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
[task_03] Add problem solution (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
VolkogonNikita authored Dec 14, 2023
1 parent 35827ee commit b98826c
Show file tree
Hide file tree
Showing 14 changed files with 982 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
|| ФИО | Directory name | #0 | #1 | #2 | #3 | #4 | #5 | #6 | #7 | Рейтинг |
|----|------------------------------------------------------|-------------------------|----|-----|----|----|----|----|----|----|---------|
| 1 | Бусень Артём |[ii02301](trunk/ii02301) |||||| | | | 6|
| 2 | [Волкогон Никита](https://github.com/VolkogonNikita) |[ii02302](trunk/ii02302) |||| ||| | | 8|
| 2 | [Волкогон Никита](https://github.com/VolkogonNikita) |[ii02302](trunk/II02302) |||| ||| | | 9|
| 3 | [Вышинский Артём](https://github.com/arciomwww) |[ii02303](trunk/ii02303) ||||| | | | | 6|
| 4 | [Гавришук Владислав](https://github.com/VLadGavrishuk)|[ii02304](trunk/ii02304)||||||| | | 7|
| 5 | Глухарев Даниил |[ii02305](trunk/ii02305) ||||| | | | | 7|
Expand Down
Binary file added trunk/II02302/task_03/doc/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trunk/II02302/task_03/doc/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions trunk/II02302/task_03/doc/report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<p align="center">Министерство образования Республики Беларусь</p>
<p align="center">Учреждение образования</p>
<p align="center">«Брестский государственный технический университет»</p>
<p align="center">Кафедра ИИТ</p>
<br/><br/><br/><br/><br/>
<p align="center">Лабораторная работа №3</p>
<p align="center">За третий семестр</p>
<p align="center">По дисциплине: «Общая теория интеллектуальных систем»</p>
<p align="center">Тема: «Разработка редакторов графов»</p>
<br/><br/><br/><br/><br/>
<p align="right">Выполнила:</p>
<p align="right">Студентка 2 курса</p>
<p align="right">Группы ИИ-23</p>
<p align="right">Волкогон Н.И.</p>
<br/><br/>
<p align="right">Проверил:</p>
<p align="right">Иванюк Д.С.</p>

<p align="center">Брест 2023 <br/>

--
# В работе было реализованно: #
1. Разработка и реализация программного продукта позволяющего
редактировать графовые конструкции различных видов и производить над
ними различные действия.

2. Редактор позволяет:
a) одновременно работать с несколькими графами (MDI);
b) **[\*]** выделение одновременно нескольких элементов графа, копирование
выделенного фрагмента в clipboard и восстановление из него;
c) задавать имена графам;
d) сохранять и восстанавливать граф во внутреннем формате программы;
e) экспортировать и импортировать граф в текстовый формат (описание
см. ниже);
f) создавать, удалять, именовать, переименовывать, перемещать узлы;
g) создавать неориентированные дуги, удалять дуги;
h) добавлять, удалять и редактировать содержимое узла (содержимое в
виде текста и ссылки на файл);
i) задавать цвет дуги и узла, образ узла;
j) **[\*]** создавать и отображать петли;
k) **[\*]** создавать и отображать кратные дуги.

3. Программный продукт позволяет выполнять следующие операции:
a) выводить информацию о графе;
b) поиск всех путей (маршрутов) между двумя узлами и кратчайших;
c) вычисление расстояния между двумя узлами;
d) **[\*]** раскраска графа;
e) нахождения эйлеровых циклов.

4. Отчет по выполненной лабораторной работе в .md формате (readme.md). Разместить его в следующем каталоге: **trunk\ii0xxyy\task_03\doc** (где **xx** - номер группы, **yy** - номер студента, например **ii02302**).

5. Исходный код разработанной программы разместить в каталоге: **trunk\ii0xxyy\task_03\src**.
nk\ii0xxyy\task_04\doc.

![Снимок экрана (1)](1.png)
![Снимок экрана (2)](2.png)
![Снимок экрана (3)](3.png)
![Снимок экрана (4)](4.png)
![Снимок экрана (5)](5.png)
![Снимок экрана (6)](6.png)
![Снимок экрана (7)](7.png)
![Снимок экрана (8)](8.png)
14 changes: 14 additions & 0 deletions trunk/II02302/task_03/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)

project(otis_3)

set(SOURCES
Source.cpp
library.cpp
)

set(HEADERS
header.h
)

add_executable(OTIS_03 ${SOURCES} ${HEADERS})
172 changes: 172 additions & 0 deletions trunk/II02302/task_03/src/Source.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#include <iostream>
#include <fstream>
#include <vector>
#include "..\Graph_lib\Header.h";

using namespace std;

int main()
{
string str;
cout << "Enter file's name: ";
cin >> str;
ifstream fin(str);
int vertexCount, edgesCount;
fin >> vertexCount >> edgesCount;

int** matrix = new int* [vertexCount];
for (int i = 0; i < vertexCount; i++)
matrix[i] = new int[vertexCount];
vector<bool> used(vertexCount);
int res;
int* path = new int[vertexCount];
int* f = new int[vertexCount];
//menu
int go;
do
{
cout << "1. Fill Matrix\n";
cout << "2. Paint Matrix\n";
cout << "\nlab1\n3. bfs\n";
cout << "4. dfs\n";
cout << "\nlab2\n5. Gamilton\n";
cout << "6. Euler\n";
cout << "\nlab3\n7. Dijkstra\n";
cout << "8. Floyd\n";
cout << "\nlab5\n9. Prim\n";
cout << "10.Kruskal\n";
cout << "\nlab4\n11. Kali\n";
cout << "12. Permutation\n";
cout << "\nlab6\n13. Strong connectivity\n";
cout << "14.Biconnected Components\n";
cout << "0. End\n";
cout << "Choise: ";
cin >> go;
switch (go)
{
case 1://Fill
system("cls");
Fill_Matrix(matrix, vertexCount, edgesCount, str);
break;

case 2://Paint
system("cls");
Paint_Matrix(matrix, vertexCount);
break;

case 3://bfs
system("cls");
res = 0;
for (int i = 0; i < vertexCount; i++)
if (!used[i])
{
res++;
bfs(matrix, vertexCount, i, used);
}
cout << endl << "Number of connectivity components: " << res << endl;
break;

case 4://dfs
system("cls");
res = 0;
for (int i = 0; i < vertexCount; i++)
if (!used[i])
{
res++;
dfs(matrix, vertexCount, i, used);
}
cout << endl << "Number of connectivity components: " << res << endl;
break;

case 5://Gamilton
system("cls");
int v0;
cout << "Enter firts vertex: ";
cin >> v0;
v0--;
for (int i = 0; i < vertexCount; i++)
f[i] = -1;
f[v0] = v0;
path[0] = v0;
if (Gamilton(matrix, path, f, vertexCount, 1, v0))
{
Print_Path(path, vertexCount);
cout << endl;
}
else cout << "No results\n";
break;

case 6://Euler
system("cls");

if ( res > 1)
cout << "Wrong\n";
else
{

int check = 0;
int buf;
for (int i = 0; i < vertexCount; i++)
{
buf = 0;
for (int j = 0; j < vertexCount; j++)
buf += matrix[i][j];
if (buf % 2)
check++;
}
if (check)
cout << "Wrong\n";
else
{

vector<int>path;
Euler(matrix, path, vertexCount);
for (int i = 1; i < path.size(); i++)
cout << path[i] + 1 << " ";
cout << endl;
break;
}
}

case 7:
system("cls");
Dijkstra(matrix,vertexCount);
break;

case 8:
system("cls");
Floyd(matrix, vertexCount);
break;

case 9:
system("cls");
Prim(matrix, vertexCount);
break;

case 10:
system("cls");
main_kruskal(matrix,vertexCount, edgesCount,str);
break;

case 11:
system("cls");
Kali();
break
;
case 12:
system("cls");
Permutation(str);
break;

case 13:
system("cls");
StrongConnectedComponents(matrix, vertexCount);
break;
case 14:
system("cls");
FindArtPointsAndBridges(matrix, vertexCount);
break;
}
} while (go);

}
21 changes: 21 additions & 0 deletions trunk/II02302/task_03/src/header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using namespace std;
#pragma once
void dfs(int**, int, int, vector<bool>&);
void bfs(int**, int, int, vector<bool>&);
void Fill_Matrix(int**&, int, int, string);
void Paint_Matrix(int**&, int);
bool Gamilton(int**&, int*&, int*&, int, int, int);
void Print_Path(int*&, int);
void Euler(int**&, vector<int>&, int);
void Dijkstra(int**&, int);
void Floyd(int**&, int);
void Prim(int**&, int);
int parent(int*, int);
void union_find(int*, int, int);
void Kruskal(pair<int, pair <int, int>>*, int*, int**&, int, int);
void main_kruskal(int**&, int, int, string);
void Kali();
void Permutation(string);
void StrongConnectedComponents(int**&, int);
//void findBiconnectedComponents(int**&, int);
void FindArtPointsAndBridges(int**&, int);
Loading

0 comments on commit b98826c

Please sign in to comment.