summaryrefslogtreecommitdiff
path: root/doc/power_law.1
blob: bfe45fde2145fc519bd692b9339e2077e41765f1 (plain)
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
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "POWER_LAW" "1" "September 2017" "www.complex-networks.net" "www.complex-networks.net"
.
.SH "NAME"
\fBpower_law\fR \- Sample N integers from a discrete power\-law distribution
.
.SH "SYNOPSIS"
\fBpower_law\fR \fIgamma\fR \fIk_min\fR \fIk_max\fR \fIN\fR
.
.SH "DESCRIPTION"
\fBpower_law\fR samples \fIN\fR elements from the discrete power\-law distribution
.
.IP "" 4
.
.nf

P(k) ~ k^{gamma}
.
.fi
.
.IP "" 0
.
.P
where
.
.IP "" 4
.
.nf

k_min <= k <= k_max, gamma < 1
.
.fi
.
.IP "" 0
.
.P
The program can be used to generate a power\-law degree distribution with an assigned value of the exponent <gamma\.
.
.SH "PARAMETERS"
.
.IP "\(bu" 4
\fIgamma\fR: Exponent of the power\-law distribution\.
.
.IP "\(bu" 4
\fIk_min\fR, \fIk_max\fR: Boundaries of the sampling interval\.
.
.IP "\(bu" 4
\fIN\fR The number of samples to generate
.
.IP "" 0
.
.SH "OUTPUT"
\fBpower_law\fR prints on the standard output the sampled values, one per line, in the format:
.
.IP "" 4
.
.nf

s1
s2
s3
 \.\.\.
sN
.
.fi
.
.IP "" 0
.
.P
The program returns the value \fB0\fR if the sum of the samples is even, or returns \fB1\fR otherwise\. The return value can be used to determine whether the set of samples can correspond to a degree sequence (if the sum of the sequence is odd, then the sequence cannot be a valid degree sequence)\. See \fIRETURN VALUES\fR below\.
.
.SH "EXAMPLES"
To generate \fIN=1000\fR independent samples from the power\-law distribution \fBP(k) ~ k^(\-3)\fR, where samples are in the interval \fB[3, 50]\fR, we can use:
.
.IP "" 4
.
.nf

$ power_law \-3\.0 3 50 1000
11
3
3
5
6
7
 \.\.\.\.
8
3
$
.
.fi
.
.IP "" 0
.
.P
To save the samples in the file \fBpl_\-3\.0_3_50_1000\fR, we redirect STDOUT:
.
.IP "" 4
.
.nf

$ power_law \-3\.0 3 50 1000 > pl_\-3\.0_3_50_1000
.
.fi
.
.IP "" 0
.
.SH "RETURN VALUES"
The value returned by \fBpower_law\fR can be used to test whether the sum of the resulting set of samples is even or odd\. Under Windows PowerShell, you can check the last exit code by inspecting the variable \fB$lastExitCode\fR right after executing \fBpower_law\fR, as in:
.
.IP "" 4
.
.nf

> power_law \-2\.7 4 300 5000 > pl_\-2\.7_4_300_5000
> $lastExitCode

0
>
.
.fi
.
.IP "" 0
.
.P
In this case, the exit code is \fB0\fR, meaning that the resulting set of samples has an even sum (and can be thus used as a degree sequence)\. Under Linux/MacOS/Unix (and in general when using any POSIX\-compliant shell) you should check the value of the variable \fB$?\fR, right after executing \fBpower_law\fR, i\.e\.:
.
.IP "" 4
.
.nf

$ power_law \-2\.5 3 500 5000 > pl_\-2\.5_3_500_5000
$ echo $?
1
$
.
.fi
.
.IP "" 0
.
.P
Notice that this particular run of \fBpower_law\fR has produced a sequence with an odd sum, which thus cannot correspond to a valid degree sequence\.
.
.SH "SEE ALSO"
deg_seq(1), conf_model_deg(1), conf_model_deg_nocheck(1)
.
.SH "REFERENCES"
.
.IP "\(bu" 4
V\. Latora, V\. Nicosia, G\. Russo, "Complex Networks: Principles, Methods and Applications", Chapter 5, Cambridge University Press (2017)
.
.IP "\(bu" 4
V\. Latora, V\. Nicosia, G\. Russo, "Complex Networks: Principles, Methods and Applications", Appendix 9, Cambridge University Press (2017)
.
.IP "" 0
.
.SH "AUTHORS"
(c) Vincenzo \'KatolaZ\' Nicosia 2009\-2017 \fB<v\.nicosia@qmul\.ac\.uk>\fR\.