global.h
Go to the documentation of this file.
1 #ifndef GLOBAL_H
2 #define GLOBAL_H
3 
4 
5 
6 #define SOCNETV_NAMESPACE SocNetV
7 
8 #ifdef SOCNETV_NAMESPACE
9 # define SOCNETV_BEGIN_NAMESPACE namespace SOCNETV_NAMESPACE {
10 # define SOCNETV_END_NAMESPACE }
11 # define SOCNETV_USE_NAMESPACE using namespace SOCNETV_NAMESPACE;
12 #else
13 # define SOCNETV_BEGIN_NAMESPACE
14 # define SOCNETV_END_NAMESPACE
15 # define SOCNETV_USE_NAMESPACE
16 #endif
17 
18 
19 
21 
22 
23 
24 #ifndef M_PI_3
25 #define M_PI_3 (1.04719755119659774615)
26 #endif
27 
28 
29 #ifndef M_PI
30 #define M_PI (3.14159265358979323846)
31 #endif
32 
33 #ifndef M_PI_X_2
34 #define M_PI_X_2 (6.28318530717958647692)
35 #endif
36 
37 
38 
39  enum NodeShape{
40  Box,
52  };
53 
54 
55  enum FileType {
56  NOT_SAVED = 0, // New network not saved yet or modified network
57  GRAPHML = 1, // .GRAPHML .XML
58  PAJEK = 2, // .PAJ .NET
59  ADJACENCY = 3, // .ADJ .CSV .SM
60  GRAPHVIZ = 4, // .DOT
61  UCINET = 5, // .DL .DAT
62  GML = 6, // .GML
63  EDGELIST_WEIGHTED = 7, // .CSV, .TXT, .LIST, LST, WLST
64  EDGELIST_SIMPLE = 8, // .CSV, .TXT, .LIST, LST
65  TWOMODE = 9, // .2SM .AFF
66  UNRECOGNIZED =-1 // UNRECOGNIZED FILE FORMAT
67  };
68 
69 
70  enum EdgeType {
71  Directed = 0,
74  };
75 
76 
77  enum IndexType {
78  DC = 1,
79  CC = 2,
80  IRCC = 3,
81  BC = 4,
82  SC = 5,
83  EC = 6,
84  PC = 7,
85  IC = 8,
86  EVC = 9,
87  DP = 10,
88  PRP = 11,
89  PP = 12
90  };
91 
92 
93  enum ChartType {
94  None = -1,
95  Spline = 0,
96  Area = 1,
97  Bars = 2
98  };
99 
100  static const int SUBGRAPH_CLIQUE = 1;
101  static const int SUBGRAPH_STAR = 2;
102  static const int SUBGRAPH_CYCLE = 3;
103  static const int SUBGRAPH_LINE = 4;
104 
105  static const int MATRIX_ADJACENCY = 1;
106  static const int MATRIX_DISTANCES = 2;
107  static const int MATRIX_DEGREE = 3;
108  static const int MATRIX_LAPLACIAN = 4;
109  static const int MATRIX_ADJACENCY_INVERSE = 5;
110  static const int MATRIX_GEODESICS = 6;
111  static const int MATRIX_REACHABILITY = 7;
112  static const int MATRIX_ADJACENCY_TRANSPOSE = 8;
113  static const int MATRIX_COCITATION = 9;
114  static const int MATRIX_DISTANCES_EUCLIDEAN = 12;
115  static const int MATRIX_DISTANCES_MANHATTAN= 13;
116  static const int MATRIX_DISTANCES_JACCARD= 14;
117  static const int MATRIX_DISTANCES_HAMMING= 15;
118  static const int MATRIX_DISTANCES_CHEBYSHEV= 16;
119 
120 
121 
122 
123 
124 
125  struct ClickedEdge {
126  int v1;
127  int v2;
128  int type;
129  };
130 
131 
132 
133  typedef QPair<int, int> SelectedEdge;
134 
135 
136  class MyEdge {
137  public:
138  int source;
139  int target;
140  double weight;
141  int type;
142  MyEdge() { source=0; target=0;weight=0;type=0;}
143  MyEdge (const int &from, const int &to, const double &w =0, const int &type=0)
144  : source(from), target(to), weight(w), type(type) { }
145  // Copy constructor
146  MyEdge (const MyEdge &edge) {
147  source = edge.source;
148  target = edge.target;
149  weight = edge.weight;
150  type = edge.type;
151  }
153  };
154 
156  {
157  public:
158  int target;
159  int distance;
160 
161  GraphDistance(int t, int dist)
162  : target(t), distance(dist)
163  {
164 
165  }
166  };
167 
168 
169  // implement a min-priority queue
171  public:
173  {
174  if (t1.distance == t2.distance)
175  return t1.target > t2.target;
176  return t1.distance > t2.distance; //minimum priority
177  // Returns true if t1 is closer than t2
178  // else
179  }
180  };
181 
182 
183 
184 
185  class PairVF
186  {
187  public:
188  qreal value;
189  qreal frequency;
190 
191  PairVF(qreal v, qreal f)
192  : value(v), frequency(f) { }
193  };
194 
195 
196  // implement a min-priority queue
198  public:
200  {
201  return v1.value > v2.value; //minimum priority
202  // Returns true if t1 is closer than t2
203  // else
204  }
205  };
206 
207 
208 
209 
210 
212 
213 
214 Q_DECLARE_METATYPE(SOCNETV_NAMESPACE::MyEdge)
215 
216 
217 
218 #endif // GLOBAL_H
Definition: global.h:197
int source
Definition: global.h:138
Definition: global.h:88
static const int MATRIX_DISTANCES
Definition: global.h:106
int target
Definition: global.h:139
static const int SUBGRAPH_CYCLE
Definition: global.h:102
GraphDistance(int t, int dist)
Definition: global.h:161
Definition: global.h:56
Definition: global.h:95
int distance
Definition: global.h:159
static const int SUBGRAPH_STAR
Definition: global.h:101
Definition: global.h:66
FileType
Definition: global.h:55
Definition: global.h:170
MyEdge()
Definition: global.h:142
~MyEdge()
Definition: global.h:152
Definition: global.h:51
#define SOCNETV_END_NAMESPACE
Definition: global.h:10
static const int MATRIX_COCITATION
Definition: global.h:113
Definition: global.h:58
QPair< int, int > SelectedEdge
Definition: global.h:133
PairVF(qreal v, qreal f)
Definition: global.h:191
Definition: global.h:48
Definition: global.h:94
int v2
Definition: global.h:127
Definition: global.h:85
Definition: global.h:65
#define SOCNETV_BEGIN_NAMESPACE
Definition: global.h:9
Definition: global.h:125
int type
Definition: global.h:141
Definition: global.h:61
Definition: global.h:47
static const int MATRIX_ADJACENCY_INVERSE
Definition: global.h:109
EdgeType
Definition: global.h:70
static const int SUBGRAPH_LINE
Definition: global.h:103
Definition: global.h:78
static const int MATRIX_GEODESICS
Definition: global.h:110
Definition: global.h:50
Definition: global.h:83
int target
Definition: global.h:158
Definition: global.h:46
Definition: global.h:136
static const int MATRIX_DISTANCES_MANHATTAN
Definition: global.h:115
bool operator()(PairVF &v1, PairVF &v2)
Definition: global.h:199
Definition: global.h:84
static const int MATRIX_REACHABILITY
Definition: global.h:111
static const int MATRIX_LAPLACIAN
Definition: global.h:108
static const int MATRIX_ADJACENCY_TRANSPOSE
Definition: global.h:112
static const int MATRIX_DISTANCES_EUCLIDEAN
Definition: global.h:114
Definition: global.h:86
static const int MATRIX_DISTANCES_HAMMING
Definition: global.h:117
qreal frequency
Definition: global.h:189
static const int MATRIX_DEGREE
Definition: global.h:107
Definition: global.h:96
Definition: global.h:155
Definition: global.h:64
double weight
Definition: global.h:140
Definition: global.h:185
static const int MATRIX_DISTANCES_CHEBYSHEV
Definition: global.h:118
Definition: global.h:42
Definition: global.h:97
Definition: global.h:87
Definition: global.h:59
int type
Definition: global.h:128
ChartType
Definition: global.h:93
Definition: global.h:44
Definition: global.h:80
Definition: global.h:41
Definition: global.h:49
static const int MATRIX_DISTANCES_JACCARD
Definition: global.h:116
static const int SUBGRAPH_CLIQUE
Definition: global.h:100
Definition: global.h:82
NodeShape
Definition: global.h:39
IndexType
Definition: global.h:77
Definition: global.h:45
Definition: global.h:43
static const int MATRIX_ADJACENCY
Definition: global.h:105
bool operator()(GraphDistance &t1, GraphDistance &t2)
Definition: global.h:172
Definition: global.h:89
int v1
Definition: global.h:126
Definition: global.h:62
Definition: global.h:63
Definition: global.h:71
Definition: global.h:81
Definition: global.h:73
Definition: global.h:79
Definition: global.h:72
MyEdge(const MyEdge &edge)
Definition: global.h:146
Definition: global.h:60
MyEdge(const int &from, const int &to, const double &w=0, const int &type=0)
Definition: global.h:143
Definition: global.h:40
Definition: global.h:57
qreal value
Definition: global.h:188