-
Notifications
You must be signed in to change notification settings - Fork 5
/
wCommunitythread.cpp
80 lines (67 loc) · 2.56 KB
/
wCommunitythread.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//##########################################################################
//# This software is part of the Treescaper i
//# -- Version 0.1
//# Copyright (C) 2010 Wen Huang
//#
//# This program is free software; you can redistribute it and/or
//# modify it under the terms of the GNU General Public License
//# as published by the Free Software Foundation; either version 2
//# of the License, or (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//# http://www.gnu.org/copyleft/gpl.html
//##########################################################################
#ifndef WCOMMUNITYTHREAD_CPP
#define WCOMMUNITYTHREAD_CPP
#include "treescaper.h"
#include "wCommunitythread.h"
Communitythread::Communitythread(QObject *parent)
: QThread(parent)
{
// stopped = false;
};
Communitythread::~Communitythread()
{
};
void Communitythread::initialization(Trees *TreesData, String in_str_matrix, int in_modelType, Array<double> in_param1, Array<double> in_param2,
string in_highfreq, string in_lowfreq, int in_buttonflag, bool in_isauto)
{
lptrees = TreesData;
str_matrix = in_str_matrix;
modelType = in_modelType;
param1 = in_param1;
param2 = in_param2;
highfreq = in_highfreq;
lowfreq = in_lowfreq;
buttonflag = in_buttonflag;
isauto = in_isauto;
};
void Communitythread::run()
{
emit sendbuttonCommunityPlotenable(0);
string modelName;
if(modelType == 1)
modelName = "No Null Model";
else if(modelType == 2)
modelName = "Erdos-Renyi Null Model";
else if(modelType == 3)
modelName = "Configuration Null Model";
else if(modelType == 4)
modelName = "Constant Potts Model";
if(isauto)
if(lptrees->compute_community_automatically(str_matrix, modelType, highfreq, lowfreq))
std::cout << "Successfully detected communities of " << str_matrix << " by the " << modelName << "!\n\n";
if(!isauto)
if(lptrees->compute_community_manually(str_matrix, modelType, param1, param2, highfreq, lowfreq))
std::cout << "Successfully detected communities of " << str_matrix << " by the " << modelName << "!\n\n";
emit sendbuttonCommunityPlotenable(buttonflag);
}
//void Communitythread::stop()
//{
// stopped = true;
// std::cout << "Community detection was stopped!\n\n";
//}
#endif // WNLDRTHREAD_CPP