MNE-CPP  0.1.9
A Framework for Electrophysiology
networknode.cpp
Go to the documentation of this file.
1 //=============================================================================================================
35 //=============================================================================================================
36 // INCLUDES
37 //=============================================================================================================
38 
39 #include "networknode.h"
40 
41 #include "networkedge.h"
42 
43 //=============================================================================================================
44 // QT INCLUDES
45 //=============================================================================================================
46 
47 //=============================================================================================================
48 // EIGEN INCLUDES
49 //=============================================================================================================
50 
51 //=============================================================================================================
52 // USED NAMESPACES
53 //=============================================================================================================
54 
55 using namespace CONNECTIVITYLIB;
56 using namespace Eigen;
57 
58 //=============================================================================================================
59 // DEFINE GLOBAL METHODS
60 //=============================================================================================================
61 
62 //=============================================================================================================
63 // DEFINE MEMBER METHODS
64 //=============================================================================================================
65 
66 NetworkNode::NetworkNode(qint16 iId, const RowVectorXf& vecVert)
67 : m_bIsHub(false)
68 , m_iId(iId)
69 , m_vecVert(vecVert)
70 {
71 }
72 
73 //=============================================================================================================
74 
75 const QList<QSharedPointer<NetworkEdge> >& NetworkNode::getFullEdges() const
76 {
77  return m_lEdges;
78 }
79 
80 //=============================================================================================================
81 
82 QList<QSharedPointer<NetworkEdge> > NetworkNode::getThresholdedEdges() const
83 {
84  QList<QSharedPointer<NetworkEdge> > edgeList;
85 
86  for(int i = 0; i< m_lEdges.size(); i++) {
87  if(m_lEdges.at(i)->isActive()) {
88  edgeList << m_lEdges.at(i);
89  }
90  }
91 
92  return edgeList;
93 }
94 
95 //=============================================================================================================
96 
97 QList<QSharedPointer<NetworkEdge> > NetworkNode::getFullEdgesIn() const
98 {
99  QList<QSharedPointer<NetworkEdge> > edgeList;
100 
101  for(int i = 0; i< m_lEdges.size(); i++) {
102  if(m_lEdges.at(i)->getEndNodeID() == this->getId()) {
103  edgeList << m_lEdges.at(i);
104  }
105  }
106 
107  return edgeList;
108 }
109 
110 //=============================================================================================================
111 
112 QList<QSharedPointer<NetworkEdge> > NetworkNode::getThresholdedEdgesIn() const
113 {
114  QList<QSharedPointer<NetworkEdge> > edgeList;
115 
116  for(int i = 0; i< m_lEdges.size(); i++) {
117  if(m_lEdges.at(i)->isActive() && m_lEdges.at(i)->getEndNodeID() == this->getId()) {
118  edgeList << m_lEdges.at(i);
119  }
120  }
121 
122  return edgeList;
123 }
124 
125 //=============================================================================================================
126 
127 QList<QSharedPointer<NetworkEdge> > NetworkNode::getFullEdgesOut() const
128 {
129  QList<QSharedPointer<NetworkEdge> > edgeList;
130 
131  for(int i = 0; i< m_lEdges.size(); i++) {
132  if(m_lEdges.at(i)->getStartNodeID() == this->getId()) {
133  edgeList << m_lEdges.at(i);
134  }
135  }
136 
137  return edgeList;
138 }
139 
140 //=============================================================================================================
141 
142 QList<QSharedPointer<NetworkEdge> > NetworkNode::getThresholdedEdgesOut() const
143 {
144  QList<QSharedPointer<NetworkEdge> > edgeList;
145 
146  for(int i = 0; i< m_lEdges.size(); i++) {
147  if(m_lEdges.at(i)->isActive() && m_lEdges.at(i)->getStartNodeID() == this->getId()) {
148  edgeList << m_lEdges.at(i);
149  }
150  }
151 
152  return edgeList;
153 }
154 
155 //=============================================================================================================
156 
157 const RowVectorXf& NetworkNode::getVert() const
158 {
159  return m_vecVert;
160 }
161 
162 //=============================================================================================================
163 
164 qint16 NetworkNode::getId() const
165 {
166  return m_iId;
167 }
168 
169 //=============================================================================================================
170 
172 {
173  return m_lEdges.size();
174 }
175 
176 //=============================================================================================================
177 
179 {
180  qint16 degree = 0;
181 
182  for(int i = 0; i < m_lEdges.size(); i++) {
183  if(m_lEdges.at(i)->isActive()) {
184  degree++;
185  }
186  }
187 
188  return degree;
189 }
190 
191 //=============================================================================================================
192 
194 {
195  qint16 degree = 0;
196 
197  for(int i = 0; i< m_lEdges.size(); i++) {
198  if(m_lEdges.at(i)->getEndNodeID() == this->getId()) {
199  degree++;
200  }
201  }
202 
203  return degree;
204 }
205 
206 //=============================================================================================================
207 
209 {
210  qint16 degree = 0;
211 
212  for(int i = 0; i< m_lEdges.size(); i++) {
213  if(m_lEdges.at(i)->isActive() && m_lEdges.at(i)->getEndNodeID() == this->getId()) {
214  degree++;
215  }
216  }
217 
218  return degree;
219 }
220 
221 //=============================================================================================================
222 
224 {
225  qint16 degree = 0;
226 
227  for(int i = 0; i< m_lEdges.size(); i++) {
228  if(m_lEdges.at(i)->getStartNodeID() == this->getId()) {
229  degree++;
230  }
231  }
232 
233  return degree;
234 }
235 
236 //=============================================================================================================
237 
239 {
240  qint16 degree = 0;
241 
242  for(int i = 0; i< m_lEdges.size(); i++) {
243  if(m_lEdges.at(i)->isActive() && m_lEdges.at(i)->getStartNodeID() == this->getId()) {
244  degree++;
245  }
246  }
247 
248  return degree;
249 }
250 
251 //=============================================================================================================
252 
254 {
255  double dStrength = 0.0;
256 
257  for(int i = 0; i < m_lEdges.size(); ++i) {
258  dStrength += m_lEdges.at(i)->getWeight();
259  }
260 
261  return dStrength;
262 }
263 
264 //=============================================================================================================
265 
267 {
268  double dStrength = 0.0;
269 
270  for(int i = 0; i < m_lEdges.size(); ++i) {
271  if(m_lEdges.at(i)->isActive()) {
272  dStrength += m_lEdges.at(i)->getWeight();
273  }
274  }
275 
276  return dStrength;
277 }
278 
279 //=============================================================================================================
280 
282 {
283  double dStrength = 0.0;
284 
285  for(int i = 0; i < m_lEdges.size(); ++i) {
286  if(m_lEdges.at(i)->getEndNodeID() == this->getId()) {
287  dStrength += m_lEdges.at(i)->getWeight();
288  }
289  }
290 
291  return dStrength;
292 }
293 
294 //=============================================================================================================
295 
297 {
298  double dStrength = 0.0;
299 
300  for(int i = 0; i < m_lEdges.size(); ++i) {
301  if(m_lEdges.at(i)->isActive() && m_lEdges.at(i)->getEndNodeID() == this->getId()) {
302  dStrength += m_lEdges.at(i)->getWeight();
303  }
304  }
305 
306  return dStrength;
307 }
308 
309 //=============================================================================================================
310 
312 {
313  double dStrength = 0.0;
314 
315  for(int i = 0; i < m_lEdges.size(); ++i) {
316  if(m_lEdges.at(i)->getStartNodeID() == this->getId()) {
317  dStrength += m_lEdges.at(i)->getWeight();
318  }
319  }
320 
321  return dStrength;
322 }
323 
324 //=============================================================================================================
325 
327 {
328  double dStrength = 0.0;
329 
330  for(int i = 0; i < m_lEdges.size(); ++i) {
331  if(m_lEdges.at(i)->isActive() && m_lEdges.at(i)->getStartNodeID() == this->getId()) {
332  dStrength += m_lEdges.at(i)->getWeight();
333  }
334  }
335 
336  return dStrength;
337 }
338 
339 //=============================================================================================================
340 
341 void NetworkNode::setHubStatus(bool bIsHub)
342 {
343  m_bIsHub = bIsHub;
344 }
345 
346 //=============================================================================================================
347 
349 {
350  return m_bIsHub;
351 }
352 
353 //=============================================================================================================
354 
355 void NetworkNode::append(QSharedPointer<NetworkEdge> newEdge)
356 {
357  if(newEdge->getEndNodeID() != newEdge->getStartNodeID()) {
358  m_lEdges << newEdge;
359  }
360 }
361 
CONNECTIVITYLIB::NetworkNode::getVert
const Eigen::RowVectorXf & getVert() const
Definition: networknode.cpp:157
CONNECTIVITYLIB::NetworkNode::getThresholdedStrength
double getThresholdedStrength() const
Definition: networknode.cpp:266
CONNECTIVITYLIB::NetworkNode::getFullEdgesOut
QList< QSharedPointer< NetworkEdge > > getFullEdgesOut() const
Definition: networknode.cpp:127
CONNECTIVITYLIB::NetworkNode::m_bIsHub
bool m_bIsHub
Definition: networknode.h:282
CONNECTIVITYLIB::NetworkNode::m_iId
qint16 m_iId
Definition: networknode.h:284
networknode.h
NetworkNode class declaration.
CONNECTIVITYLIB::NetworkNode::getThresholdedOutdegree
qint16 getThresholdedOutdegree() const
Definition: networknode.cpp:238
CONNECTIVITYLIB::NetworkNode::getFullIndegree
qint16 getFullIndegree() const
Definition: networknode.cpp:193
CONNECTIVITYLIB::NetworkNode::getThresholdedEdgesOut
QList< QSharedPointer< NetworkEdge > > getThresholdedEdgesOut() const
Definition: networknode.cpp:142
CONNECTIVITYLIB::NetworkNode::getFullInstrength
double getFullInstrength() const
Definition: networknode.cpp:281
CONNECTIVITYLIB::NetworkNode::getThresholdedEdgesIn
QList< QSharedPointer< NetworkEdge > > getThresholdedEdgesIn() const
Definition: networknode.cpp:112
CONNECTIVITYLIB::NetworkNode::getFullOutstrength
double getFullOutstrength() const
Definition: networknode.cpp:311
CONNECTIVITYLIB::NetworkNode::getFullEdges
const QList< QSharedPointer< NetworkEdge > > & getFullEdges() const
Definition: networknode.cpp:75
CONNECTIVITYLIB::NetworkNode::getHubStatus
bool getHubStatus() const
Definition: networknode.cpp:348
CONNECTIVITYLIB::NetworkNode::m_lEdges
QList< QSharedPointer< NetworkEdge > > m_lEdges
Definition: networknode.h:288
CONNECTIVITYLIB::NetworkNode::m_vecVert
Eigen::RowVectorXf m_vecVert
Definition: networknode.h:286
CONNECTIVITYLIB::NetworkNode::getFullEdgesIn
QList< QSharedPointer< NetworkEdge > > getFullEdgesIn() const
Definition: networknode.cpp:97
CONNECTIVITYLIB::NetworkNode::getFullStrength
double getFullStrength() const
Definition: networknode.cpp:253
CONNECTIVITYLIB::NetworkNode::getId
qint16 getId() const
Definition: networknode.cpp:164
CONNECTIVITYLIB::NetworkNode::getThresholdedEdges
QList< QSharedPointer< NetworkEdge > > getThresholdedEdges() const
Definition: networknode.cpp:82
CONNECTIVITYLIB::NetworkNode::getThresholdedIndegree
qint16 getThresholdedIndegree() const
Definition: networknode.cpp:208
CONNECTIVITYLIB::NetworkNode::NetworkNode
NetworkNode(qint16 iId, const Eigen::RowVectorXf &vecVert)
Definition: networknode.cpp:66
CONNECTIVITYLIB::NetworkNode::getFullOutdegree
qint16 getFullOutdegree() const
Definition: networknode.cpp:223
CONNECTIVITYLIB::NetworkNode::getThresholdedInstrength
double getThresholdedInstrength() const
Definition: networknode.cpp:296
networkedge.h
NetworkEdge class declaration.
CONNECTIVITYLIB::NetworkNode::getThresholdedDegree
qint16 getThresholdedDegree() const
Definition: networknode.cpp:178
CONNECTIVITYLIB::NetworkNode::append
void append(QSharedPointer< NetworkEdge > newEdge)
Definition: networknode.cpp:355
CONNECTIVITYLIB::NetworkNode::getFullDegree
qint16 getFullDegree() const
Definition: networknode.cpp:171
CONNECTIVITYLIB::NetworkNode::getThresholdedOutstrength
double getThresholdedOutstrength() const
Definition: networknode.cpp:326
CONNECTIVITYLIB::NetworkNode::setHubStatus
void setHubStatus(bool bIsHub)
Definition: networknode.cpp:341