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
|
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KNN" "1" "September 2017" "www.complex-networks.net" "www.complex-networks.net"
.
.SH "NAME"
\fBknn\fR \- Compute the average nearest neighbours degree function
.
.SH "SYNOPSIS"
\fBknn\fR \fIgraph_in\fR [\fINO|LIN|EXP\fR \fIbin_param\fR]
.
.SH "DESCRIPTION"
\fBknn\fR computes the average nearest neighbours degree function knn(k) of the graph \fIgraph_in\fR given as input\. The program can (optionally) average the results over bins of equal or exponentially increasing width (the latter is also known as logarithmic binning)\.
.
.SH "PARAMETERS"
.
.TP
\fIgraph_in\fR
undirected input graph (edge list)\. If is equal to \fB\-\fR (dash), read the edge list from STDIN\.
.
.TP
NO
If the second (optional) parameter is equal to \fBNO\fR, or omitted, the program will print on output the values of knn(k) for all the degrees in \fIgraph_in\fR\.
.
.TP
LIN
If the second (optional) parameter is equal to \fBLIN\fR, the program will average the values of knn(k) over \fIbin_param\fR bins of equal length\.
.
.TP
EXP
If the second (optional) parameter is equal to \fBEXP\fR, the progam will average the values of knn(k) over bins of exponentially increasing width (also known as \'logarithmic binning\', which is odd, since the width of subsequent bins increases exponentially, not logarithmically, but there you go\.\.\.)\. In this case, \fIbin_param\fR is the exponent of the increase\.
.
.TP
\fIbin_param\fR
If the second parameter is equal to \fBLIN\fR, \fIbin_param\fR is the number of bins used in the linear binning\. If the second parameter is \fBEXP\fR, \fIbin_param\fR is the exponent used to determine the width of each bin\.
.
.SH "OUTPUT"
The output is in the form:
.
.IP "" 4
.
.nf
k1 knn(k1)
k2 knn(k2)
\.\.\.\.
.
.fi
.
.IP "" 0
.
.P
If no binning is selected, \fBk1\fR, \fBk2\fR, etc\. are the degrees observed in \fIgraph_in\fR\. If linear or exponential binning is required, then \fBk1\fR, \fBk2\fR, etc\. are the right extremes of the corresponding bin\.
.
.SH "EXAMPLES"
To compute the average neanest\-neighbours degree function for a given graph we just run:
.
.IP "" 4
.
.nf
$ knn er_1000_5000\.net
2 10\.5
3 11\.333333
4 10\.785714
5 11\.255319
6 11\.336601
7 11\.176292
8 11\.067568
9 11\.093519
10 10\.898438
11 10\.906009
12 11\.031353
13 10\.73938
14 10\.961538
15 10\.730864
16 10\.669118
17 10\.702206
18 10\.527778
19 11\.302632
20 11\.8
$
.
.fi
.
.IP "" 0
.
.P
Since we have not requested a binning, the program will output the value of knn(k) for each of the degrees actually observed in the graph \fBer_1000_5000\.net\fR (the mininum degree is 2 and the maximum degree is 20)\. Notice that in this case, as expected in a graph without degree\-degree correlations, the values of knn(k) are almost independent of k\.
.
.P
We can also ask \fBknn\fR to bin the results over 5 bins of equal width by running:
.
.IP "" 4
.
.nf
$ knn er_1000_5000\.net LIN 5
6 11\.249206
10 11\.037634
14 10\.919366
18 10\.68685
22 11\.474138
$
.
.fi
.
.IP "" 0
.
.P
Let us consider the case of \fBmovie_actors\.net\fR, i\.e\. the actors collaboration network\. Here we ask \fBknn\fR to compute the average nearest\-neighbours degrees using exponential binning:
.
.IP "" 4
.
.nf
$ knn movie_actors\.net EXP 1\.4
2 142\.56552
5 129\.09559
9 158\.44493
15 198\.77922
23 205\.96538
34 210\.07379
50 227\.57167
72 235\.89857
102 254\.47583
144 276\.572
202 307\.11004
283 337\.83733
397 370\.34222
556 410\.89117
779 446\.66331
1091 498\.73118
1527 547\.31923
2137 577\.87852
2991 582\.6855
4187 557\.44801
$
.
.fi
.
.IP "" 0
.
.P
Notice that, due to the presence of the second parameter \fBEXP\fR, the program has printed on output knn(k) over bins of exponentially increasing width, using an exponent \fB1\.4\fR\. This is useful for plotting with log or semilog axes\. In this case, the clear increasing trend of knn(k) indicates the presence of assortative correlations\.
.
.SH "SEE ALSO"
knn_w(1), deg_seq(1)
.
.SH "REFERENCES"
.
.IP "\(bu" 4
V\. Latora, V\. Nicosia, G\. Russo, "Complex Networks: Principles, Methods and Applications", Chapter 7, Cambridge University Press (2017)
.
.IP "" 0
.
.SH "AUTHORS"
(c) Vincenzo \'KatolaZ\' Nicosia 2009\-2017 \fB<v\.nicosia@qmul\.ac\.uk>\fR\.
|