1 /*
2 IGraph library.
3 Copyright (C) 2021 The igraph development team <igraph@igraph.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19 #include <igraph.h>
20
21 #include "test_utilities.inc"
22
main()23 int main() {
24 igraph_t g, g_test;
25 igraph_bool_t same;
26 long int n_vertices = 4;
27
28 /* Undirected, should be a full graph */
29 IGRAPH_ASSERT(igraph_full_citation(&g, n_vertices, 0 /*undirected*/) == IGRAPH_SUCCESS);
30 igraph_small(&g_test, 4, IGRAPH_UNDIRECTED, 0, 1, 0, 2, 0, 3, 1, 2, 1, 3, 2, 3, -1);
31 IGRAPH_ASSERT(igraph_is_same_graph(&g, &g_test, &same) == IGRAPH_SUCCESS);
32 IGRAPH_ASSERT(same);
33 igraph_destroy(&g);
34 igraph_destroy(&g_test);
35
36 /* Directed, only edges from i->j if i > j */
37 IGRAPH_ASSERT(igraph_full_citation(&g, n_vertices, 1 /*directed*/) == IGRAPH_SUCCESS);
38 igraph_small(&g_test, 4, IGRAPH_DIRECTED, 1, 0, 2, 0, 3, 0, 2, 1, 3, 1, 3, 2, -1);
39 IGRAPH_ASSERT(igraph_is_same_graph(&g, &g_test, &same) == IGRAPH_SUCCESS);
40 IGRAPH_ASSERT(same);
41 igraph_destroy(&g);
42 igraph_destroy(&g_test);
43
44 /* Directed, 1 vertex, should be edgeless */
45 IGRAPH_ASSERT(igraph_full_citation(&g, 1 /*n_vertices*/, 1 /*directed*/) == IGRAPH_SUCCESS);
46 IGRAPH_ASSERT(igraph_ecount(&g) == 0);
47 igraph_destroy(&g);
48
49 /* Directed, 0 vertices, empty graph */
50 IGRAPH_ASSERT(igraph_full_citation(&g, 0 /*n_vertices*/, 1 /*directed*/) == IGRAPH_SUCCESS);
51 IGRAPH_ASSERT(igraph_vcount(&g) == 0);
52 igraph_destroy(&g);
53
54 VERIFY_FINALLY_STACK();
55 return 0;
56
57 }
58