-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.R
More file actions
81 lines (71 loc) · 3.79 KB
/
main.R
File metadata and controls
81 lines (71 loc) · 3.79 KB
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
81
# Main program allowing to launch the whole process
# on a single network. The parameters must be set
# accordingly.
#
# Version: 1
# Author: Vincent Labatut 06/2014
#
# setwd("~/eclipse/workspaces/Networks/Orleans/")
# setwd("D:/Eclipse/workspaces/Networks/Orleans/")
# source("main.R")
###############################################################################
library("igraph")
source("ClusterAnalysis/cluster-analysis.R")
source("CommunityDetection/community-detection.R")
source("Misc/ecdflt.R")
source("Misc/generate-data.R")
source("PostProcessing/post-processing.R")
source("RoleMeasures/role-measures.R")
source("SocapIndices/socap-indices.R")
###############################################################################
# Parameters
###############################################################################
# whether or not to generate data (for testing purposes)
gen.data <- TRUE
# community detection algorithm
comdet.algo <- "LV" #TODO LV, LV-dir, OSLOM-undir-p, OSLOM-dir-p, OSLOM-undir-o, OSLOM-dir-o
# role measures
role.meas <- "GA-dir" #TODO GA, GA-dir, DLP-p, DLP-o
# clustering algorithm
clust.algo <- "kmeans" #TODO kmeans, pkmeans, xmeans, gkmeans, fgkmeans, gpkmeans, fgpkmeans
# data folder (all out and in files must be in this folder)
net.folder <- "data/test/" #TODO put the network folder
###############################################################################
# 0. Generate data
###############################################################################
if(gen.data)
{ cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Generate data\n",sep="")
n <- 1000
n.clust <- 7
n.com <- 36
directed <- TRUE
generate.data(folder.data=net.folder, role.meas, n, directed, n.clust, clust.algo, n.com, comdet.algo)
}
###############################################################################
# 1. Processing social capitalism indices
###############################################################################
#cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Process social capitalism indices\n",sep="")
process.socap.indices(folder.data=net.folder, role.meas, force=TRUE)
###############################################################################
# 2. Detecting communities
###############################################################################
#cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Detect communities\n",sep="")
detect.communities(folder.data=net.folder, comdet.algo, force=TRUE)
#TODO check for community stability
###############################################################################
# 3. Processing community role measures
###############################################################################
#cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Process community role measures\n",sep="")
process.role.measures(folder.data=net.folder, role.meas, comdet.algo, force=TRUE)
###############################################################################
# 4. Clustering role measures
###############################################################################
#cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Detect clusters\n",sep="")
detect.clusters(folder.data=net.folder, role.meas, clust.algo, comdet.algo)
###############################################################################
# 5. Additional stats and plots
###############################################################################
#cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Perform post processing\n",sep="")
post.process(folder.data=net.folder, role.meas, clust.algo, comdet.algo, overlap.threshold=0.74, force=TRUE)
###############################################################################
cat("[",format(Sys.time(),"%a %d %b %Y %H:%M:%S"),"] Done\n",sep="")