-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcolor.h
105 lines (87 loc) · 2.28 KB
/
gcolor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef GCOLOR_H
#define GCOLOR_H
//Qt dependencies
#include <QList>
#include <QString>
//Local Constants
const int MAX=100;
class gColor
{
public:
gColor();
// this program will work with graphs of which number of vertices is
//smaller or equal to 100
// necessary variables
// n is the number of vertices of the graph
int n;
// a[n][n] is the adjacency matrix of the graph
// a[i][j] = 1 if i-th and j-th vertices are adjacent
int a[MAX][MAX];
// array color[n] stores the colors of the vertices
// color[i] = 0 if we 've not colored it yet
int color[MAX];
// array degree[n] stores the degrees of the vertices
int degree[MAX];
// array NN[] stores all the vertices that is not adjacent to current vertex
int NN[MAX];
// NNCount is the number of that set
int NNCount;
// unprocessed is the number of vertices with which we 've not worked
int unprocessed;
/**
* @brief GetInput
* function that reads input from file named "input.txt" in the same folder
*/
void GetInput(QList <QString> vertices, QList <QString> edges);
/**
* @brief Init
* initializing function
*/
void Init();
/**
* @brief MaxDegreeVertex
* this function finds the unprocessed vertex of which degree is maximum
* @return
* returns integer of max degree
*/
int MaxDegreeVertex();
/**
* @brief scannedInit
* this function is for UpdateNN function
* it reset the value of scanned array
* @param scanned
*/
void scannedInit(int scanned[MAX]);
/**
* @brief UpdateNN
* this function updates NN array
* @param ColorNumber
*/
void UpdateNN(int ColorNumber);
/**
* @brief FindSuitableY
* this function will find suitable y from NN
* @param ColorNumber
* @param VerticesInCommon
* @return
*/
int FindSuitableY(int ColorNumber, int& VerticesInCommon);
/**
* @brief MaxDegreeInNN
* find the vertex in NN of which degree is maximum
* @return
*/
int MaxDegreeInNN();
/**
* @brief Coloring
* Processing Function
*/
void Coloring();
/**
* @brief PrintOutput
* print out the output
*/
void PrintOutput();
private:
};
#endif // GCOLOR_H