1 /* -*- mode: C -*-  */
2 /*
3    IGraph library.
4    Copyright (C) 2010-2012  Gabor Csardi <csardi.gabor@gmail.com>
5    334 Harvard street, Cambridge, MA 02139 USA
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301 USA
21 
22 */
23 
24 #include <igraph.h>
25 #include <stdio.h>
26 
main()27 int main() {
28 
29     igraph_t g;
30     igraph_bool_t simple;
31 
32     igraph_barabasi_game(/* graph=    */ &g,
33                                          /* n=        */ 100,
34                                          /* power=    */ 1.0,
35                                          /* m=        */ 2,
36                                          /* outseq=   */ 0,
37                                          /* outpref=  */ 0,
38                                          /* A=        */ 1.0,
39                                          /* directed= */ IGRAPH_DIRECTED,
40                                          /* algo=     */ IGRAPH_BARABASI_PSUMTREE,
41                                          /* start_from= */ 0);
42 
43     if (igraph_ecount(&g) != 197) {
44         return 1;
45     }
46     if (igraph_vcount(&g) != 100) {
47         return 2;
48     }
49     igraph_is_simple(&g, &simple);
50     if (!simple) {
51         return 3;
52     }
53 
54     igraph_destroy(&g);
55 
56     /* ============================== */
57 
58     igraph_barabasi_game(/* graph=    */ &g,
59                                          /* n=        */ 100,
60                                          /* power=    */ 1.0,
61                                          /* m=        */ 2,
62                                          /* outseq=   */ 0,
63                                          /* outpref=  */ 0,
64                                          /* A=        */ 1.0,
65                                          /* directed= */ IGRAPH_DIRECTED,
66                                          /* algo=     */ IGRAPH_BARABASI_PSUMTREE_MULTIPLE,
67                                          /* start_from= */ 0);
68 
69     if (igraph_ecount(&g) != 198) {
70         return 4;
71     }
72     if (igraph_vcount(&g) != 100) {
73         return 5;
74     }
75     igraph_is_simple(&g, &simple);
76     if (simple) {
77         return 6;
78     }
79 
80     igraph_destroy(&g);
81 
82     /* ============================== */
83 
84     igraph_barabasi_game(/* graph=    */ &g,
85                                          /* n=        */ 100,
86                                          /* power=    */ 1.0,
87                                          /* m=        */ 2,
88                                          /* outseq=   */ 0,
89                                          /* outpref=  */ 0,
90                                          /* A=        */ 1.0,
91                                          /* directed= */ IGRAPH_DIRECTED,
92                                          /* algo=     */ IGRAPH_BARABASI_BAG,
93                                          /* start_from= */ 0);
94 
95     if (igraph_ecount(&g) != 198) {
96         return 7;
97     }
98     if (igraph_vcount(&g) != 100) {
99         return 8;
100     }
101     igraph_is_simple(&g, &simple);
102     if (simple) {
103         return 9;
104     }
105 
106     igraph_destroy(&g);
107 
108     return 0;
109 }
110