-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.stu
386 lines (331 loc) · 8.7 KB
/
main.stu
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#
# This is the Stu script to generate the KONECT World Wide Web site.
# Stu is similar to Make, but with support for much more complex
# dependency structures. Run 'stu' in this directory (like you would
# run 'make'). Get Stu from:
#
# https://github.com/kunegis/stu
#
# The KONECT website is completely static -- it consists only of regular
# files that can be put on any HTTP server, or viewed locally. It does
# also not contain client-side scripts, but we may add some of those in
# the future.
#
# The website as generated by this script is in www/, and can be
# completely regenerated by this script. All HTML files are pure ASCII
# in www/. (We don't use UTF-8 in HTML files because even when each
# HTML file contains a UTF-8 declaration, that may be overridden by
# character encoding declarations in the HTTP header or somewhere else
# -- we want the website to be 100% portable.)
#
# The skeleton/ directory contains all HTML files, but without header
# and footer, in UTF-8.
#
# The static/ directory contains static content that is not generated,
# i.e., part of this package. It does not use a directory structure.
# It too allows UTF-8.
#
% version 2.5
@all:
www/index.html
www/networks/index.html
www/statistics/index.html
www/plots/index.html
www/categories/index.html
www/about/index.html
www/( main.css favicon.ico konect256.png )
www/ic/[dat-www/ICONS]
www/statistics/[dat-www/STATISTICS_MAIN]/index.html
www/categories/[dat/CATEGORIES]/index.html
www/networks/[dat/NETWORKS]/index.html
www/plots/[dat/PLOTS]/index.html
www/files/download.tsv.[dat/NETWORKS_DOWNLOAD].tar.bz2
www/plot/[dat-www/plots-network.[dat/NETWORKS]].(small full).png
;
#
# Directories
#
www/ { mkdir -p www ; }
www/$name/ { mkdir -p www/"$name" ; }
skeleton/$dir/: { mkdir -p skeleton/"$dir" ; }
dat/$name: -p dat/;
dat/ {
echo >&2 '*** dat/ must be a symlink to the analysis/dat/ directory of KONECT'
exit 1
}
uni/$name: -p uni/;
uni/ {
echo >&2 '*** uni/ must be a symlink to the konect/uni/ directory of KONECT'
exit 1
}
plot/ {
echo >&2 '*** plot/ must be a symlink to the analysis/dat/ directory of KONECT'
exit 1
}
dat-$name/ {
echo >&2 "*** dat-$name/ must be a symlink to the analysis/dat-$name/ directory of KONECT"
exit 1
}
konect-extr/ {
echo >&2 '*** konect-extr/ must be a symlink to the corresponding project directory'
exit 1
}
konect-handbook/$name: -p konect-handbook/;
konect-handbook/ {
echo >&2 '*** konect-handbook/ must be a symlink to the corresponding project directory'
exit 1
}
#
# Octave
#
octave = -o konect-analysis/ ;
>MATLABPATH: sh/mkmatlabpath { sh/mkmatlabpath ; }
#
# Stuff in dat-www/
#
# Only the main statistics, i.e., without substatistics
>dat-www/STATISTICS_MAIN: <dat/STATISTICS
{
grep -F -v +
}
dat-www/html-symbol.$statistic:
-t octave $[-t MATLABPATH]
m/www_html_symbol.m konect-toolbox/m/konect_label_statistic.m
{
./octave m/www_html_symbol.m
}
#
# HTML
#
www/$name.html:
sh/write-html
skeleton/$name.html static/(head foot).html
{
sh/write-html
}
>skeleton/index.html:
sh/write-index sh/format-int
dat/NETWORKS dat/CATEGORIES
dat-www/COUNT_(STATISTICS PLOTS)
{
sh/write-index
}
skeleton/about/index.html: static/about.html -p skeleton/about/
{
cp static/about.html skeleton/about/index.html
}
>skeleton/networks/index.html:
-p skeleton/networks/
sh/write-networks
skeleton/networks/table.html
{
sh/write-networks
}
>skeleton/networks/$network/index.html:
sh/write-network sh/read-meta sh/write-references
dat/ plot/
-p skeleton/networks/$network/ konect-extr/konect.bib
dat/NETWORKS_DOWNLOAD
uni/meta.$network
dat-www/plots-network.$network
konect-toolbox/m/konect_(consts data_plot).m
skeleton/networks/$network/(metadata statistics).html
{
sh/write-network
}
>skeleton/statistics/index.html:
sh/write-statistics
-p skeleton/statistics/
skeleton/statistics/table.html
{
sh/write-statistics
}
>skeleton/statistics/$statistic/index.html:
sh/write-statistic sh/format-int sh/write-references
-p skeleton/statistics/$statistic/
konect-toolbox/m/konect_label_statistic.m
skeleton/statistics/$statistic/(table.html count)
dat-www/html-symbol.$statistic
DESCRIPTIONS-STATISTIC REFERENCES-STATISTIC
konect-extr/konect.bib
{
sh/write-statistic
}
>skeleton/plots/index.html:
sh/write-plots
-p skeleton/plots/
skeleton/plots/table.html
{
sh/write-plots
}
>skeleton/categories/index.html:
sh/write-categories
-p skeleton/categories/
skeleton/categories/table.html
{
sh/write-categories
}
>skeleton/plots/$plot/index.html:
sh/write-plot -p skeleton/plots/$plot/ plot/
dat/NETWORKS
dat-www/plots-network.[dat/NETWORKS]
konect-toolbox/m/konect_data_plot.m
{
sh/write-plot
}
skeleton/networks/$network/statistics.html dat-www/COUNT_STATISTICS_$network:
-t octave $[-t MATLABPATH] m/www_table_network_statistics.m m/www_format_statistic.m
dat/STATISTICS dat/ konect-toolbox/m/konect_(label data)_statistic.m
-p skeleton/networks/$network/
{
./octave m/www_table_network_statistics.m
}
skeleton/networks/$network/metadata.html:
-t octave $[-t MATLABPATH] m/www_table_network_metadata.m
m/www_icon_category.m m/www_icon_check.m konect-toolbox/m/konect_data_tag.m
dat/ uni/meta.$network -o dat/check.$network
dat-www/availability.$network
{
./octave m/www_table_network_metadata.m
}
skeleton/statistics/$statistic/table.html skeleton/statistics/$statistic/count:
-t octave $[-t MATLABPATH]
m/www_table_statistic.m m/www_format_statistic.m
konect-toolbox/m/konect_label_statistic.m
dat/NETWORKS dat/STATISTICS dat/ uni/meta.[dat/NETWORKS]
{
./octave m/www_table_statistic.m
}
>skeleton/categories/$category/index.html:
<skeleton/categories/$category/base.html sh/write-category
skeleton/categories/$category/content.html
{
sh/write-category
}
skeleton/categories/$category/base.html:
-t octave $[-t MATLABPATH]
m/www_category.m
-p skeleton/categories/$category/
dat/NETWORKS_CATEGORY_$category
dat-www/COUNT_CATEGORY_$category
uni/meta.[dat/NETWORKS_CATEGORY_$category]
{
./octave m/www_category.m
}
>skeleton/categories/$category/content.html:
sh/handbook-category
<konect-handbook/konect-handbook.tex
konect-toolbox/m/konect_data_category.m
{
sh/handbook-category
}
skeleton/statistics/table.html:
-t octave $[-t MATLABPATH]
m/www_table_statistics.m konect-toolbox/m/konect_label_statistic.m
dat-www/STATISTICS_MAIN
{
./octave m/www_table_statistics.m
}
skeleton/networks/table.html:
-t octave $[-t MATLABPATH]
m/www_table_networks.m
konect-toolbox/m/konect_data_(category tag).m
dat/NETWORKS uni/meta.[dat/NETWORKS] -o dat/check.[dat/NETWORKS] -o dat/statistic.(size volume format weights).[dat/NETWORKS]
dat-www/availability.[dat/NETWORKS]
{
./octave m/www_table_networks.m
}
skeleton/plots/table.html:
-t octave $[-t MATLABPATH]
m/www_table_plots.m konect-toolbox/m/konect_data_plot.m
dat/PLOTS
{
./octave m/www_table_plots.m
}
skeleton/categories/table.html:
-t octave $[-t MATLABPATH]
m/www_table_categories.m
dat-www/CATEGORIES.sorted
dat-www/COUNT_CATEGORY_[dat/CATEGORIES]
{
./octave m/www_table_categories.m
}
#
# Helper content in dat-www/
#
>dat-www/COUNT_CATEGORY_$category: <dat/NETWORKS_CATEGORY_$category
{
wc -l
}
>dat-www/CATEGORIES.sorted: <dat/CATEGORIES
{
while IFS= read -r category ; do
<konect-toolbox/m/konect_data_category.m sed -E -e 's,^\s*longname\s*\.\s*('"$category"')\s*=\s*'"'"'(.*)'"'"'\s*;\s*$,\2;\1,;t;d'
done |
sort |
sed -E -e 's,^.*;,,'
}
>dat-www/COUNT_STATISTICS:
dat-www/COUNT_STATISTICS_[dat/NETWORKS]
{
<dat/NETWORKS sed -E -e 's,^,dat-www/COUNT_STATISTICS_,' | xargs cat | wc -l
}
>dat-www/COUNT_PLOTS:
dat-www/plots-network.[dat/NETWORKS]
{
<dat/NETWORKS sed -E -e 's,^,dat-www/plots-network.,' | xargs cat | wc -l
}
>dat-www/availability.$network: dat/NETWORKS_DOWNLOAD
{
if grep -q -E '^'"$network"'$' dat/NETWORKS_DOWNLOAD ; then
echo 1
else
echo 0
fi
}
#
# Plots
#
# Basename of all plots for one network, without directory name or
# filename suffix
>dat-www/plots-network.$network:
-p dat-www/ plot/
sh/list-plots
dat/PLOTS dat/DECOMPOSITIONS dat/DECOMPOSITIONS_ASYM SUBPLOTS
{
sh/list-plots
}
www/plot/$name.small.png:
-o plot/$name.(eps png) -p www/plot/ sh/convert-small
{
sh/convert-small
}
www/plot/$name.full.png:
-o plot/$name.(eps png) -p www/plot/ sh/convert-full
{
sh/convert-full
}
#
# Files
#
www/files/download.tsv.$network.tar.bz2: dat/download.tsv.$network.tar.bz2 -p www/files/
{
cp dat/download.tsv.$network.tar.bz2 www/files/
}
#
# Design
#
www/favicon.ico = logo/;
www/konect256.png = logo/;
www/main.css = static/;
# Note about icons: We don't use "icons" as a directory name because it
# is special to Apache, hence "ic".
>dat-www/ICONS: ic
{
cd ic/
ls -1U | grep -E '\.png$'
}
www/ic/$name: ic/$name -p www/ic/
{
cp ic/"$name" www/ic/
}