1 /* -*- mode: C -*-  */
2 /*
3    IGraph library.
4    Copyright (C) 2007-2012  Gabor Csardi <csardi.gabor@gmail.com>
5    334 Harvard st, 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 
main()26 int main() {
27 
28     igraph_t g, g2;
29     igraph_bool_t iso;
30 
31     // Franklin graph
32     igraph_lcf(&g, 12, 5, -5, 6, 0);
33     igraph_famous(&g2, "franklin");
34 
35     igraph_isomorphic_vf2(&g, &g2,
36                           /*vertex.color1=*/ 0, /*vertex.color2=*/ 0,
37                           /*edge.color1=*/ 0, /*edge.color2=*/ 0,
38                           &iso, 0, 0, 0, 0, 0);
39     if (!iso) {
40         printf("Failure: Franklin\n");
41         return 1;
42     }
43 
44     igraph_destroy(&g);
45     igraph_destroy(&g2);
46 
47     // [3, -2]^4, n=8
48     igraph_lcf(&g, 8, 3, -2, 4, 0);
49 
50     if (igraph_ecount(&g) != 16) {
51         printf("Failure: [3, -2]^4, n=8\n");
52         return 1;
53     }
54 
55     igraph_destroy(&g);
56 
57     // [2, -2]^2, n=2
58     igraph_lcf(&g, 2, 2, -2, 2, 0);
59 
60     if (igraph_ecount(&g) != 1) {
61         printf("Failure: [2, -2]^2, n=2\n");
62         return 1;
63     }
64 
65     igraph_destroy(&g);
66 
67     // [2]^2, n=2
68     igraph_lcf(&g, 2, 2, 2, 0);
69 
70     if (igraph_ecount(&g) != 1) {
71         printf("Failure: [2]^2, n=2\n");
72         return 1;
73     }
74 
75     igraph_destroy(&g);
76 
77     // Regression test for bug #996
78     igraph_lcf(&g, 0, 0);
79     if (igraph_vcount(&g) != 0 || igraph_ecount(&g) != 0) {
80         printf("Failure: regression test for #996\n");
81         return 1;
82     }
83 
84     igraph_destroy(&g);
85 
86     return 0;
87 }
88