Code Documentation 3.1
Social Network Visualizer
Loading...
Searching...
No Matches
graph.h
Go to the documentation of this file.
1
16#ifndef GRAPH_H
17#define GRAPH_H
18
19
20#include <QObject>
21#include <QList>
22#include <QQueue>
23#include <QUrl>
24#include <QHash>
25#include <QSet>
26#include <QMultiHash>
27#include <QMultiMap>
28#include <QTextStream>
29#include <QThread>
30
31// Allows to use QT_CHARTS namespace directives (see below)
32#include <QtCharts/QChartGlobal>
33
34// stack is a wrapper around <deque> in C++
35// see: www.cplusplus.com/reference/stl/stack
36#include <stack>
37
38#include "global.h"
39#include "graphvertex.h"
40#include "matrix.h"
41#include "parser.h"
42#include "webcrawler.h"
43#include "graphicswidget.h"
44
45class QDateTime;
46class QPointF;
47class QNetworkReply;
48
49class QAbstractSeries;
50class QAbstractAxis;
51class QSplineSeries;
52class QBarSeries;
53class QAreaSeries;
54class QBarSet;
55class QBarCategoryAxis;
56
57
58using namespace std;
59
60
62class Chart;
63
64typedef QList<GraphVertex*> VList;
65typedef QHash <QString, int> H_StrToInt;
66typedef QHash <int, int> H_Int;
67typedef QHash <qreal, int> H_f_i;
68typedef QPair <qreal, bool> pair_f_b;
69typedef QPair <int, pair_f_b > pair_i_fb;
70typedef QMultiHash <int, pair_i_fb > H_edges;
71typedef QHash<QString, bool> H_StrToBool;
72typedef QList<int> L_int;
73typedef QList<int> V_int;
74typedef QList<QString> V_str;
75
76
98class Graph: public QObject{
99 Q_OBJECT
102
103public slots:
104
105 int relationCurrent();
106
107 QString relationCurrentName() const;
108
109 void relationCurrentRename(const QString &newName);
110 void relationCurrentRename(const QString &newName, const bool &signalMW);
111
113 void vertexCreate (const int &number,
114 const int &size,
115 const QString &color,
116 const QString &numColor,
117 const int &numSize,
118 const QString &label,
119 const QString &labelColor,
120 const int &labelSize,
121 const QPointF &p,
122 const QString &shape,
123 const QString &iconPath = QString(),
124 const bool &signalMW = false
125 );
126
127 void graphFileLoaded(const int &fileType,
128 const QString &fName=QString(),
129 const QString &netName=QString(),
130 const int &totalNodes=0,
131 const int &totalLinks=0,
132 const int &edgeDirType=0,
133 const qint64 &elapsedTime=0,
134 const QString &message=QString());
135
136 void vertexRemoveDummyNode(int);
137
138 void graphLoadedTerminateParserThreads (QString reason);
139
140 void setSelectionChanged(const QList<int> selectedVertices,
141 const QList<SelectedEdge> selectedEdges);
142
143 void graphClickedEmptySpace( const QPointF &p);
144
146 bool edgeCreate (const int &v1, const int &v2, const qreal &weight,
147 const QString &color ,
148 const int &type=0,
149 const bool &drawArrows=true, const bool &bezier=false,
150 const QString &label=QString(),
151 const bool &signalMW=true);
152
153 void edgeCreateWebCrawler (const int &source, const int &target);
154
155 // helper vertexCreate functions
156 void vertexCreateAtPos(const QPointF &p);
157
158 void vertexCreateAtPosRandom(const bool &signalMW=false);
159
160 void vertexCreateAtPosRandomWithLabel(const int &i,
161 const QString &label,
162 const bool &signalMW=false) ;
163
164
167 void relationSet(int relNum=RAND_MAX, const bool &updateUI=true);
168
169 void relationNext();
170
171 void relationPrev();
172
173 void canvasSizeSet(const int &width, const int &height);
174
175 double canvasMaxRadius() const;
176
177 qreal canvasMinDimension() const;
178
179 double canvasVisibleX(const double &x) const ;
180
181 double canvasVisibleY(const double &y) const ;
182
183 double canvasRandomX() const;
184
185 double canvasRandomY() const;
186
187
188 void vertexIsolatedAllToggle ( const bool &toggle);
189
190 void vertexClickedSet(const int &v, const QPointF &p);
191
192 void edgeClickedSet(const int &v1, const int &v2, const bool &openMenu=false) ;
193
194
195 void edgeFilterByWeight (const qreal, const bool);
196
197 void edgeFilterByRelation(int relation, bool status);
198
199 void edgeFilterUnilateral(const bool &toggle);
200
201 void startWebCrawler(
202 const QUrl &startUrl,
203 const QStringList &urlPatternsIncluded,
204 const QStringList &urlPatternsExcluded,
205 const QStringList &linkClasses,
206 const int &maxNodes,
207 const int &maxLinksPerPage,
208 const bool &intLinks,
209 const bool &childLinks,
210 const bool &parentLinks,
211 const bool &selfLinks,
212 const bool &extLinksIncluded,
213 const bool &extLinksCrawl,
214 const bool &socialLinks,
215 const bool &delayedRequests);
216
218 void webSpider();
219
220 QString htmlEscaped (QString str) const;
221
222
223signals:
224
225 void signalWebCrawlParse(QNetworkReply *reply);
226
229 void signalNetworkManagerRequest(const QUrl &currentUrl, const NetworkRequestType &type);
230
231 void signalProgressBoxCreate(const int max=0, const QString msg="Please wait");
232
233 void signalProgressBoxKill(const int max=0);
234
235 void signalProgressBoxUpdate(const int &count=0 );
236
237 void signalGraphSavedStatus(const int &status);
238
239 void signalGraphModified(const bool &undirected,
240 const int &vertices,
241 const int &edges,
242 const qreal &density,
243 const bool &notSaved=true);
244
245 void signalGraphLoaded (const int &fileType,
246 const QString &fileName=QString(),
247 const QString &netName=QString(),
248 const int &totalNodes=0,
249 const int &totalLinks=0,
250 const qreal &density=0,
251 const qint64 &elapsedTime=0,
252 const QString &message=QString() );
253
254
255
256 void statusMessage (const QString &message);
257
259
260 void signalNodeClickedInfo(const int &number=0,
261 const QPointF &p=QPointF(),
262 const QString &label=QString(),
263 const int &inDegree=0,
264 const int &outDegree=0);
265
266
267 void signalEdgeClicked (const MyEdge &edge=MyEdge(), const bool &openMenu=false);
268
269 void signalRelationAddToMW(const QString &newRelation);
270
272
273 void signalRelationRenamedToMW(const QString &newRelName);
274
276
277 void signalRelationChangedToMW(const int &relIndex=RAND_MAX);
278
279 void signalSelectionChanged(const int &selectedVertices,
280 const int &selectedEdges);
281
282
283 void signalPromininenceDistributionChartUpdate(QAbstractSeries *series,
284 QAbstractAxis *axisX=Q_NULLPTR,
285 const qreal &min=0,
286 const qreal &max=0,
287 QAbstractAxis *axisY=Q_NULLPTR,
288 const qreal &minF=0,
289 const qreal &maxF=0);
290
292 void signalDrawNode( const QPointF &p,
293 const int &num,
294 const int &size,
295 const QString &nodeShape,
296 const QString &nodeIconPath,
297 const QString &nodeColor,
298 const QString &numberColor, const int &numSize,
299 const int &numDistance,
300 const QString &label,
301 const QString &labelColor, const int &labelSize,
302 const int &labelDistance
303 );
304
305 //signal to GW to erase a node
306 void signalRemoveNode (int );
307
308 //signal GW to draw an edge
309 void signalDrawEdge ( const int &v1,
310 const int &v2,
311 const qreal &weight,
312 const QString &label="",
313 const QString &color="black",
314 const int &type=0,
315 const bool &drawArrows=true,
316 const bool &bezier=false,
317 const bool &weightNumbers=false);
318
319 //signal to GW
320 void signalRemoveEdge(const int &v1, const int &v2, const bool &removeReverse);
321
322 void signalSetEdgeVisibility (const int &relation,
323 const int &source,
324 const int &target,
325 const bool &toggle,
326 const bool &preserveReverseEdge=false,
327 const int &edgeWeight= 1,
328 const int &reverseEdgeWeight = 1); // The last two are used only if we need to draw the edge
329
330 void setVertexVisibility(const int &number, const bool &toggle);
331
332 void setNodePos(const int &, const qreal &, const qreal &);
333
334 void signalNodesFound(const QList<int> foundList);
335
336 void setNodeSize(const int &v, const int &size);
337
338 void setNodeShape(const int &v, const QString &shape, const QString &iconPath=QString());
339
340 void setNodeColor(const int &v, const QString &color);
341
342 void setNodeLabel(const int &v, const QString &label);
343
344 void setNodeNumberColor(const int &v, const QString &color);
345
346 void setNodeNumberSize(const int &v, const int &size);
347
348 void setNodeNumberDistance(const int &v, const int &distance);
349
350 void setNodeLabelSize(const int &v, const int &size);
351
352 void setNodeLabelColor(const int &v, const QString &color);
353
354 void setNodeLabelDistance(const int &v, const int &distance);
355
356
357 void setEdgeWeight (const int &v1, const int &v2, const qreal &weight);
358 void signalEdgeType(const int &v1,
359 const int &v2,
360 const int &type);
361 void setEdgeColor(const int &v1,
362 const int &v2,
363 const QString &color);
364 void setEdgeLabel (const int &v1,
365 const int &v2,
366 const QString &label);
367 void addGuideCircle(const double&, const double&, const double&);
368 void addGuideHLine (const double &y0);
369
370
371
372public:
373
386
387
388
390 Single_Linkage = 0, //"single-link" or minimum
391 Complete_Linkage = 1, // "complete-link or maximum
392 Average_Linkage = 2, //mean or "average-linkage" or UPGMA
393
394 };
395
396 /* INIT AND CLEAR*/
397 Graph(const int &reserveVerticesSize = 5000, const int &reserveEdgesPerVertexSize = 500);
398 ~Graph();
399
400
401 void clear(const QString &reason="");
402
403 /*FILES (READ AND WRITE)*/
404
405 QString getFileName() const;
406
407 void setFileName(const QString &fileName);
408
409 QString getName() const;
410
411 void setName(const QString &graphName);
412
413 bool isSaved() const;
414
415 bool isLoaded() const;
416
417 int getFileFormat() const;
418
419 void setFileFormat(const int &fileFormat);
420
421 bool isFileFormatExportSupported(const int &fileFormat) const;
422
423 void setModStatus(const int &graphNewStatus, const bool&signalMW=true);
424
425 bool isModified() const ;
426
427 void loadFile (const QString fileName,
428 const QString codecName,
429 const int format,
430 const QString delimiter=QString(),
431 const int sm_two_mode = 1,
432 const bool sm_has_labels=false);
433
434 void saveToFile(const QString &fileName,
435 const int &fileType,
436 const bool &saveEdgeWeights=true,
437 const bool &saveZeroWeightEdges=false);
438
439 bool saveToPajekFormat (const QString &fileName,
440 QString networkName="",
441 int maxWidth=0, int maxHeight=0);
442
443 bool saveToAdjacencyFormat (const QString &fileName,
444 const bool &saveEdgeWeights=true);
445
446 bool saveToGraphMLFormat (const QString &fileName,
447 const bool &saveZeroWeightEdges=false,
448 QString networkName="",
449 int maxWidth=0, int maxHeight=0);
450
451 bool saveToDotFormat (QString fileName);
452
453 QString graphMatrixTypeToString(const int &matrixType) const;
454
455 int graphMatrixStrToType(const QString &matrix) const;
456
457 QString graphMetricTypeToString(const int &metricType) const;
458
459 int graphMetricStrToType(const QString &metricStr) const;
460
461 QString graphClusteringMethodTypeToString(const int &methodType) const;
462
463 int graphClusteringMethodStrToType(const QString &method) const;
464
465
466 /* RELATIONS */
467 int relations();
468
469 void relationsClear();
470
471 void relationAdd(const QString &relName, const bool &changeRelation=false);
472
473
474 /* VERTICES */
475 int vertexNumberMax();
476
477 int vertexNumberMin();
478
479 int vertexDegreeOut(int);
480
481 int vertexDegreeIn(int);
482
483 QList<int> vertexNeighborhoodList(const int &v1);
484 QSet<int> vertexNeighborhoodSet(const int &v1);
485
486 bool vertexIsolated(const int &v1) const;
487
488 int vertexExists(const int &v1 );
489
490 int vertexExists(const QString &label);
491
492 bool vertexFindByNumber (const QStringList &numList);
493
494 bool vertexFindByLabel (const QStringList &labelList);
495
496 bool vertexFindByIndexScore(const int &index,
497 const QStringList &thresholds,
498 const bool &considerWeights,
499 const bool &inverseWeights=false,
500 const bool &dropIsolates=false
501 );
502
503 void vertexRemove (const int &v1);
504
505 void vertexSizeInit (const int);
506
507 void vertexSizeSet(const int &v, const int &newsize);
508
509 int vertexSize(const int &v) const;
510
511 void vertexShapeSetDefault (const QString, const QString &iconPath=QString());
512
513 void vertexShapeSet(const int &v, const QString &shape, const QString &iconPath=QString());
514
515 QString vertexShape(const int &v);
516
517 QString vertexShapeIconPath(const int &v);
518
520
521 void vertexColorInit (const QString &color);
522
523 void vertexColorSet(const int &v, const QString &color);
524
525 QColor vertexColor(const int &v) const;
526
527 void vertexNumberColorInit (const QString &color);
528
529 void vertexNumberColorSet(const int &v=0, const QString &color = "#000000" );
530
531 void vertexNumberSizeInit (const int &size);
532
533 void vertexNumberSizeSet(const int &v, const int &newsize );
534
535 void vertexNumberDistanceInit (const int &distance);
536
537 void vertexNumberDistanceSet(const int &v, const int &newDistance );
538
539 void vertexLabelSet(const int &v, const QString &label);
540
541 QString vertexLabel(const int &v) const;
542
543 void vertexLabelsVisibilitySet(bool toggle);
544
545 void vertexLabelSizeInit(int newSize);
546
547 void vertexLabelSizeSet(const int &v, const int &labelSize );
548
549 void vertexLabelColorInit(QString color);
550
551 void vertexLabelColorSet(const int &v1, const QString &color);
552
553 void vertexLabelDistanceInit (const int &distance);
554
555 void vertexLabelDistanceSet(const int &v, const int &newDistance );
556
557 void vertexLabelDistanceAllSet (const int &newDistance);
558
559
560 void vertexPosSet(const int &v, const int &x, const int &y);
561
562 QPointF vertexPos(const int &v1) const;
563
564 int vertexClicked() const;
565
566 int vertices(const bool &dropIsolates=false, const bool &countAll=false, const bool &recount=false) ;
567
568 int vertexEdgesOutbound (int i) ;
569
570 int vertexEdgesInbound (int i) ;
571
572
574
576
578
579
580 QList<int> verticesListIsolated();
581
582 QList<int> verticesList();
583
584 QSet<int> verticesSet();
585
586
587
588 void verticesCreateSubgraph(QList<int> vList,
589 const int &type = SUBGRAPH_CLIQUE,
590 const int &center = 0);
591
592
593
594
595 /* EDGES */
596
597 int edgesEnabled();
598
600
601 qreal edgeExists(const int &v1,
602 const int &v2,
603 const bool &checkReciprocal=false);
604
605 qreal edgeExistsVirtual(const int &v1, const int &v2);
606
607 void edgeOutboundStatusSet (const int &source,
608 const int &target,
609 const bool &toggle=false);
610
611 void edgeInboundStatusSet (const int &target,
612 const int &source,
613 const bool &toggle=false);
614
615 void edgeRemove (const int &v1,
616 const int &v2,
617 const bool &removeReverse=false);
618
619 void edgeRemoveSelected (SelectedEdge &selectedEdge,
620 const bool &removeReverse);
621
623
624 bool edgeSymmetric(const int &v1, const int &v2);
625
626 void edgeTypeSet(const int &v1,
627 const int &v2,
628 const qreal &w,
629 const int &dirType=EdgeType::Directed);
630
631 void edgeWeightSet (const int &v1,
632 const int &v2,
633 const qreal &w,
634 const bool &undirected=false);
635
636 qreal edgeWeight(const int &v1, const int &v2) const;
637
638 void edgeWeightNumbersVisibilitySet (const bool &toggle);
639
640 void edgeLabelSet(const int &v1, const int &v2, const QString &label);
641
642 QString edgeLabel (const int &v1, const int &v2) const;
643
644 void edgeLabelsVisibilitySet (const bool &toggle);
645
646 void edgeColorInit(const QString &);
647
648 void edgeColorSet(const int &v1, const int &v2, const QString &color);
649
650 QString edgeColor (const int &v1, const int &v2);
651
652 bool edgeColorAllSet(const QString &color, const int &threshold=RAND_MAX);
653
654
655 /* GRAPH methods */
656
657 bool isEmpty() const;
658
659 QList<int> getSelectedVertices() const;
660
661 int getSelectedVerticesCount() const;
662
663 int getSelectedVerticesMin() const;
664
665 int getSelectedVerticesMax() const;
666
667 QList<SelectedEdge> getSelectedEdges() const;
668
669 int getSelectedEdgesCount() const;
670
671 int getGeodesicsCount();
672
673 qreal graphDensity();
674
675 bool isWeighted();
676
677 void setWeighted(const bool &toggle=true);
678
679 qreal graphReciprocity();
680
681 bool isSymmetric();
682
683 void setSymmetric();
684
685 void addRelationSymmetricStrongTies(const bool &allRelations=false);
686
688
689 void graphDichotomization(const qreal threshold);
690
691 void setDirected(const bool &toggle=true, const bool &signalMW=true);
692
693 void setUndirected(const bool &toggle=true, const bool &signalMW=true);
694
695 bool isDirected();
696
697 bool isUndirected();
698
699 bool isConnected();
700
701 void createMatrixAdjacency(const bool dropIsolates=false,
702 const bool considerWeights=true,
703 const bool inverseWeights=false,
704 const bool symmetrize=false );
705
706 bool createMatrixAdjacencyInverse(const QString &method="lu");
707
708
710 Matrix &SEM,
711 const int &measure=METRIC_SIMPLE_MATCHING,
712 const QString &varLocation="Rows",
713 const bool &diagonal=false,
714 const bool &considerWeights=true);
715
717 Matrix &PCC,
718 const QString &varLocation="Rows",
719 const bool &diagonal=false);
720
721 void createMatrixDissimilarities(Matrix &INPUT_MATRIX,
722 Matrix &DSM,
723 const int &metric,
724 const QString &varLocation,
725 const bool &diagonal,
726 const bool &considerWeights);
727
728 /* REPORT EXPORTS */
729 void setReportsDataDir(const QString &reportsDir);
730 void setReportsRealNumberPrecision (const int & precision);
731 void setReportsLabelLength(const int &length);
732 void setReportsChartType(const int &type);
733
734 void writeDataSetToFile(const QString dir, const QString );
735
736 void writeMatrixAdjacencyTo(QTextStream& os,
737 const bool &saveEdgeWeights=true);
738
739 void writeReciprocity( const QString fileName,
740 const bool considerWeights=false);
741
742 void writeMatrix(const QString &fileName,
743 const int &matrix=MATRIX_ADJACENCY,
744 const bool &considerWeights=true,
745 const bool &inverseWeights=false,
746 const bool &dropIsolates=false,
747 const QString &varLocation="Rows",
748 const bool &simpler=false);
749
750 void writeMatrixHTMLTable(QTextStream &outText, Matrix &M,
751 const bool &markDiag=true,
752 const bool &plain=false,
753 const bool &printInfinity=true,
754 const bool &dropIsolates=false);
755
756 void writeMatrixAdjacency(const QString fileName,
757 const bool &markDiag=true);
758
759 void writeMatrixAdjacencyPlot(const QString fileName,
760 const bool &simpler=false);
761
762 void writeMatrixAdjacencyInvert(const QString &filename,
763 const QString &method);
764
765 void writeMatrixLaplacianPlainText(const QString &filename);
766 void writeMatrixDegreeText(const QString &filename);
767
768 void writeMatrixDistancesPlainText(const QString &fn,
769 const bool &considerWeights,
770 const bool &inverseWeights,
771 const bool &dropIsolates);
772
773 void writeMatrixShortestPathsPlainText(const QString &fn,
774 const bool &considerWeights,
775 const bool &inverseWeights);
776
777 void writeMatrixDissimilarities(const QString fileName,
778 const QString &metricStr,
779 const QString &varLocation,
780 const bool &diagonal,
781 const bool &considerWeights) ;
782
783 void writeMatrixSimilarityMatchingPlain(const QString fileName,
784 const int &measure=METRIC_SIMPLE_MATCHING,
785 const QString &matrix = "adjacency",
786 const QString &varLocation="rows",
787 const bool &diagonal=false,
788 const bool &considerWeights=true);
789
790 void writeMatrixSimilarityMatching(const QString fileName,
791 const QString &measure="Simple",
792 const QString &matrix = "adjacency",
793 const QString &varLocation="rows",
794 const bool &diagonal=false,
795 const bool &considerWeights=true);
796
797
798 void writeMatrixSimilarityPearson(const QString fileName,
799 const bool considerWeights,
800 const QString &matrix = "adjacency",
801 const QString &varLocation="rows",
802 const bool &diagonal=false);
803
804 void writeMatrixSimilarityPearsonPlainText(const QString fileName,
805 const bool considerWeights,
806 const QString &matrix = "adjacency",
807 const QString &varLocation="rows",
808 const bool &diagonal=false);
809
810 void writeEccentricity( const QString fileName,
811 const bool considerWeights=false,
812 const bool inverseWeights=false,
813 const bool dropIsolates=false);
814
815 // friend QTextStream& operator << (QTextStream& os, Graph& m);
816
817 void writeCentralityDegree(const QString,
818 const bool weights,
819 const bool dropIsolates);
820
821 void writeCentralityCloseness(const QString,
822 const bool weights,
823 const bool inverseWeights,
824 const bool dropIsolates);
825
827 const bool weights,
828 const bool inverseWeights,
829 const bool dropIsolates);
830
831 void writeCentralityBetweenness(const QString,
832 const bool weights,
833 const bool inverseWeights,
834 const bool dropIsolates);
835
836 void writeCentralityPower(const QString,
837 const bool weigths,
838 const bool inverseWeights,
839 const bool dropIsolates);
840
841 void writeCentralityStress(const QString,
842 const bool weigths,
843 const bool inverseWeights,
844 const bool dropIsolates);
845
846 void writeCentralityEccentricity(const QString,
847 const bool weigths,
848 const bool inverseWeights,
849 const bool dropIsolates);
850
851 void writeCentralityInformation(const QString,
852 const bool weigths,
853 const bool inverseWeights);
854
855 void writeCentralityEigenvector(const QString,
856 const bool &weigths=true,
857 const bool &inverseWeights = false,
858 const bool &dropIsolates=false);
859
860 void writePrestigeDegree(const QString, const bool weights,
861 const bool dropIsolates);
862
863 void writePrestigeProximity(const QString, const bool weights,
864 const bool inverseWeights,
865 const bool dropIsolates);
866
867 void writePrestigePageRank(const QString, const bool Isolates=false);
868
869
870 bool writeClusteringHierarchical(const QString &fileName,
871 const QString &varLocation,
872 const QString &matrix = "Adjacency",
873 const QString &metric = "Manhattan",
874 const QString &method = "Complete",
875 const bool &diagonal = false,
876 const bool &dendrogram = false,
877 const bool &considerWeights=true,
878 const bool &inverseWeights=false,
879 const bool &dropIsolates=false);
880
881 void writeClusteringHierarchicalResultsToStream(QTextStream& outText,
882 const int N,
883 const bool &dendrogram = false);
884
885 bool writeCliqueCensus( const QString &fileName,
886 const bool considerWeights);
887
888 void writeClusteringCoefficient(const QString, const bool);
889
890 void writeTriadCensus(const QString, const bool);
891
892
893
894 /* DISTANCES, CENTRALITIES & PROMINENCE MEASURES */
895
896 int graphConnectednessFull (const bool updateProgress=false) ;
897
898 bool graphReachable(const int &v1, const int &v2) ;
899
901
902 int graphDiameter(const bool considerWeights, const bool inverseWeights);
903
904 int graphDistanceGeodesic(const int &v1,
905 const int &v2,
906 const bool &considerWeights=false,
907 const bool &inverseWeights=true);
908
909 qreal graphDistanceGeodesicAverage(const bool considerWeights,
910 const bool inverseWeights,
911 const bool dropIsolates);
912
913 void graphDistancesGeodesic(const bool &computeCentralities=false,
914 const bool &considerWeights=false,
915 const bool &inverseWeights=true,
916 const bool &dropIsolates=false);
917
918 void graphMatrixDistanceGeodesicCreate(const bool &considerWeights=false,
919 const bool &inverseWeights=true,
920 const bool &dropIsolates=false);
921
922 void graphMatrixShortestPathsCreate(const bool &considerWeights=false,
923 const bool &inverseWeights=true,
924 const bool &dropIsolates=false) ;
925
926 int getProminenceIndexByName(const QString &prominenceIndexName);
927
928 void prominenceDistribution(const int &index,
929 const ChartType &type,
930 const QString &distImageFileName=QString());
931
932 void prominenceDistributionBars(const H_StrToInt &discreteClasses,
933 const QString &name,
934 const QString &distImageFileName);
935
936 void prominenceDistributionArea(const H_StrToInt &discreteClasses,
937 const QString &name,
938 const QString &distImageFileName);
939
940 void prominenceDistributionSpline(const H_StrToInt &discreteClasses,
941 const QString &seriesName,
942 const QString &distImageFileName);
943
944 void centralityDegree(const bool &considerWeights=true,
945 const bool &dropIsolates=false);
946
947 void centralityInformation(const bool considerWeights=false,
948 const bool inverseWeights=false);
949
950 void centralityEigenvector(const bool &considerWeights=false,
951 const bool &inverseWeights=false,
952 const bool &dropIsolates=false);
953
954 void centralityClosenessIR(const bool considerWeights=false,
955 const bool inverseWeights=false,
956 const bool dropIsolates=false);
957
958 void prestigeDegree(const bool &considerWeights, const bool &dropIsolates=false);
959
960 void prestigePageRank(const bool &dropIsolates=false);
961
962 void prestigeProximity(const bool considerWeights=false,
963 const bool inverseWeights=false,
964 const bool dropIsolates=false);
965
966
967 /* REACHABILITY AND WALKS */
968
969 int walksBetween(int v1, int v2,int length);
970
971 void graphWalksMatrixCreate(const int &N=0,
972 const int &length=0,
973 const bool &updateProgress=false);
974
975 void writeWalksTotalMatrixPlainText(const QString &fn);
976
977 void writeWalksOfLengthMatrixPlainText(const QString &fn, const int &length);
978
979 void writeMatrixWalks (const QString &fn,
980 const int &length=0,
981 const bool &simpler=false);
982
983 QList<int> vertexinfluenceRange(int v1);
984
985 QList<int> vertexinfluenceDomain(int v2);
986
987 void writeReachabilityMatrixPlainText( const QString &fn,
988 const bool &dropIsolates=false);
989
990
991 qreal numberOfTriples(int v1);
992
993 /* CLIQUES, CLUSTERING, TRIADS */
994 void graphCliques(QSet<int> R=QSet<int>(), QSet<int> P=QSet<int>(), QSet<int> X=QSet<int>() );
995
996 void graphCliqueAdd (const QList<int> &clique);
997
998 int graphCliquesContaining(const int &actor, const int &size=0);
999
1000 int graphCliquesOfSize(const int &size );
1001
1002 bool graphClusteringHierarchical(Matrix &STR_EQUIV,
1003 const QString &varLocation,
1004 const int &metric,
1005 const int &method,
1006 const bool &diagonal=false,
1007 const bool &diagram=false,
1008 const bool &considerWeights=true,
1009 const bool &inverseWeights=false,
1010 const bool &dropIsolates=false);
1011
1012 qreal clusteringCoefficientLocal(const int &v1);
1013
1014 qreal clusteringCoefficient (const bool updateProgress=false);
1015
1016 bool graphTriadCensus();
1017
1019 // void eccentr_JordanCenter(); // TODO
1020
1021
1022
1023 /* LAYOUTS */
1024
1025 void layoutRandom();
1026
1027 void layoutRadialRandom(const bool &guides=true);
1028
1029 void layoutCircular(const double &x0,
1030 const double &y0,
1031 const double &newRadius,
1032 const bool &guides=false);
1033
1034
1035 void layoutByProminenceIndex ( int prominenceIndex,
1036 int layoutType,
1037 const bool &considerWeights=false,
1038 const bool &inverseWeights=false,
1039 const bool &dropIsolates=false);
1040
1041
1043
1045
1046
1047 void layoutForceDirectedSpringEmbedder(const int maxIterations);
1048
1049 void layoutForceDirectedFruchtermanReingold(const int maxIterations);
1050
1051 void layoutForceDirectedKamadaKawai(const int maxIterations=500,
1052 const bool considerWeights=false,
1053 const bool inverseWeights=false,
1054 const bool dropIsolates=false,
1055 const QString &initialPositions="current");
1056
1057 qreal graphDistanceEuclidean(const QPointF &a, const QPointF &b);
1058
1059 qreal graphDistanceEuclidean(const QPointF &a);
1060
1061 int sign(const qreal &D);
1062
1063 qreal layoutForceDirected_F_rep(const QString model,
1064 const qreal &dist,
1065 const qreal &optimalDistance);
1066
1067 qreal layoutForceDirected_F_att(const QString model,
1068 const qreal &dist,
1069 const qreal &optimalDistance) ;
1070
1071 void layoutForceDirected_Eades_moveNodes(const qreal &c4);
1072
1073 void layoutForceDirected_FR_moveNodes(const qreal &temperature) ;
1074
1075 qreal layoutForceDirected_FR_temperature(const int iteration) const;
1076
1077 qreal computeOptimalDistance(const int &V);
1078
1079 void compute_angles( const QPointF &Delta,
1080 const qreal &dist,
1081 qreal &angle1,
1082 qreal &angle2,
1083 qreal &degrees1,
1084 qreal &degrees2 );
1085
1086
1087
1088 /* CRAWLER */
1089 void webCrawlTerminateThreads (QString reason);
1090
1091
1092
1094 void randomizeThings();
1095
1096 void randomNetErdosCreate ( const int &N,
1097 const QString &model,
1098 const int &m,
1099 const qreal &p,
1100 const QString &mode,
1101 const bool &diag);
1102
1103 void randomNetScaleFreeCreate (const int &N,
1104 const int &power,
1105 const int &m0,
1106 const int &m,
1107 const qreal &alpha,
1108 const QString &mode);
1109
1110 void randomNetSmallWorldCreate(const int &N, const int &degree,
1111 const double &beta, const QString &mode);
1112
1113 void randomNetRingLatticeCreate (const int &N, const int &degree,
1114 const bool updateProgress=false);
1115
1116 void randomNetRegularCreate (const int &N,
1117 const int &degree,
1118 const QString &mode,
1119 const bool &diag);
1120
1121 void randomNetLatticeCreate(const int &N,
1122 const int &length,
1123 const int &dimension,
1124 const int &neighborhoodLength,
1125 const QString &mode,
1126 const bool &circular=false);
1127
1128 int factorial (int);
1129
1130
1137
1138 // Stores the number of vertices at distance n from a given vertex
1140
1141 /* maps have O(logN) lookup complexity */
1142 /* Consider using tr1::hashmap which has O(1) lookup, but this is not ISO C++ yet :( */
1143
1144
1145
1146private:
1147
1150 void edgeAdd (const int &v1,
1151 const int &v2,
1152 const qreal &weight,
1153 const int &type,
1154 const QString &label,
1155 const QString &color
1156 );
1157
1159 void BFS(const int &s,
1160 const int &si,
1161 const bool &computeCentralities=false,
1162 const bool &dropIsolates=false);
1163
1164 void dijkstra(const int &s,
1165 const int &si,
1166 const bool &computeCentralities=false,
1167 const bool &inverseWeights=false,
1168 const bool &dropIsolates=false);
1169
1170 void minmax(qreal C,
1171 GraphVertex *v,
1172 qreal &max,
1173 qreal &min,
1174 int &maxNode, int &minNode
1175 );
1176
1177 void resolveClasses ( qreal C,
1178 H_StrToInt &discreteClasses,
1179 int &classes);
1180
1181 void resolveClasses ( qreal C,
1182 H_StrToInt &discreteClasses,
1183 int &classes, int name);
1184
1185
1186 VList m_graph; // List of pointers to the vertices. Each vertex stores all info: links, colors, etc
1187
1188 Parser *file_parser; // Our file loader threaded class.
1189
1190 WebCrawler *web_crawler; // Our web crawler threaded class. This will parse the downloaded HTML.
1191
1192 QQueue<QUrl> *urlQueue; // A queue where the crawler will put urls for the network manager to download
1193
1194 int m_crawler_max_urls; // maximum urls we'll visit (max nodes in the resulted network)
1195 int m_crawler_visited_urls; // A counter of the urls visited.
1196
1197
1198 QList<QString> m_relationsList;
1199
1201
1202 QList<int> triadTypeFreqs; //stores triad type frequencies
1203
1204 QList<int> m_verticesList;
1206
1208
1209 QSet<int> m_verticesSet;
1210
1211 QList<SelectedEdge> m_selectedEdges;
1212
1213 QMultiHash <int, int> influenceRanges, influenceDomains;
1214
1215 QMultiHash <int, int> m_vertexPairsNotConnected;
1217
1218 QMultiMap <int, L_int > m_cliques;
1219 QHash <int, QSet<int> > neighboursHash;
1220
1221 QList <qreal> m_clusteringLevel;
1222 QMap <int, V_int> m_clustersPerSequence;
1223
1224 QMap<QString, V_int> m_clustersByName;
1226
1229
1230 stack<int> Stack;
1231
1236
1241
1243
1245
1272
1289
1297 bool order;
1308
1310
1312
1325
1327
1332
1334};
1335
1336#endif
1337
Definition chart.h:41
Definition graphvertex.h:51
The Graph class This is the main class for a Graph, used in conjuction with GraphVertex,...
Definition graph.h:98
void vertexNumberColorSet(const int &v=0, const QString &color="#000000")
Graph::vertexColorSet Changes the color of vertex v1.
Definition graph.cpp:1742
qreal maxIRCC
Definition graph.h:1263
void signalSelectionChanged(const int &selectedVertices, const int &selectedEdges)
QHash< int, int > m_vertexPairsUnilaterallyConnected
Definition graph.h:1216
qreal denomIC
Definition graph.h:1268
Matrix XSM
Definition graph.h:1228
int factorial(int)
Definition graph.cpp:15606
int initVertexNumberSize
Definition graph.h:1295
bool calculatedIC
Definition graph.h:1320
int reciprocalEdgesVert
Definition graph.h:1311
void signalRelationChangedToGW(int)
void canvasSizeSet(const int &width, const int &height)
Sets the size of the canvas.
Definition graph.cpp:438
void signalEdgeType(const int &v1, const int &v2, const int &type)
QList< SelectedEdge > getSelectedEdges() const
Returns a QList of user-selected edges in pair<int,int>
Definition graph.cpp:3300
int m_totalVertices
Definition graph.h:1294
qreal denomPRC
Definition graph.h:1270
qreal maxPP
Definition graph.h:1271
qreal minIC
Definition graph.h:1268
qreal varianceSDC
Definition graph.h:1247
int getProminenceIndexByName(const QString &prominenceIndexName)
Returns the IndexType of the given prominence index name Called from MW::slotEditNodeFind,...
Definition graph.cpp:7379
int minNodeSBC
Definition graph.h:1279
QString initVertexShape
Definition graph.h:1330
bool isSymmetric()
Returns TRUE if the adjacency matrix of the current relation is symmetric.
Definition graph.cpp:4052
qreal sumPRP
Definition graph.h:1270
qreal sumDC
Definition graph.h:1261
void vertexCreateAtPosRandomWithLabel(const int &i, const QString &label, const bool &signalMW=false)
Creates a new randomly positioned vertex with specific number and label. All other values are from th...
Definition graph.cpp:914
qreal nomSPC
Definition graph.h:1265
int m_reserveEdgesPerVertexSize
Definition graph.h:1293
void signalRemoveEdge(const int &v1, const int &v2, const bool &removeReverse)
int initVertexNumberDistance
Definition graph.h:1296
void prestigePageRank(const bool &dropIsolates=false)
Calculates the PageRank Prestige of each vertex.
Definition graph.cpp:10779
int graphConnectednessFull(const bool updateProgress=false)
int getSelectedVerticesCount() const
Returns count of user-selected vertices.
Definition graph.cpp:3264
void writeMatrixAdjacencyTo(QTextStream &os, const bool &saveEdgeWeights=true)
Definition graph.cpp:21028
qreal maxEC
Definition graph.h:1267
void vertexShapeSetDefault(const QString, const QString &iconPath=QString())
Sets the default vertex shape and iconPath.
Definition graph.cpp:1597
qreal sumBC
Definition graph.h:1264
qreal sumSCC
Definition graph.h:1262
int minNodeSCC
Definition graph.h:1277
int classesSCC
Definition graph.h:1277
qreal edgeWeightTemp
Definition graph.h:1246
int m_graphReciprocityTiesTotal
Definition graph.h:1305
int m_reportsLabelLength
Definition graph.h:1239
int classesSSC
Definition graph.h:1281
Matrix CLQM
Definition graph.h:1228
void setName(const QString &graphName)
Sets the name of the current graph.
Definition graph.cpp:15644
void writePrestigePageRank(const QString, const bool Isolates=false)
Writes the PageRank scores of vertices to a file.
Definition graph.cpp:11023
int initVertexLabelSize
Definition graph.h:1295
bool graphClusteringHierarchical(Matrix &STR_EQUIV, const QString &varLocation, const int &metric, const int &method, const bool &diagonal=false, const bool &diagram=false, const bool &considerWeights=true, const bool &inverseWeights=false, const bool &dropIsolates=false)
Performs an hierarchical clustering process (Johnson, 1967) on a given NxN distance/dissimilarity mat...
Definition graph.cpp:13936
qreal sumSSC
Definition graph.h:1266
qreal sumCC
Definition graph.h:1262
bool m_graphIsWeighted
Definition graph.h:1324
void randomNetRingLatticeCreate(const int &N, const int &degree, const bool updateProgress=false)
Creates a random ring lattice network.
Definition graph.cpp:11861
WebCrawler * web_crawler
Definition graph.h:1190
qreal maxIndexEC
Definition graph.h:1267
bool m_graphIsSymmetric
Definition graph.h:1324
void writeMatrixWalks(const QString &fn, const int &length=0, const bool &simpler=false)
Calls graphWalksMatrixCreate() to compute walks and writes the Walks of given length matrix to a file...
Definition graph.cpp:12337
void vertexLabelDistanceInit(const int &distance)
Changes the default distance of vertex labels.
Definition graph.cpp:2035
QString relationCurrentName() const
Gets the current relation name.
Definition graph.cpp:669
void setNodeNumberDistance(const int &v, const int &distance)
int minNodeEC
Definition graph.h:1282
int graphDistanceGeodesic(const int &v1, const int &v2, const bool &considerWeights=false, const bool &inverseWeights=true)
Returns the geodesic distance (length of shortest path) from vertex v1 to vertex v2.
Definition graph.cpp:4625
MyEdge edgeClicked()
Returns clicked edge.
Definition graph.cpp:2532
void layoutForceDirectedKamadaKawai(const int maxIterations=500, const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false, const QString &initialPositions="current")
Embeds a Force Directed Placement layout according to the Kamada-Kawai model. In this model,...
Definition graph.cpp:22457
void writeMatrixSimilarityPearson(const QString fileName, const bool considerWeights, const QString &matrix="adjacency", const QString &varLocation="rows", const bool &diagonal=false)
Calls Graph::createMatrixSimilarityPearson() and writes Pearson Correlation Coefficients to given fil...
Definition graph.cpp:14759
int maxNodeEC
Definition graph.h:1282
H_StrToInt discretePPs
Definition graph.h:1235
void prominenceDistributionArea(const H_StrToInt &discreteClasses, const QString &name, const QString &distImageFileName)
Computes the distribution of a centrality index scores. The distribution data are returned as QAreaSe...
Definition graph.cpp:7704
int classesEVC
Definition graph.h:1287
QString vertexLabel(const int &v) const
Returns the label of a vertex v1.
Definition graph.cpp:1885
void setFileName(const QString &fileName)
Sets the file name of the current graph.
Definition graph.cpp:15668
void slotHandleCrawlerRequestReply()
Gets the reply of a MW network request made by Web Crawler, and emits that reply as is to the Web Cra...
Definition graph.cpp:3636
void signalNetworkManagerRequest(const QUrl &currentUrl, const NetworkRequestType &type)
int vertices(const bool &dropIsolates=false, const bool &countAll=false, const bool &recount=false)
Gets the number of vertices in the graph.
Definition graph.cpp:2925
void writeCentralityStress(const QString, const bool weigths, const bool inverseWeights, const bool dropIsolates)
Writes the Stress centralities to a file.
Definition graph.cpp:9234
QMultiMap< int, L_int > m_cliques
Definition graph.h:1218
MyEdge m_clickedEdge
Definition graph.h:1244
void signalRelationAddToMW(const QString &newRelation)
qreal denomSPC
Definition graph.h:1265
Matrix XM
Definition graph.h:1228
void minmax(qreal C, GraphVertex *v, qreal &max, qreal &min, int &maxNode, int &minNode)
Computes minimum and maximum centralities during graphDistancesGeodesic()
Definition graph.cpp:6133
QList< SelectedEdge > m_selectedEdges
Definition graph.h:1211
qreal sumPP
Definition graph.h:1271
qreal nomPP
Definition graph.h:1271
void writeMatrixHTMLTable(QTextStream &outText, Matrix &M, const bool &markDiag=true, const bool &plain=false, const bool &printInfinity=true, const bool &dropIsolates=false)
Writes the matrix M as HTML.
Definition graph.cpp:20890
int vertexClicked() const
Returns the number of the clicked vertex.
Definition graph.cpp:1531
int m_curRelation
Definition graph.h:1242
void setEdgeWeight(const int &v1, const int &v2, const qreal &weight)
bool calculatedGraphReciprocity
Definition graph.h:1322
QThread webcrawlerThread
Definition graph.h:101
void signalSetEdgeVisibility(const int &relation, const int &source, const int &target, const bool &toggle, const bool &preserveReverseEdge=false, const int &edgeWeight=1, const int &reverseEdgeWeight=1)
int maxNodeDP
Definition graph.h:1275
int minNodePP
Definition graph.h:1286
QString graphMetricTypeToString(const int &metricType) const
Helper method, return the human readable name of metric type.
Definition graph.cpp:23204
void graphCliqueAdd(const QList< int > &clique)
Called from Graph::graphCliques to add a new clique (list of vertices) Adds clique info to each cliqu...
Definition graph.cpp:13275
qreal m_graphAverageDistance
Definition graph.h:1299
qreal varianceSDP
Definition graph.h:1256
QList< int > m_graphFileFormatExportSupported
Definition graph.h:1200
qreal denomPP
Definition graph.h:1271
bool isSaved() const
Returns true if the graph is saved.
Definition graph.cpp:15855
qreal denomEC
Definition graph.h:1267
qreal minSBC
Definition graph.h:1264
int minNodeIC
Definition graph.h:1284
qreal maxIndexIC
Definition graph.h:1268
bool calculatedGraphDensity
Definition graph.h:1323
void writeCentralityClosenessInfluenceRange(const QString, const bool weights, const bool inverseWeights, const bool dropIsolates)
Writes the "improved" closeness centrality indices to a file.
Definition graph.cpp:8727
qreal sumSC
Definition graph.h:1266
void layoutForceDirected_Eades_moveNodes(const qreal &c4)
Definition graph.cpp:23009
void vertexCreate(const int &number, const int &size, const QString &color, const QString &numColor, const int &numSize, const QString &label, const QString &labelColor, const int &labelSize, const QPointF &p, const QString &shape, const QString &iconPath=QString(), const bool &signalMW=false)
Creates a new vertex.
Definition graph.cpp:770
bool createMatrixAdjacencyInverse(const QString &method="lu")
Computes the inverse of the current adjacency matrix.
Definition graph.cpp:21461
void signalEdgeClicked(const MyEdge &edge=MyEdge(), const bool &openMenu=false)
QMap< int, V_str > m_clusterPairNamesPerSeq
Definition graph.h:1225
QString m_reportsDataDir
Definition graph.h:1237
void edgeWeightNumbersVisibilitySet(const bool &toggle)
Changes the visibility of edge weight numbers.
Definition graph.cpp:2713
void signalRelationsClear()
bool edgeColorAllSet(const QString &color, const int &threshold=RAND_MAX)
Changes the color of all enabled edges.
Definition graph.cpp:2737
int getSelectedVerticesMin() const
Returns min of user-selected vertices.
Definition graph.cpp:3273
void writeCentralityEccentricity(const QString, const bool weigths, const bool inverseWeights, const bool dropIsolates)
Writes the Eccentricity centralities (aka Harary Graph Centrality) to a file.
Definition graph.cpp:9469
int m_vertexClicked
Definition graph.h:1242
qreal minSSC
Definition graph.h:1266
QList< int > vertexNeighborhoodList(const int &v1)
Returns a list of all vertices mutually connected to vertex v1 in the current relation.
Definition graph.cpp:2894
int relations()
Returns the count of relationships in this Graph.
Definition graph.cpp:732
void graphFileLoaded(const int &fileType, const QString &fName=QString(), const QString &netName=QString(), const int &totalNodes=0, const int &totalLinks=0, const int &edgeDirType=0, const qint64 &elapsedTime=0, const QString &message=QString())
Stores loaded file name, graph name, sets edge direction type and signals MW to update the UI.
Definition graph.cpp:16000
void setNodeLabelColor(const int &v, const QString &color)
qreal edgeReverseWeightTemp
Definition graph.h:1246
int verticesWithReciprocalEdges()
Returns the sum of vertices having reciprocal edges.
Definition graph.cpp:3427
bool saveToGraphMLFormat(const QString &fileName, const bool &saveZeroWeightEdges=false, QString networkName="", int maxWidth=0, int maxHeight=0)
Saves the current graph to a GraphML-formatted file.
Definition graph.cpp:16283
bool saveToPajekFormat(const QString &fileName, QString networkName="", int maxWidth=0, int maxHeight=0)
Saves the active graph to a Pajek-formatted file.
Definition graph.cpp:16127
void relationAddCocitation()
Creates a new symmetric relation by connecting those actors that are cocitated by others....
Definition graph.cpp:4244
QString graphMatrixTypeToString(const int &matrixType) const
Helper method, return the human readable name of matrix type.
Definition graph.cpp:23097
qreal sumEC
Definition graph.h:1267
int vertexExists(const int &v1)
Checks if the given vertex exists in the graph.
Definition graph.cpp:984
qreal variancePRP
Definition graph.h:1258
void setNodeLabelSize(const int &v, const int &size)
bool graphReachable(const int &v1, const int &v2)
Returns true if vertices v1 and v2 are reachable.
Definition graph.cpp:4539
int m_graphDiameter
Definition graph.h:1294
QThread file_parserThread
Definition graph.h:100
bool calculatedPRP
Definition graph.h:1320
H_StrToInt discreteEccentricities
Definition graph.h:1234
void graphCliques(QSet< int > R=QSet< int >(), QSet< int > P=QSet< int >(), QSet< int > X=QSet< int >())
Finds all maximal cliques in an undirected (?) graph. Implements the Bron–Kerbosch algorithm,...
Definition graph.cpp:13338
QString getFileName() const
Returns the file name of the current graph, if any.
Definition graph.cpp:15657
int graphMatrixStrToType(const QString &matrix) const
Helper method, return the matrix type of human readable matrix name .
Definition graph.cpp:23155
void graphLoadedTerminateParserThreads(QString reason)
Graph::graphLoadedTerminateParserThreads.
Definition graph.cpp:15968
void writeMatrixAdjacencyInvert(const QString &filename, const QString &method)
Calls Graph::createMatrixAdjacencyInverse(method) to compute the inverse of the adjacency matrix and ...
Definition graph.cpp:21509
int vertexSize(const int &v) const
Returns the size of vertex v.
Definition graph.cpp:1585
void setNodeSize(const int &v, const int &size)
qreal denomSCC
Definition graph.h:1262
int m_graphReciprocityTiesNonSymmetric
Definition graph.h:1304
void layoutVertexSizeByOutdegree()
Convenience method Changes the size of all nodes to be proportional to their outDegree (Degree Centra...
Definition graph.cpp:21780
qreal t_sumIC
Definition graph.h:1265
QMap< int, V_int > m_clustersPerSequence
Definition graph.h:1222
void edgeLabelSet(const int &v1, const int &v2, const QString &label)
Changes the label of edge v1->v2.
Definition graph.cpp:2834
bool writeCliqueCensus(const QString &fileName, const bool considerWeights)
Graph::writeCliqueCensus Calls graphCliques() to compute all cliques (maximal connected subgraphs) of...
Definition graph.cpp:12955
void compute_angles(const QPointF &Delta, const qreal &dist, qreal &angle1, qreal &angle2, qreal &degrees1, qreal &degrees2)
Graph::compute_angles Computes the two angles of the orthogonal triangle shaped by two points of diff...
Definition graph.cpp:22958
QQueue< QUrl > * urlQueue
Definition graph.h:1192
int sign(const qreal &D)
Graph::sign returns the sign of number D as integer (1 or -1)
Definition graph.cpp:22934
QSet< int > m_verticesSet
Definition graph.h:1209
double canvasVisibleY(const double &y) const
Checks if y is visible inside the canvas usable area and if not returns an adjusted y-coordinate.
Definition graph.cpp:495
QList< int > m_verticesIsolatedList
Definition graph.h:1205
int minNodePRP
Definition graph.h:1285
void writeMatrixLaplacianPlainText(const QString &filename)
Computes the Laplacian matrix of the graph and writes it to given file.
Definition graph.cpp:21590
void vertexCreateAtPos(const QPointF &p)
Creates a new vertex in the given position.
Definition graph.cpp:854
qreal meanIC
Definition graph.h:1254
qreal sumPC
Definition graph.h:1270
QMultiHash< int, int > influenceRanges
Definition graph.h:1213
void relationPrev()
Changes graph to previous relation.
Definition graph.cpp:603
int classesSPC
Definition graph.h:1280
void layoutRadialRandom(const bool &guides=true)
Repositions all nodes on the periphery of different circles with random radius.
Definition graph.cpp:21659
void writeMatrixAdjacency(const QString fileName, const bool &markDiag=true)
Definition graph.cpp:21057
void addGuideHLine(const double &y0)
qreal groupIRCC
Definition graph.h:1263
bool vertexFindByLabel(const QStringList &labelList)
Finds vertices by their label.
Definition graph.cpp:1079
void prominenceDistribution(const int &index, const ChartType &type, const QString &distImageFileName=QString())
Computes the distribution of a centrality index score. The distribution is stored as Qt Series depend...
Definition graph.cpp:7436
qreal variancePP
Definition graph.h:1257
qreal minSDP
Definition graph.h:1260
int vertexEdgesOutbound(int i)
Returns the number of outbound edges (arcs) from vertex v1.
Definition graph.cpp:2652
bool calculatedVerticesList
Definition graph.h:1315
qreal meanIRCC
Definition graph.h:1249
qreal maxIndexPC
Definition graph.h:1265
void createMatrixDissimilarities(Matrix &INPUT_MATRIX, Matrix &DSM, const int &metric, const QString &varLocation, const bool &diagonal, const bool &considerWeights)
Calls Matrix:distancesMatrix to compute the dissimilarities matrix DSM of the variables (rows,...
Definition graph.cpp:14534
H_StrToInt discretePRPs
Definition graph.h:1235
void writeCentralityEigenvector(const QString, const bool &weigths=true, const bool &inverseWeights=false, const bool &dropIsolates=false)
Writes the eigenvector centralities to a file.
Definition graph.cpp:6864
void vertexPosSet(const int &v, const int &x, const int &y)
Changes the position of the given vertex.
Definition graph.cpp:1482
qreal canvasHeight
Definition graph.h:1313
qreal sumSEVC
Definition graph.h:1269
void setNodeLabelDistance(const int &v, const int &distance)
void edgeFilterUnilateral(const bool &toggle)
Enables or disables unilateral edges in current relationship.
Definition graph.cpp:2473
H_f_i sizeOfNthOrderNeighborhood
Definition graph.h:1139
void setVertexVisibility(const int &number, const bool &toggle)
int maxNodeSSC
Definition graph.h:1281
qreal maxEccentricity
Definition graph.h:1259
qreal minEVC
Definition graph.h:1269
void createMatrixReachability()
Creates the reachability matrix XRM.
Definition graph.cpp:4551
void signalRelationChangedToMW(const int &relIndex=RAND_MAX)
qreal maxSPC
Definition graph.h:1265
void signalDrawEdge(const int &v1, const int &v2, const qreal &weight, const QString &label="", const QString &color="black", const int &type=0, const bool &drawArrows=true, const bool &bezier=false, const bool &weightNumbers=false)
void prominenceDistributionSpline(const H_StrToInt &discreteClasses, const QString &seriesName, const QString &distImageFileName)
Computes the distribution of a centrality index scores. The distribution data are returned as QSpline...
Definition graph.cpp:7552
Matrix invM
Definition graph.h:1227
qreal sumIC
Definition graph.h:1268
qreal varianceIRCC
Definition graph.h:1249
qreal layoutForceDirected_F_rep(const QString model, const qreal &dist, const qreal &optimalDistance)
Definition graph.cpp:22895
int getFileFormat() const
Returns the format of the last file opened.
Definition graph.cpp:15679
qreal canvasWidth
Definition graph.h:1313
qreal clusteringCoefficient(const bool updateProgress=false)
Computes local clustering coefficients and returns the network average Clustering Coefficient.
Definition graph.cpp:15212
void resolveClasses(qreal C, H_StrToInt &discreteClasses, int &classes)
Checks if score C is a new prominence class If yes, it stores that number in a QHash<QString,...
Definition graph.cpp:6158
void edgeAdd(const int &v1, const int &v2, const qreal &weight, const int &type, const QString &label, const QString &color)
Adds a directed edge from v1 to v2 If type == EdgeType::Undirected then it also adds the directed edg...
Definition graph.cpp:2189
qreal meanEC
Definition graph.h:1252
int m_reportsRealPrecision
Definition graph.h:1238
void vertexColorInit(const QString &color)
Graph::vertexColorInit default vertex color initialization.
Definition graph.cpp:1717
qreal t_sumPRP
Definition graph.h:1270
QMultiHash< int, int > m_vertexPairsNotConnected
Definition graph.h:1215
void vertexLabelColorSet(const int &v1, const QString &color)
Changes the label color of vertex v1 or all vertices if v1 = 0.
Definition graph.cpp:1948
int maxNodeSDC
Definition graph.h:1276
int graphCliquesContaining(const int &actor, const int &size=0)
Definition graph.cpp:13492
void setEdgeLabel(const int &v1, const int &v2, const QString &label)
void triadType_examine_MAN_label(int, int, int, GraphVertex *, GraphVertex *, GraphVertex *)
Definition graph.cpp:15387
void setUndirected(const bool &toggle=true, const bool &signalMW=true)
Makes the graph undirected or directed.
Definition graph.cpp:4413
qreal clusteringCoefficientLocal(const int &v1)
Returns the local clustering coefficient (CLUCOF) of a vertex v1.
Definition graph.cpp:15042
void randomNetRegularCreate(const int &N, const int &degree, const QString &mode, const bool &diag)
Creates a random network where nodes have the same degree.
Definition graph.cpp:11684
QString initVertexNumberColor
Definition graph.h:1329
qreal minEccentricity
Definition graph.h:1259
int vertexDegreeIn(int)
Returns the inDegree (sum of inbound edge weights) of vertex v1.
Definition graph.cpp:2883
qreal maxPRP
Definition graph.h:1270
qreal groupDP
Definition graph.h:1260
int maxNodeEVC
Definition graph.h:1287
qreal sumSDP
Definition graph.h:1260
void edgeClickedSet(const int &v1, const int &v2, const bool &openMenu=false)
Sets the clicked edge.
Definition graph.cpp:2495
void writePrestigeDegree(const QString, const bool weights, const bool dropIsolates)
Writes the Degree Prestige of each node to a file.
Definition graph.cpp:10144
void signalRemoveNode(int)
int edgesEnabled()
Returns the number |E| of graph - only the enabled edges.
Definition graph.cpp:2624
H_StrToInt discreteSDCs
Definition graph.h:1233
H_StrToInt discreteDPs
Definition graph.h:1233
void edgeColorInit(const QString &)
Saves the default edge color Used by random network creation methods.
Definition graph.cpp:2724
qreal minPRP
Definition graph.h:1270
qreal m_graphReciprocityDyad
Definition graph.h:1302
qreal groupCC
Definition graph.h:1262
void writeMatrixAdjacencyPlot(const QString fileName, const bool &simpler=false)
Writes a visual representation of the adjacency matrix of the graph to the specified file.
Definition graph.cpp:21198
int csRecDepth
Definition graph.h:1326
void writeClusteringCoefficient(const QString, const bool)
Graph::writeClusteringCoefficient Writes the clustering coefficients to a file.
Definition graph.cpp:12608
qreal sumEVC
Definition graph.h:1269
void writePrestigeProximity(const QString, const bool weights, const bool inverseWeights, const bool dropIsolates)
Writes the proximity prestige indices to a file.
Definition graph.cpp:10556
QString m_fileName
Definition graph.h:1328
void webCrawlTerminateThreads(QString reason)
called from Graph, when closing network, to terminate all crawler processes Also called indirectly wh...
Definition graph.cpp:3440
void centralityClosenessIR(const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false)
Computes an "improved" closeness centrality index, IRCC, which can be used on disconnected graphs....
Definition graph.cpp:8606
void signalProgressBoxCreate(const int max=0, const QString msg="Please wait")
int minNodeEVC
Definition graph.h:1287
qreal minSPC
Definition graph.h:1265
void createMatrixAdjacency(const bool dropIsolates=false, const bool considerWeights=true, const bool inverseWeights=false, const bool symmetrize=false)
Creates an adjacency matrix AM where AM(i,j)=1 if i is connected to j and AM(i,j)=0 if i not connecte...
Definition graph.cpp:21362
bool edgeSymmetric(const int &v1, const int &v2)
Returns TRUE if edge(v1, v2) is symmetric, i.e. (v1,v2) == (v2,v1).
Definition graph.cpp:2606
qreal edgeWeight(const int &v1, const int &v2) const
Returns the weight of the edge v1->v2.
Definition graph.cpp:2702
void setNodeShape(const int &v, const QString &shape, const QString &iconPath=QString())
qreal maxIndexCC
Definition graph.h:1262
qreal nomIRCC
Definition graph.h:1263
QHash< int, QSet< int > > neighboursHash
Definition graph.h:1219
int minNodeEccentricity
Definition graph.h:1283
void vertexLabelColorInit(QString color)
Graph::vertexLabelColorInit Changes the default vertex label color.
Definition graph.cpp:1985
bool calculatedAdjacencyMatrix
Definition graph.h:1316
int getSelectedVerticesMax() const
Returns max of user-selected vertices.
Definition graph.cpp:3286
qreal nomPRC
Definition graph.h:1270
bool isModified() const
Returns true of graph is modified (edges/vertices added/removed)
Definition graph.cpp:15825
H_StrToInt discreteBCs
Definition graph.h:1233
void signalProgressBoxKill(const int max=0)
void vertexLabelSet(const int &v, const QString &label)
Changes the label of a vertex v1.
Definition graph.cpp:1868
ChartType m_reportsChartType
Definition graph.h:1240
QString htmlEscaped(QString str) const
Helper method, returns a nice qstring where all html special chars are encoded.
Definition graph.cpp:23315
int classesSDC
Definition graph.h:1276
int initVertexSize
Definition graph.h:1294
QList< QString > m_relationsList
Definition graph.h:1198
int getSelectedEdgesCount() const
Returns the count of user-selected edges.
Definition graph.cpp:3309
void edgeTypeSet(const int &v1, const int &v2, const qreal &w, const int &dirType=EdgeType::Directed)
Changes the direction type of an existing edge.
Definition graph.cpp:4490
void vertexRemoveDummyNode(int)
Deletes a dummy node.
Definition graph.cpp:940
qreal m_graphDensity
Definition graph.h:1300
int m_graphReciprocityPairsReciprocated
Definition graph.h:1306
bool vertexFindByIndexScore(const int &index, const QStringList &thresholds, const bool &considerWeights, const bool &inverseWeights=false, const bool &dropIsolates=false)
Finds vertices by their index score.
Definition graph.cpp:1125
qreal meanSCC
Definition graph.h:1248
int walksBetween(int v1, int v2, int length)
Calculates and returns the number of walks of a given length between v1 and v2.
Definition graph.cpp:12142
qreal edgeExists(const int &v1, const int &v2, const bool &checkReciprocal=false)
Checks if there is an edge from v1 to v2 and returns the weight, if the edge exists.
Definition graph.cpp:2548
QList< int > m_verticesList
Definition graph.h:1204
qreal nomSBC
Definition graph.h:1264
QString initVertexLabelColor
Definition graph.h:1329
void webSpider()
A loop, that takes urls awaiting in front of the urlQueue, and signals to the MW to make the network ...
Definition graph.cpp:3593
int maxNodeSCC
Definition graph.h:1277
void writeWalksOfLengthMatrixPlainText(const QString &fn, const int &length)
Graph::writeWalksOfLengthMatrixPlainText.
Definition graph.cpp:12300
QMultiHash< int, int > influenceDomains
Definition graph.h:1213
qreal meanSBC
Definition graph.h:1250
void addRelationSymmetricStrongTies(const bool &allRelations=false)
Creates a new symmetric relation by keeping only strong-ties (mutual links) in the current relation....
Definition graph.cpp:4158
QString vertexShapeIconPath(const int &v)
Returns the IconPath of vertex v1.
Definition graph.cpp:1662
int classesEccentricity
Definition graph.h:1283
QList< int > getSelectedVertices() const
Returns a QList of user-selected vertices.
Definition graph.cpp:3255
void signalGraphModified(const bool &undirected, const int &vertices, const int &edges, const qreal &density, const bool &notSaved=true)
QPointF vertexPos(const int &v1) const
Returns the position of the given vertex.
Definition graph.cpp:1495
qreal varianceSBC
Definition graph.h:1250
int classesEC
Definition graph.h:1282
void statusMessage(const QString &message)
void createMatrixSimilarityPearson(Matrix &AM, Matrix &PCC, const QString &varLocation="Rows", const bool &diagonal=false)
The Pearson product-moment correlation coefficient (PPMCC, PCC or Pearson's r) is a measure of the li...
Definition graph.cpp:15004
void createMatrixSimilarityMatching(Matrix &AM, Matrix &SEM, const int &measure=METRIC_SIMPLE_MATCHING, const QString &varLocation="Rows", const bool &diagonal=false, const bool &considerWeights=true)
Calls Matrix:similarityMatrix to compute the similarity matrix SCM of the variables (rows,...
Definition graph.cpp:14736
void setModStatus(const int &graphNewStatus, const bool &signalMW=true)
Sets the graph modification status.
Definition graph.cpp:15709
QString m_graphName
Definition graph.h:1328
int maxNodeSBC
Definition graph.h:1279
qreal graphDensity()
Gets the graph density (if computed) or computes it again.
Definition graph.cpp:3324
void vertexShapeSet(const int &v, const QString &shape, const QString &iconPath=QString())
Changes the shape and iconPath of vertex v1, or all vertices if v1=-1.
Definition graph.cpp:1617
Matrix XRM
Definition graph.h:1228
int initVertexLabelDistance
Definition graph.h:1296
void vertexSizeInit(const int)
Sets the initial vertex size.
Definition graph.cpp:1540
void edgeLabelsVisibilitySet(const bool &toggle)
Toggles the visibility of edge labels.
Definition graph.cpp:2860
int maxNodeSPC
Definition graph.h:1280
bool order
Definition graph.h:1297
QList< int > m_verticesSelected
Definition graph.h:1207
qreal denomEVC
Definition graph.h:1269
bool initEdgeWeightNumbers
Definition graph.h:1298
void setNodePos(const int &, const qreal &, const qreal &)
void edgeWeightSet(const int &v1, const int &v2, const qreal &w, const bool &undirected=false)
Changes the weight of the edge from vertex v1 to v2 (and optionally of the reverse edge)
Definition graph.cpp:2679
qreal maxSBC
Definition graph.h:1264
qreal maxIndexBC
Definition graph.h:1264
bool calculatedGraphSymmetry
Definition graph.h:1322
void signalGraphLoaded(const int &fileType, const QString &fileName=QString(), const QString &netName=QString(), const int &totalNodes=0, const int &totalLinks=0, const qreal &density=0, const qint64 &elapsedTime=0, const QString &message=QString())
H_StrToInt discreteEVCs
Definition graph.h:1235
int m_totalEdges
Definition graph.h:1294
void signalDrawNode(const QPointF &p, const int &num, const int &size, const QString &nodeShape, const QString &nodeIconPath, const QString &nodeColor, const QString &numberColor, const int &numSize, const int &numDistance, const QString &label, const QString &labelColor, const int &labelSize, const int &labelDistance)
void writeMatrixSimilarityMatchingPlain(const QString fileName, const int &measure=METRIC_SIMPLE_MATCHING, const QString &matrix="adjacency", const QString &varLocation="rows", const bool &diagonal=false, const bool &considerWeights=true)
Writes similarity matrix based on a matching measure to given file.
Definition graph.cpp:14289
void randomNetLatticeCreate(const int &N, const int &length, const int &dimension, const int &neighborhoodLength, const QString &mode, const bool &circular=false)
Creates a lattice network.
Definition graph.cpp:11936
qreal varianceSPC
Definition graph.h:1253
void writeClusteringHierarchicalResultsToStream(QTextStream &outText, const int N, const bool &dendrogram=false)
Writes Hierarchical Clustering results to given output stream Before running this methos,...
Definition graph.cpp:13712
QMap< QString, V_int > m_clustersByName
Definition graph.h:1224
void graphMatrixDistanceGeodesicCreate(const bool &considerWeights=false, const bool &inverseWeights=true, const bool &dropIsolates=false)
Creates the matrix DM of geodesic distances between vertices.
Definition graph.cpp:4826
void prestigeDegree(const bool &considerWeights, const bool &dropIsolates=false)
Computes the Degree Prestige (in-degree) of each vertex - diagonal included Also the mean value and t...
Definition graph.cpp:9966
qreal varianceEC
Definition graph.h:1252
void writeMatrix(const QString &fileName, const int &matrix=MATRIX_ADJACENCY, const bool &considerWeights=true, const bool &inverseWeights=false, const bool &dropIsolates=false, const QString &varLocation="Rows", const bool &simpler=false)
Definition graph.cpp:20527
QList< int > vertexinfluenceDomain(int v2)
Returns the influence domain of vertex v1, namely the set of nodes who can reach v1 The Influence Dom...
Definition graph.cpp:12514
bool isFileFormatExportSupported(const int &fileFormat) const
Returns true if the fileFormat is supported for saving.
Definition graph.cpp:15693
qreal nomEC
Definition graph.h:1267
void vertexLabelSizeSet(const int &v, const int &labelSize)
Changes the label size of vertex v1 or all vertices if v1=0.
Definition graph.cpp:1908
qreal minEC
Definition graph.h:1267
QString htmlHead
Definition graph.h:1331
~Graph()
Destroys the Graph object.
Definition graph.cpp:269
qreal minSCC
Definition graph.h:1262
void writeMatrixDissimilarities(const QString fileName, const QString &metricStr, const QString &varLocation, const bool &diagonal, const bool &considerWeights)
Writes dissimilarity matrix based on a metric/measure to given html file.
Definition graph.cpp:14394
int minNodeIRCC
Definition graph.h:1278
qreal sumIRCC
Definition graph.h:1263
void vertexLabelDistanceSet(const int &v, const int &newDistance)
Changes the distance.of vertex v label from the vertex.
Definition graph.cpp:1997
int graphDiameter(const bool considerWeights, const bool inverseWeights)
Returns the diameter of the graph, aka the largest geodesic distance between any two vertices.
Definition graph.cpp:4643
H_StrToInt discreteCCs
Definition graph.h:1233
void writeReachabilityMatrixPlainText(const QString &fn, const bool &dropIsolates=false)
Definition graph.cpp:12569
void dijkstra(const int &s, const int &si, const bool &computeCentralities=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
Definition graph.cpp:5855
qreal numberOfTriples(int v1)
Definition graph.cpp:15024
void writeEccentricity(const QString fileName, const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false)
Writes the Eccentricity report to file.
Definition graph.cpp:6287
int vertexEdgesInbound(int i)
Returns the number of inbound edges (arcs) to vertex v1.
Definition graph.cpp:2663
qreal denomSBC
Definition graph.h:1264
void setNodeNumberColor(const int &v, const QString &color)
qreal maxEVC
Definition graph.h:1269
bool saveToDotFormat(QString fileName)
TODO Saves the active graph to a UCINET-formatted file.
Definition graph.cpp:16266
void prestigeProximity(const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false)
Computes Proximity Prestige of each vertex Also the mean value and the variance of it....
Definition graph.cpp:10425
Matrix AM
Definition graph.h:1227
void signalWebCrawlParse(QNetworkReply *reply)
void randomNetErdosCreate(const int &N, const QString &model, const int &m, const qreal &p, const QString &mode, const bool &diag)
Creates an erdos-renyi random network according to the given model.
Definition graph.cpp:11283
int m_graphModStatus
Definition graph.h:1292
void randomizeThings()
Adds a little universal randomness :)
Definition graph.cpp:11263
bool calculatedGraphWeighted
Definition graph.h:1323
int relationCurrent()
Gets the current relation number.
Definition graph.cpp:660
qreal minIRCC
Definition graph.h:1263
void setDirected(const bool &toggle=true, const bool &signalMW=true)
Toggles the graph directed or undirected.
Definition graph.cpp:4382
void writeCentralityPower(const QString, const bool weigths, const bool inverseWeights, const bool dropIsolates)
Writes Power Centralities to a file.
Definition graph.cpp:9689
qreal maxSSC
Definition graph.h:1266
qreal maxSDP
Definition graph.h:1260
bool isUndirected()
Returns true if graph is undirected.
Definition graph.cpp:4474
qreal groupEVC
Definition graph.h:1269
void graphDistancesGeodesic(const bool &computeCentralities=false, const bool &considerWeights=false, const bool &inverseWeights=true, const bool &dropIsolates=false)
Computes the geodesic distances between all vertices: In the process, it also computes many other cen...
Definition graph.cpp:4935
void setSymmetric()
Transforms the graph to symmetric (all edges reciprocal)
Definition graph.cpp:4112
int classesSDP
Definition graph.h:1275
qreal varianceSCC
Definition graph.h:1248
int m_fieldWidth
Definition graph.h:1242
Matrix SIGMA
Definition graph.h:1227
int maxNodePP
Definition graph.h:1286
void vertexLabelSizeInit(int newSize)
Graph::vertexLabelSizeInit Changes the default size of vertex labels.
Definition graph.cpp:1897
qreal varianceIC
Definition graph.h:1254
qreal edgeExistsVirtual(const int &v1, const int &v2)
Checks if there is an edge from v1 to v2, even weight = 0 and returns the weight, if the edge exists ...
Definition graph.cpp:2578
int m_crawler_max_urls
Definition graph.h:1194
void layoutForceDirectedFruchtermanReingold(const int maxIterations)
Embeds a Force Directed Placement layout according to the Fruchterman-Reingold model....
Definition graph.cpp:22325
qreal sumSBC
Definition graph.h:1264
bool calculatedDP
Definition graph.h:1319
void setReportsDataDir(const QString &reportsDir)
Sets the directory where reports are saved This is used when exporting prominence distribution images...
Definition graph.cpp:16665
H_Int vpos
Definition graph.h:1136
int verticesWithInboundEdges()
Returns the sum of vertices having edgesInbound.
Definition graph.cpp:3418
void randomNetSmallWorldCreate(const int &N, const int &degree, const double &beta, const QString &mode)
Creates a small world random network.
Definition graph.cpp:11605
Matrix WM
Definition graph.h:1227
bool isEmpty() const
Returns true if the current graph has no vertices at all.
Definition graph.cpp:3207
QSet< int > vertexNeighborhoodSet(const int &v1)
Returns the set of all vertices mutually connected to vertex v1 in the current relation.
Definition graph.cpp:2906
qreal graphDistanceGeodesicAverage(const bool considerWeights, const bool inverseWeights, const bool dropIsolates)
Returns the average distance of the graph.
Definition graph.cpp:4659
void layoutForceDirected_FR_moveNodes(const qreal &temperature)
Graph::layoutForceDirected_FR_moveNodes.
Definition graph.cpp:23058
void setReportsChartType(const int &type)
Sets the chart type in reports.
Definition graph.cpp:16694
qreal varianceEVC
Definition graph.h:1255
qreal canvasMinDimension() const
Gets the min dimensions of the canvas.
Definition graph.cpp:477
bool m_graphIsDirected
Definition graph.h:1324
void graphWalksMatrixCreate(const int &N=0, const int &length=0, const bool &updateProgress=false)
Computes either the "Walks of given length" or the "Total Walks" matrix. If length>0,...
Definition graph.cpp:12162
bool calculatedDistances
Definition graph.h:1316
int verticesWithOutboundEdges()
Returns the sum of vertices having edgesOutbound.
Definition graph.cpp:3409
QList< int > verticesList()
Returns a list of all vertices numbers inside the graph.
Definition graph.cpp:2994
void setReportsLabelLength(const int &length)
Sets the length of labels in reports.
Definition graph.cpp:16685
void setWeighted(const bool &toggle=true)
Sets the graph to be weighted ( valued edges ).
Definition graph.cpp:3401
Matrix sumM
Definition graph.h:1227
void vertexLabelDistanceAllSet(const int &newDistance)
Changes the distance of all vertex labels from their vertices.
Definition graph.cpp:2009
void graphClickedEmptySpace(const QPointF &p)
Resets the clicked edge and node.
Definition graph.cpp:3220
void writeMatrixShortestPathsPlainText(const QString &fn, const bool &considerWeights, const bool &inverseWeights)
Writes the shortest paths matrix to a file Each SIGMA(i,j) element is the number of shortest paths (g...
Definition graph.cpp:6249
qreal maxSDC
Definition graph.h:1261
bool writeClusteringHierarchical(const QString &fileName, const QString &varLocation, const QString &matrix="Adjacency", const QString &metric="Manhattan", const QString &method="Complete", const bool &diagonal=false, const bool &dendrogram=false, const bool &considerWeights=true, const bool &inverseWeights=false, const bool &dropIsolates=false)
Writes Hierarchical Clustering Analysis to a given file.
Definition graph.cpp:13535
double canvasRandomX() const
Returns a random x-coordinate adjusted to be visible inside the canvas usable area.
Definition graph.cpp:503
void loadFile(const QString fileName, const QString codecName, const int format, const QString delimiter=QString(), const int sm_two_mode=1, const bool sm_has_labels=false)
Loads a graph from a given file.
Definition graph.cpp:15885
bool isLoaded() const
Returns true if a graph has been loaded from a file.
Definition graph.cpp:15841
void vertexNumberDistanceSet(const int &v, const int &newDistance)
Changes the distance.of vertex v number from the vertex.
Definition graph.cpp:1825
QString initEdgeColor
Definition graph.h:1328
qreal m_graphGeodesicsCount
Definition graph.h:1299
QList< int > triadTypeFreqs
Definition graph.h:1202
bool isWeighted()
Returns true if the graph is weighted (valued), i.e. if any e in |E| has value not 0 or 1 Complexity:...
Definition graph.cpp:3355
qreal groupSBC
Definition graph.h:1264
void edgeOutboundStatusSet(const int &source, const int &target, const bool &toggle=false)
Toggles the status of outbound edge source -> target at source vertex.
Definition graph.cpp:2228
void vertexRemove(const int &v1)
Removes the vertex v1 from the graph First, it removes all edges to doomed from other vertices Then i...
Definition graph.cpp:1350
int graphMetricStrToType(const QString &metricStr) const
Helper method, return the identifier of a metric.
Definition graph.cpp:23243
Matrix invAM
Definition graph.h:1227
QString edgeLabel(const int &v1, const int &v2) const
Returns the label of edge v1->v2.
Definition graph.cpp:2851
void signalNodeClickedInfo(const int &number=0, const QPointF &p=QPointF(), const QString &label=QString(), const int &inDegree=0, const int &outDegree=0)
bool saveToAdjacencyFormat(const QString &fileName, const bool &saveEdgeWeights=true)
Saves the active graph to an adjacency-formatted file.
Definition graph.cpp:16229
qreal graphReciprocity()
Gets the arc reciprocity of the graph.
Definition graph.cpp:3657
void writeMatrixSimilarityMatching(const QString fileName, const QString &measure="Simple", const QString &matrix="adjacency", const QString &varLocation="rows", const bool &diagonal=false, const bool &considerWeights=true)
Writes similarity matrix based on a matching measure to given html file.
Definition graph.cpp:14561
VList m_graph
Definition graph.h:1186
void centralityEigenvector(const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
Computes Eigenvector centrality.
Definition graph.cpp:7116
qreal meanSPC
Definition graph.h:1253
void vertexCreateAtPosRandom(const bool &signalMW=false)
Creates a new randomly positioned vertex with default values.
Definition graph.cpp:887
qreal m_graphReciprocityArc
Definition graph.h:1302
void setNodeLabel(const int &v, const QString &label)
void writeCentralityDegree(const QString, const bool weights, const bool dropIsolates)
Writes the Degree Centrality to a file.
Definition graph.cpp:8029
void BFS(const int &s, const int &si, const bool &computeCentralities=false, const bool &dropIsolates=false)
Definition graph.cpp:5682
void writeMatrixDegreeText(const QString &filename)
Computes the Degree matrix of the graph and writes it to given file.
Definition graph.cpp:21563
void layoutVertexSizeByIndegree()
Convenience method Changes the size of all nodes to be proportional to their InDegree (Degree Prestig...
Definition graph.cpp:21791
qreal m_graphSumDistance
Definition graph.h:1301
void setEdgeColor(const int &v1, const int &v2, const QString &color)
void prominenceDistributionBars(const H_StrToInt &discreteClasses, const QString &name, const QString &distImageFileName)
Computes the distribution of a centrality index scores. The distribution data are returned as QBarSer...
Definition graph.cpp:7863
qreal d_factor
Definition graph.h:1273
qreal layoutForceDirected_F_att(const QString model, const qreal &dist, const qreal &optimalDistance)
Definition graph.cpp:22880
QString vertexShape(const int &v)
Returns the shape of this vertex.
Definition graph.cpp:1652
H_StrToInt discreteECs
Definition graph.h:1234
int inboundEdgesVert
Definition graph.h:1311
void signalDatasetDescription(QString)
qreal maxIndexSC
Definition graph.h:1266
QSet< int > verticesSet()
Returns a QSet of all vertices numbers inside the graph.
Definition graph.cpp:3016
qreal computeOptimalDistance(const int &V)
Computes Optimal Distance. Used in Spring Embedder and FR algorithms.
Definition graph.cpp:22866
int minNodeSDC
Definition graph.h:1276
void writeWalksTotalMatrixPlainText(const QString &fn)
Graph::writeWalksTotalMatrixPlainText Writes the total number of walks matrix.
Definition graph.cpp:12265
QString initVertexIconPath
Definition graph.h:1330
H_StrToInt discreteSCs
Definition graph.h:1233
void relationSet(int relNum=RAND_MAX, const bool &updateUI=true)
Changes the current relation, and optionally emits signals to MW/GW (default: true)
Definition graph.cpp:531
qreal meanSSC
Definition graph.h:1251
int m_graphReciprocityTiesReciprocated
Definition graph.h:1303
void vertexColorSet(const int &v, const QString &color)
Changes the color of vertex v1.
Definition graph.cpp:1675
qreal minCLC
Definition graph.h:1273
void setReportsRealNumberPrecision(const int &precision)
Sets the precision (number of fraction digits) the app will use when writing real numbers in reports.
Definition graph.cpp:16676
void vertexNumberColorInit(const QString &color)
Changes the initial color of the vertex numbers.
Definition graph.cpp:1730
void edgeCreateWebCrawler(const int &source, const int &target)
Called from WebCrawler when it finds an new link Calls edgeCreate() method with initEdgeColor.
Definition graph.cpp:2167
void vertexClickedSet(const int &v, const QPointF &p)
Sets the clicked vertex.
Definition graph.cpp:1509
void edgeFilterByWeight(const qreal, const bool)
Filters (disables) edges according the specified threshold weight.
Definition graph.cpp:2320
qreal nomEVC
Definition graph.h:1269
qreal denomIRCC
Definition graph.h:1263
double canvasRandomY() const
Returns a random y-coordinate adjusted to be visible inside the canvas usable area.
Definition graph.cpp:512
QList< int > verticesListIsolated()
Returns a list of all isolated vertices inside the graph.
Definition graph.cpp:2962
void saveToFile(const QString &fileName, const int &fileType, const bool &saveEdgeWeights=true, const bool &saveZeroWeightEdges=false)
Saves the current graph to a file.
Definition graph.cpp:16075
QString graphClusteringMethodTypeToString(const int &methodType) const
Helper method, return the human readable name of clustering method type.
Definition graph.cpp:23272
qreal layoutForceDirected_FR_temperature(const int iteration) const
Reduces the temperature as the layout approaches a better configuration.
Definition graph.cpp:22830
int m_crawler_visited_urls
Definition graph.h:1195
int classesIC
Definition graph.h:1284
ModStatus
Definition graph.h:374
@ EdgeMetadata
Definition graph.h:379
@ SavedUnchanged
Definition graph.h:376
@ MinorOptions
Definition graph.h:377
@ VertexPositions
Definition graph.h:380
@ VertexEdgeCount
Definition graph.h:384
@ VertexCount
Definition graph.h:382
@ NewNet
Definition graph.h:375
@ EdgeCount
Definition graph.h:383
@ VertexMetadata
Definition graph.h:378
@ MajorChanges
Definition graph.h:381
bool calculatedIRCC
Definition graph.h:1320
bool m_graphHasVertexCustomIcons
Definition graph.h:1309
stack< int > Stack
Definition graph.h:1230
void vertexNumberSizeInit(const int &size)
Changes the initial size of vertex numbers.
Definition graph.cpp:1771
bool graphHasVertexCustomIcons() const
Definition graph.h:519
void layoutRandom()
Repositions all nodes on random positions Emits setNodePos(i, x,y) to tell GW that the node item shou...
Definition graph.cpp:21620
H_StrToInt discreteICs
Definition graph.h:1235
qreal meanSDC
Definition graph.h:1247
void addGuideCircle(const double &, const double &, const double &)
QString initVertexColor
Definition graph.h:1328
QDateTime actualDateTime
Definition graph.h:1333
bool calculatedCentralities
Definition graph.h:1316
void signalGraphSavedStatus(const int &status)
qreal maxCLC
Definition graph.h:1273
qreal graphDistanceEuclidean(const QPointF &a, const QPointF &b)
Computes the euclideian distance between QPointF a and b.
Definition graph.cpp:22987
void writeTriadCensus(const QString, const bool)
Definition graph.cpp:12807
bool m_graphIsConnected
Definition graph.h:1324
bool calculatedTriad
Definition graph.h:1321
qreal groupPP
Definition graph.h:1271
void writeCentralityBetweenness(const QString, const bool weights, const bool inverseWeights, const bool dropIsolates)
Writes Betweenness centralities to file.
Definition graph.cpp:8958
Clustering
Definition graph.h:389
@ Single_Linkage
Definition graph.h:390
@ Complete_Linkage
Definition graph.h:391
@ Average_Linkage
Definition graph.h:392
bool graphTriadCensus()
Graph::graphTriadCensus Conducts a triad census and updates QList::triadTypeFreqs,...
Definition graph.cpp:15278
void edgeRemove(const int &v1, const int &v2, const bool &removeReverse=false)
Removes the directed arc v1->v2 or, if the graph is undirected, the edge v1 <->v2.
Definition graph.cpp:2261
QString edgeColor(const int &v1, const int &v2)
Returns the color of the directed edge v1->v2.
Definition graph.cpp:2821
int classesSBC
Definition graph.h:1279
void graphDichotomization(const qreal threshold)
Creates a new binary relation in a valued network using edge dichotomization according to the thresho...
Definition graph.cpp:4307
Matrix DM
Definition graph.h:1227
bool isConnected()
Checks if the graph is connected, in the sense of a topological space, i.e., there is a path from any...
Definition graph.cpp:4706
void relationCurrentRename(const QString &newName)
Overload. Renames current relation to newName, without emitting any signal to MW.
Definition graph.cpp:721
qreal groupSPC
Definition graph.h:1265
int maxNodeEccentricity
Definition graph.h:1283
int m_fileFormat
Definition graph.h:1242
qreal varianceSSC
Definition graph.h:1251
qreal maxSCC
Definition graph.h:1262
void edgeRemoveSelected(SelectedEdge &selectedEdge, const bool &removeReverse)
Removes a SelectedEdge.
Definition graph.cpp:2291
void startWebCrawler(const QUrl &startUrl, const QStringList &urlPatternsIncluded, const QStringList &urlPatternsExcluded, const QStringList &linkClasses, const int &maxNodes, const int &maxLinksPerPage, const bool &intLinks, const bool &childLinks, const bool &parentLinks, const bool &selfLinks, const bool &extLinksIncluded, const bool &extLinksCrawl, const bool &socialLinks, const bool &delayedRequests)
Creates a new WebCrawler, that will parse the downloaded HTML code of each webpage we download....
Definition graph.cpp:3480
int outboundEdgesVert
Definition graph.h:1311
QColor vertexColor(const int &v) const
Graph::vertexColor.
Definition graph.cpp:1707
int graphClusteringMethodStrToType(const QString &method) const
Helper method, return clustering method type from the human readable name of it.
Definition graph.cpp:23296
qreal groupEC
Definition graph.h:1267
int minNodeSSC
Definition graph.h:1281
void vertexSizeSet(const int &v, const int &newsize)
Changes the size of a vertex v or all vertices if v=0.
Definition graph.cpp:1554
int classesPRP
Definition graph.h:1285
int minNodeDP
Definition graph.h:1275
bool vertexFindByNumber(const QStringList &numList)
Finds vertices in strList by their number.
Definition graph.cpp:1029
void signalNodesFound(const QList< int > foundList)
bool initEdgeLabels
Definition graph.h:1298
int getGeodesicsCount()
Returns the number of geodesics (shortest-paths) in the graph.
Definition graph.cpp:4685
int classesPP
Definition graph.h:1286
qreal sumSPC
Definition graph.h:1265
QString htmlHeadLight
Definition graph.h:1331
void centralityDegree(const bool &considerWeights=true, const bool &dropIsolates=false)
Calculates the degree (outDegree) centrality of each vertex - diagonal included.
Definition graph.cpp:7246
void layoutForceDirectedSpringEmbedder(const int maxIterations)
Embeds a Force Directed Placement layout according to the initial Spring Embedder model proposed by E...
Definition graph.cpp:22181
qreal meanSDP
Definition graph.h:1256
bool vertexIsolated(const int &v1) const
Checks if vertex is isolated.
Definition graph.cpp:1459
bool calculatedVertices
Definition graph.h:1315
H_StrToInt discreteIRCCs
Definition graph.h:1234
bool calculatedPP
Definition graph.h:1319
void signalProgressBoxUpdate(const int &count=0)
void setNodeColor(const int &v, const QString &color)
int vertexDegreeOut(int)
Returns the outDegree (sum of outbound edge weights) of vertex v1.
Definition graph.cpp:2871
void verticesCreateSubgraph(QList< int > vList, const int &type=SUBGRAPH_CLIQUE, const int &center=0)
Creates a subgraph (clique, star, cycle, line) with vertices in vList Iff vList is empty,...
Definition graph.cpp:3041
void signalPromininenceDistributionChartUpdate(QAbstractSeries *series, QAbstractAxis *axisX=Q_NULLPTR, const qreal &min=0, const qreal &max=0, QAbstractAxis *axisY=Q_NULLPTR, const qreal &minF=0, const qreal &maxF=0)
bool calculatedVerticesSet
Definition graph.h:1315
void relationsClear()
Clears relationships in this Graph.
Definition graph.cpp:742
void writeCentralityInformation(const QString, const bool weigths, const bool inverseWeights)
Writes the information centralities to file.
Definition graph.cpp:6594
void writeReciprocity(const QString fileName, const bool considerWeights=false)
Writes reciprocity report to filename.
Definition graph.cpp:3797
qreal meanPP
Definition graph.h:1257
void vertexNumberDistanceInit(const int &distance)
Changes the initial distance of vertex numbers.
Definition graph.cpp:1815
int minNodeCLC
Definition graph.h:1274
int vertexNumberMax()
Returns the number of the last vertex in the graph.
Definition graph.cpp:953
qreal meanPRP
Definition graph.h:1258
qreal nomIC
Definition graph.h:1268
double canvasMaxRadius() const
Gets the max radius of the canvas.
Definition graph.cpp:469
H_StrToInt discretePCs
Definition graph.h:1235
double canvasVisibleX(const double &x) const
Checks if x is visible inside the canvas usable area and if not returns an adjusted x-coordinate.
Definition graph.cpp:486
int m_graphReciprocityPairsTotal
Definition graph.h:1307
bool calculatedEVC
Definition graph.h:1318
void graphMatrixShortestPathsCreate(const bool &considerWeights=false, const bool &inverseWeights=true, const bool &dropIsolates=false)
Creates the matrix SIGMA of shortest paths (geodesics) between vertices Each SIGMA(i,...
Definition graph.cpp:4735
void edgeInboundStatusSet(const int &target, const int &source, const bool &toggle=false)
Toggles the status of inbound edge target <- source at target vertex.
Definition graph.cpp:2242
void edgeRemoveSelectedAll()
Removes all selected edges.
Definition graph.cpp:2301
void vertexLabelsVisibilitySet(bool toggle)
QString htmlEnd
Definition graph.h:1331
qreal maxIC
Definition graph.h:1268
void signalRelationRenamedToMW(const QString &newRelName)
int maxNodePRP
Definition graph.h:1285
void relationNext()
Changes graph to next relation.
Definition graph.cpp:616
int maxNodeIC
Definition graph.h:1284
int maxNodeIRCC
Definition graph.h:1278
qreal meanEVC
Definition graph.h:1255
void relationAdd(const QString &relName, const bool &changeRelation=false)
Adds a new relation to the graph.
Definition graph.cpp:635
int classesIRCC
Definition graph.h:1278
void setFileFormat(const int &fileFormat)
Definition graph.cpp:15683
void writeDataSetToFile(const QString dir, const QString)
Writes a "famous" dataset to the given file Datasets are hardcoded! They are exported in the given fi...
Definition graph.cpp:16719
bool calculatedEdges
Definition graph.h:1314
bool calculatedDC
Definition graph.h:1319
int maxNodeCLC
Definition graph.h:1274
void vertexNumberSizeSet(const int &v, const int &newsize)
Changes the size of vertex v number.
Definition graph.cpp:1782
void layoutCircular(const double &x0, const double &y0, const double &newRadius, const bool &guides=false)
Repositions all nodes on the periphery of a circle with given radius.
Definition graph.cpp:21725
qreal groupSC
Definition graph.h:1266
qreal sumSDC
Definition graph.h:1261
QList< qreal > m_clusteringLevel
Definition graph.h:1221
void setSelectionChanged(const QList< int > selectedVertices, const QList< SelectedEdge > selectedEdges)
Sets the user-selected vertices and edges.
Definition graph.cpp:3238
bool calculatedIsolates
Definition graph.h:1317
int minNodeSPC
Definition graph.h:1280
qreal minSDC
Definition graph.h:1261
int vertexNumberMin()
Returns the number of the first vertex in the graph.
Definition graph.cpp:966
void clear(const QString &reason="")
Clears all vertices.
Definition graph.cpp:279
void centralityInformation(const bool considerWeights=false, const bool inverseWeights=false)
Computes the Information centrality of each vertex - diagonal included Note that there is no known ge...
Definition graph.cpp:6474
qreal nomSCC
Definition graph.h:1262
void vertexIsolatedAllToggle(const bool &toggle)
Toggles the status of all isolated vertices (thos without links)
Definition graph.cpp:1432
void writeMatrixSimilarityPearsonPlainText(const QString fileName, const bool considerWeights, const QString &matrix="adjacency", const QString &varLocation="rows", const bool &diagonal=false)
Calls Graph::graphSimilariyPearsonCorrelationCoefficients() and writes Pearson Correlation Coefficien...
Definition graph.cpp:14908
void layoutByProminenceIndex(int prominenceIndex, int layoutType, const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
Applies a layout according to each actor's prominence index score. The layout type can be radial (0),...
Definition graph.cpp:21813
qreal sumDP
Definition graph.h:1260
void edgeColorSet(const int &v1, const int &v2, const QString &color)
Changes the color of edge v1->v2.
Definition graph.cpp:2798
bool edgeCreate(const int &v1, const int &v2, const qreal &weight, const QString &color, const int &type=0, const bool &drawArrows=true, const bool &bezier=false, const QString &label=QString(), const bool &signalMW=true)
Checks a) if edge exists and b) if the reverse edge exists Calls edgeAdd to add the new edge to the G...
Definition graph.cpp:2057
void writeMatrixDistancesPlainText(const QString &fn, const bool &considerWeights, const bool &inverseWeights, const bool &dropIsolates)
Writes the matrix of distances to a file.
Definition graph.cpp:6210
void setNodeNumberSize(const int &v, const int &size)
void edgeFilterByRelation(int relation, bool status)
Toggles (enables or disables) all edges of the given relation.
Definition graph.cpp:2452
qreal sizeOfComponent
Definition graph.h:1288
qreal averageCLC
Definition graph.h:1273
QString getName() const
Returns the name of the current graph.
Definition graph.cpp:15623
int graphCliquesOfSize(const int &size)
Graph::graphCliquesOfSize Returns the number of maximal cliques of a given size.
Definition graph.cpp:13516
qreal groupDC
Definition graph.h:1261
bool isDirected()
Returns true if graph is directed.
Definition graph.cpp:4461
qreal minPP
Definition graph.h:1271
qreal varianceCLC
Definition graph.h:1273
void randomNetScaleFreeCreate(const int &N, const int &power, const int &m0, const int &m, const qreal &alpha, const QString &mode)
Creates a scale-free random-network network.
Definition graph.cpp:11426
Parser * file_parser
Definition graph.h:1188
void writeCentralityCloseness(const QString, const bool weights, const bool inverseWeights, const bool dropIsolates)
Writes the closeness centralities to a file.
Definition graph.cpp:8312
QList< int > vertexinfluenceRange(int v1)
Returns the influence range of vertex v1, namely the set of nodes who are reachable from v1 (See Wass...
Definition graph.cpp:12456
Definition matrix.h:115
Definition global.h:150
Defines a class for network file loading and parsing.
Definition parser.h:68
The WebCrawler class Parses HTML code it receives, locates urls inside it and puts them into a url qu...
Definition webcrawler.h:34
NetworkRequestType
Definition global.h:97
static const int SUBGRAPH_CLIQUE
Definition global.h:114
static const int MATRIX_ADJACENCY
Definition global.h:119
@ Directed
Definition global.h:68
ChartType
Definition global.h:90
QPair< int, int > SelectedEdge
Definition global.h:147
#define SOCNETV_USE_NAMESPACE
Definition global.h:11
QHash< int, int > H_Int
Definition graph.h:66
QList< QString > V_str
Definition graph.h:74
QList< int > L_int
Definition graph.h:72
QMultiHash< int, pair_i_fb > H_edges
Definition graph.h:70
QHash< QString, bool > H_StrToBool
Definition graph.h:71
QHash< qreal, int > H_f_i
Definition graph.h:67
QList< GraphVertex * > VList
Definition graph.h:64
QList< int > V_int
Definition graph.h:73
QPair< qreal, bool > pair_f_b
Definition graph.h:68
QHash< QString, int > H_StrToInt
Definition graph.h:65
QPair< int, pair_f_b > pair_i_fb
Definition graph.h:69
Declares the GraphicsWidget class for handling the main visualization widget in the network graph int...
Declares the GraphVertex class for representing and managing vertices in the network graph structure.
Declares the Matrix class for handling adjacency and sociomatrix data structures in network analysis.
static const int METRIC_SIMPLE_MATCHING
Definition matrix.h:38
Declares the Parser class for reading and interpreting various network data formats,...