This repository has been archived by the owner on Dec 3, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathanalysis-repos.texw
62 lines (57 loc) · 1.84 KB
/
analysis-repos.texw
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
<<echo = False>>=
import igraph
import numpy as np
import collections
from matrix2latex import matrix2latex
g = igraph.read('repositories.gml').components().giant()
@
Central repositories, defined by degree and betweenness, both weighted and
unweighted, are presented in table~\ref{tab:topnodes}.
<<>>=
g.vs['degree'] = g.degree()
g.vs['degreew'] = g.strength(weights='weight')
g.vs['between'] = g.betweenness()
g.vs['betweenw'] = g.betweenness(weights='weight')
top_degree = g.vs[reversed(np.argsort(g.vs['degree'])[-5:].tolist())]
top_degreew = g.vs[reversed(np.argsort(g.vs['degreew'])[-5:].tolist())]
top_between = g.vs[reversed(np.argsort(g.vs['between'])[-5:].tolist())]
top_betweenw = g.vs[reversed(np.argsort(g.vs['betweenw'])[-5:].tolist())]
@
\begin{table}[htbp]
\caption{Top nodes (repositories) by various measures}
\label{tab:topnodes}
\begin{subtable}{0.5\textwidth}
<%= matrix2latex(top_degree['degree'], None, 'center', 'tabular',
alignment='r',
caption="Unweighted degree",
label="degree",
headerColumn = top_degree['label']) %>
\end{subtable}
~
\begin{subtable}{0.5\textwidth}
<%= matrix2latex(top_degreew['degreew'], None, 'center', 'tabular',
alignment='r',
format='$%.1f$',
caption="Weighted degree",
label="degreew",
headerColumn = top_degreew['label']) %>
\end{subtable}
\\[1em]
\begin{subtable}{0.5\textwidth}
<%= matrix2latex(top_between['between'], None, 'center', 'tabular',
alignment='r',
format='$%.1f$',
caption="Unweighted betweenness",
label="between",
headerColumn = top_between['label']) %>
\end{subtable}
~
\begin{subtable}{0.5\textwidth}
<%= matrix2latex(top_betweenw['betweenw'], None, 'center', 'tabular',
alignment='r',
format='$%.1f$',
caption="Weighted betweenness",
label="betweenw",
headerColumn = top_betweenw['label']) %>
\end{subtable}
\end{table}