-
Notifications
You must be signed in to change notification settings - Fork 9
/
run.sh
executable file
·245 lines (212 loc) · 8.28 KB
/
run.sh
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#!/bin/bash
function print_description {
echo "This script serves as a launcher of the software"
echo ""
echo "Synopis:"
echo " ./run.sh whattodo={test, demo-diffnets, demo-movies, gephi}"
echo ""
echo "Please specify what you want to do:"
echo " test - creates a differential network file data/test.json"
echo " for the dynamic network stored in data/test.sdnet"
echo " then it creates a movie for this network in movies/test.avi"
echo " demo-diffnets - creates differential network files in data/"
echo " for all demo networks stored in data/*.sdnet"
echo " demo-movies - creates movies in movies/"
echo " for all demo networks files stored in data/*.json"
echo " gephi - visualizes the dynamic network directly in Gephi"
echo " requires preparation steps described in README.md"
}
function get_shared_opts {
if [ ! -f data/$net.wdnet ]; then
gunzip -c data/$net.wdnet.gz > data/$net.wdnet;
fi
local shared_opts="--verbose 2 --inputformat weighted --input data/$net.wdnet"
shared_opts+=" --timecontraction $vtc --edgemin $edgemin"
echo $shared_opts
}
function get_label1 {
if [ ! -f data/$net.wdnet ]; then
gunzip -c data/$net.wdnet.gz > data/$net.wdnet;
fi
local label=""
if [ "$net" == "osama" ]; then label="death of"; fi
if [ "$net" == "superbowl" ]; then label="hashtags during the"; fi
if [ "$net" == "patents_full" ]; then label="words from"; fi
if [ "$net" == "imdb" ]; then label="plot keywords"; fi
echo $label
}
function get_label2 {
if [ ! -f data/$net.wdnet ]; then
gunzip -c data/$net.wdnet.gz > data/$net.wdnet;
fi
local label=""
if [ "$net" == "osama" ]; then label="Osama bin Laden"; fi
if [ "$net" == "superbowl" ]; then label="#superbowl"; fi
if [ "$net" == "patents_full" ]; then label="US patent titles"; fi
if [ "$net" == "imdb" ]; then label="of movies"; fi
echo $label
}
function run_fastviz {
local shared_opts="$(get_shared_opts) $1"
local label1="$(get_label1)"
local label2="$(get_label2)"
local viztype_opts="--viztype fastviz --forgetconst $vfc"
local output_suffix="_fastviz"
viztype_opts+=" --output data/${net}${output_suffix}"
./visualize_tweets_finitefile $shared_opts $viztype_opts \
--label1 "$label1" --label2 "$label2" \
> logs/diffnet_${net}${output_suffix}.log
}
function run_timewindow {
local shared_opts="$(get_shared_opts) $1"
local label1="$(get_label1)"
local label2="$(get_label2)"
local output_suffix="_timewindow"
local vtwmultip=1;
if [[ $1 == "wide" ]];
then
local vtwmultip=10;
output_suffix+="_wide";
fi
local vtw=$(echo "scale=0; $vtwmultip*$vtc/(1.0-$vfc)/3.0"|bc -l)
local viztype_opts="--viztype timewindow --maxstored 2000 --timewindow $vtw"
viztype_opts+=" --output data/${net}${output_suffix}"
./visualize_tweets_finitefile $shared_opts $viztype_opts \
--label1 "$label1" --label2 "$label2" \
> logs/diffnet_${net}${output_suffix}.log
}
function run_exp_timewindow {
local shared_opts="$(get_shared_opts) $1"
local label1="$(get_label1)"
local label2="$(get_label2)"
local output_suffix="_exptimewindow"
local vtwmultip=1;
if [[ $1 == "wide" ]];
then
local vtwmultip=10;
output_suffix+="_wide";
fi
local vtw=$(echo "scale=0; $vtwmultip*$vtc/3.0"|bc -l)
local viztype_opts="--viztype exptimewindow --maxstored 2000 --timewindow $vtw --forgetconst $vfc"
viztype_opts+=" --output data/${net}${output_suffix}"
./visualize_tweets_finitefile $shared_opts $viztype_opts \
--label1 "$label1" --label2 "$label2" \
> logs/diffnet_${net}${output_suffix}.log
}
if [ "$1" == "" ]; then
print_description
else
. vars.sh
export JSON_BIN=$(dirname ${JSON_LIBMT})
export JSON_LIBMT=$(basename ${JSON_LIBMT} | sed 's/^lib//' )
if [[ "$OSTYPE" != *"darwin"* ]]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JSON_BIN:$BOOST_BIN
else
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$JSON_BIN:$BOOST_BIN
fi
mkdir logs > /dev/null 2>&1
case "$1" in
"test" )
echo "===================================================================="
echo "Running a short test of the algorithm producing the differential network updates"
./visualize_tweets_finitefile --verbose 2 --input data/test.sdnet --timecontraction 100 --output data/test
if [ $? -ne 0 ]; then
echo "There is some problem, please check the instructions, exiting."
exit 1
else
echo "First tool finished successfully"
echo ""
fi
echo "===================================================================="
echo "Running a short test of the python script producing the movies"
python scripts/DynamicGraph_wici.py data/test.json
if [ $? -ne 0 ]; then
echo "There is some problem, please check the instructions, exiting."
exit 1
else
echo "Second tool finished successfully"
echo ""
fi
;;
"demo-diffnets" )
echo -n "Launched generation of differential network files "
echo
echo "Finished. Differential networks in json format are saved in the 'data' subdirectory and logs are saved in the 'logs' subdirectory."
;;
"demo-movies" )
echo "Launching generation of movies."
for myfile in data/*{timewindow,fastviz}.json; do
python scripts/DynamicGraph_wici.py $myfile
done
echo "Finished. Movies are saved in the 'movies' subdirectory."
;;
"allmethods-movies" )
echo "Launching generation of movies."
for myfile in data/*_fastviz_nosingletons.json; do
python scripts/DynamicGraph_wici.py $myfile
done
echo "Finished. Movies are saved in the 'movies' subdirectory."
;;
"allmethods-diffnets" )
echo -n "Launched generation of differential network files "
net="osama"; vtc=500; vfc=0.9; edgemin=0.95
echo -n "data/$net.wdnet "
run_fastviz &
# run_timewindow &
# run_exp_timewindow &
wait
net="superbowl"; vtc=3600; vfc=0.8; edgemin=10.0
echo -n "data/$net.wdnet "
run_fastviz &
# run_timewindow &
# run_exp_timewindow &
wait
net="imdb"; vtc=$((3600*24*365*3)); vfc=0.75; edgemin=10
echo -n "data/$net.wdnet "
run_fastviz &
# run_timewindow &
# run_exp_timewindow &
wait
net="patents_full"; vtc=$((3600*24*400)); vfc=0.65; edgemin=20
echo -n "data/$net.wdnet "
run_fastviz &
# run_timewindow &
# run_exp_timewindow &
wait
echo
echo "Finished. Differential networks in json format are saved in the 'data' subdirectory and logs are saved in the 'logs' subdirectory."
;;
"debug-fastviz" )
echo -n "Launched generation of differential network files "
net="debug"; echo -n "data/$net.sdnet "
# verbose 3 prints graph properties
# verbose 4 prints adjeciency matrix and lists
time ./visualize_tweets_finitefile --verbose 4 --viztype fastviz --input data/$net.sdnet --timecontraction $((30*100)) --maxvisualized 5 --forgetconst 1.0 --edgemin 0.95 --forgetevery 40 --output "data/${net}_fastviz"
;;
"debug-timewindow" )
echo -n "Launched generation of differential network files "
net="debug"; echo -n "data/$net.sdnet "
# verbose 3 prints graph properties
# verbose 4 prints adjeciency matrix and lists
time ./visualize_tweets_finitefile --verbose 4 --viztype timewindow --input data/$net.sdnet --timecontraction $((30*100)) --maxvisualized 50 --timewindow 30 --edgemin 0.95 --output "data/${net}_timewindow"
;;
"gephi" )
if [ "$2" == "" -o "$3" == "" -o "$4" == "" ]; then
echo "Synopis:"
echo " ./run.sh gephi input_file server_ip_address time_contraction"
echo "Example:"
echo " ./run.sh gephi data/osama.sdnet http://localhost 200"
exit 1
fi
echo "Launching direct graph streaming to Gephi."
./visualize_tweets_finitefile --verbose 2 --input $2 --server $3\
--timecontraction $4
;;
* )
echo "Option not recognized."
echo "Please try again using command line arguments specified below"
echo ""
print_description
;;
esac
fi