1
+ /* *
2
+ * @file global.h
3
+ * @brief This file contains global definitions, constants, and utility classes for the SocNetV application.
4
+ */
5
+
1
6
#ifndef GLOBAL_H
2
7
#define GLOBAL_H
3
8
15
20
# define SOCNETV_USE_NAMESPACE
16
21
#endif
17
22
18
-
19
23
SOCNETV_BEGIN_NAMESPACE
20
24
21
25
#ifndef M_PI_3
22
26
#define M_PI_3 (1.04719755119659774615 )
23
27
#endif
24
28
25
-
26
29
#ifndef M_PI
27
30
#define M_PI (3.14159265358979323846 )
28
31
#endif
@@ -33,6 +36,10 @@ SOCNETV_BEGIN_NAMESPACE
33
36
34
37
static const QString VERSION=" 3.2" ;
35
38
39
+ /* *
40
+ * @enum NodeShape
41
+ * @brief Enumeration of possible shapes for nodes in the network.
42
+ */
36
43
enum NodeShape{
37
44
Box,
38
45
Circle,
@@ -48,29 +55,38 @@ enum NodeShape{
48
55
Custom
49
56
};
50
57
51
-
58
+ /* *
59
+ * @enum FileType
60
+ * @brief Enumeration of possible file types for network data.
61
+ */
52
62
enum FileType {
53
- NOT_SAVED = 0 , // New network not saved yet or modified network
54
- GRAPHML = 1 , // .GRAPHML .XML
55
- PAJEK = 2 , // .PAJ .NET
56
- ADJACENCY = 3 , // .CSV .ADJ .SM
57
- GRAPHVIZ = 4 , // .DOT
58
- UCINET = 5 , // .DL .DAT
59
- GML = 6 , // .GML
60
- EDGELIST_WEIGHTED = 7 , // .CSV, .TXT, .LIST, LST, WLST
61
- EDGELIST_SIMPLE = 8 , // .CSV, .TXT, .LIST, LST
62
- TWOMODE = 9 , // .2SM .AFF
63
- UNRECOGNIZED =-1 // UNRECOGNIZED FILE FORMAT
63
+ NOT_SAVED = 0 , // /< New network not saved yet or modified network
64
+ GRAPHML = 1 , // /< .GRAPHML .XML
65
+ PAJEK = 2 , // /< .PAJ .NET
66
+ ADJACENCY = 3 , // /< .CSV .ADJ .SM
67
+ GRAPHVIZ = 4 , // /< .DOT
68
+ UCINET = 5 , // /< .DL .DAT
69
+ GML = 6 , // /< .GML
70
+ EDGELIST_WEIGHTED = 7 , // /< .CSV, .TXT, .LIST, LST, WLST
71
+ EDGELIST_SIMPLE = 8 , // /< .CSV, .TXT, .LIST, LST
72
+ TWOMODE = 9 , // /< .2SM .AFF
73
+ UNRECOGNIZED =-1 // /< Unrecognized file format
64
74
};
65
75
66
-
76
+ /* *
77
+ * @enum EdgeType
78
+ * @brief Enumeration of possible edge types in the network.
79
+ */
67
80
enum EdgeType {
68
81
Directed = 0 ,
69
82
Reciprocated = 1 ,
70
83
Undirected = 2
71
84
};
72
85
73
-
86
+ /* *
87
+ * @enum IndexType
88
+ * @brief Enumeration of possible index types for network analysis.
89
+ */
74
90
enum IndexType {
75
91
DC = 1 ,
76
92
CC = 2 ,
@@ -86,31 +102,34 @@ enum IndexType {
86
102
PP = 12
87
103
};
88
104
89
-
105
+ /* *
106
+ * @enum ChartType
107
+ * @brief Enumeration of possible chart types for visualizing network data.
108
+ */
90
109
enum ChartType {
91
110
None = -1 ,
92
111
Spline = 0 ,
93
112
Area = 1 ,
94
113
Bars = 2
95
114
};
96
115
116
+ /* *
117
+ * @enum NetworkRequestType
118
+ * @brief Enumeration of possible network request types.
119
+ */
97
120
enum NetworkRequestType {
98
121
Generic = 0 ,
99
122
Crawler = 1 ,
100
123
CheckUpdate = 2
101
-
102
124
};
103
125
104
-
105
-
106
126
static const int USER_MSG_INFO=0 ;
107
127
static const int USER_MSG_CRITICAL=1 ;
108
128
static const int USER_MSG_CRITICAL_NO_NETWORK=2 ;
109
129
static const int USER_MSG_CRITICAL_NO_EDGES=3 ;
110
130
static const int USER_MSG_QUESTION=4 ;
111
131
static const int USER_MSG_QUESTION_CUSTOM=5 ;
112
132
113
-
114
133
static const int SUBGRAPH_CLIQUE = 1 ;
115
134
static const int SUBGRAPH_STAR = 2 ;
116
135
static const int SUBGRAPH_CYCLE = 3 ;
@@ -131,109 +150,85 @@ static const int MATRIX_DISTANCES_JACCARD= 14;
131
150
static const int MATRIX_DISTANCES_HAMMING= 15 ;
132
151
static const int MATRIX_DISTANCES_CHEBYSHEV= 16 ;
133
152
134
-
135
-
136
-
137
-
138
-
153
+ /* *
154
+ * @struct ClickedEdge
155
+ * @brief Structure to hold information about a clicked edge in the network.
156
+ */
139
157
struct ClickedEdge {
140
- int v1;
141
- int v2;
142
- int type;
158
+ int v1; // /< First vertex of the edge
159
+ int v2; // /< Second vertex of the edge
160
+ int type; // /< Type of the edge
143
161
};
144
162
145
-
146
-
147
163
typedef QPair<int , int > SelectedEdge;
148
164
149
-
165
+ /* *
166
+ * @class MyEdge
167
+ * @brief Class representing an edge in the network.
168
+ */
150
169
class MyEdge {
151
170
public:
152
- int source;
153
- int target;
154
- double weight;
155
- int type;
156
- double rWeight;
157
- MyEdge () { source=0 ; target=0 ;weight=0 ;type=0 ; rWeight=0 ; }
158
- MyEdge (const int &from, const int &to, const double &w =0 , const int &type=0 , const double &rw = 0 )
159
- : source(from), target(to), weight(w), type(type), rWeight(rw) { }
160
- // Copy constructor
161
- MyEdge (const MyEdge &edge) {
162
- source = edge.source ;
163
- target = edge.target ;
164
- weight = edge.weight ;
165
- rWeight = edge.rWeight ;
166
- type = edge.type ;
167
- }
168
- ~MyEdge (){}
171
+ int source; // /< Source vertex of the edge
172
+ int target; // /< Target vertex of the edge
173
+ double weight; // /< Weight of the edge
174
+ int type; // /< Type of the edge
175
+ double rWeight; // /< Reserved weight of the edge
176
+
177
+ MyEdge (); // /< Default constructor
178
+ MyEdge (const int &from, const int &to, const double &w =0 , const int &type=0 , const double &rw = 0 ); // /< Parameterized constructor
179
+ MyEdge (const MyEdge &edge); // /< Copy constructor
180
+ ~MyEdge (); // /< Destructor
169
181
};
170
182
171
-
172
183
/* *
173
- * @brief Holds the distance to target. Used in Graph::dijkstra() priority_queue
184
+ * @class GraphDistance
185
+ * @brief Holds the distance to target. Used in Graph::dijkstra() priority_queue.
174
186
*/
175
187
class GraphDistance
176
188
{
177
189
public:
178
- int target;
179
- int distance;
180
-
181
- GraphDistance (int t, int dist)
182
- : target(t), distance(dist)
183
- {
190
+ int target; // /< Target vertex
191
+ int distance; // /< Distance to the target vertex
184
192
185
- }
193
+ GraphDistance ( int t, int dist); // /< Constructor
186
194
};
187
195
188
-
189
-
190
196
/* *
197
+ * @class GraphDistancesCompare
191
198
* @brief Metric to implement a min-priority queue.
192
- * The operator returns true if if t1 is closer than t2
193
- * Used in Graph::dijkstra() priority_queue
199
+ * The operator returns true if t1 is closer than t2.
200
+ * Used in Graph::dijkstra() priority_queue.
194
201
*/
195
202
class GraphDistancesCompare {
196
203
public:
197
- bool operator ()(GraphDistance& t1, GraphDistance& t2)
198
- {
199
- if (t1.distance == t2.distance )
200
- return t1.target > t2.target ;
201
- return t1.distance > t2.distance ; // minimum priority
202
- }
204
+ bool operator ()(GraphDistance& t1, GraphDistance& t2); // /< Comparison operator
203
205
};
204
206
205
-
206
-
207
-
207
+ /* *
208
+ * @class PairVF
209
+ * @brief Class representing a pair of value and frequency.
210
+ */
208
211
class PairVF
209
212
{
210
213
public:
211
- qreal value;
212
- qreal frequency;
214
+ qreal value; // /< Value
215
+ qreal frequency; // /< Frequency
213
216
214
- PairVF (qreal v, qreal f)
215
- : value(v), frequency(f) { }
217
+ PairVF (qreal v, qreal f); // /< Constructor
216
218
};
217
219
218
-
219
- // implement a min-priority queue
220
+ /* *
221
+ * @class PairVFCompare
222
+ * @brief Implements a min-priority queue.
223
+ */
220
224
class PairVFCompare {
221
225
public:
222
- bool operator ()(PairVF& v1, PairVF& v2)
223
- {
224
- return v1.value > v2.value ; // minimum priority
225
- // Returns true if t1 is closer than t2
226
- // else
227
- }
226
+ bool operator ()(PairVF& v1, PairVF& v2); // /< Comparison operator
228
227
};
229
228
230
-
231
-
232
229
SOCNETV_END_NAMESPACE
233
230
234
-
235
231
Q_DECLARE_METATYPE (SOCNETV_NAMESPACE::MyEdge)
236
232
Q_DECLARE_METATYPE (SOCNETV_NAMESPACE::NetworkRequestType)
237
233
238
-
239
234
#endif // GLOBAL_H
0 commit comments