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
26 #include "test_utilities.inc"
27
main()28 int main() {
29 igraph_t g;
30 igraph_vector_int_t res, res_all;
31 long int i;
32
33 igraph_small(&g, 6, IGRAPH_UNDIRECTED,
34 0, 1, 1, 2, 2, 5,
35 0, 3, 3, 4, 4, 5,
36 3, 2, 3, 5,
37 -1);
38
39 igraph_vector_int_init(&res, 0);
40
41 for (i = 0; i <= 5; i++) {
42 igraph_get_all_simple_paths(&g, &res, 0, igraph_vss_1(5), i, IGRAPH_ALL);
43
44 printf("Paths for cutoff %li:\n", i);
45 igraph_vector_int_print(&res);
46 }
47
48 igraph_vector_int_init(&res_all, 0);
49
50 igraph_get_all_simple_paths(&g, &res_all, 0, igraph_vss_1(5), -1, IGRAPH_ALL);
51
52 IGRAPH_ASSERT(igraph_vector_int_all_e(&res, &res_all) && "Paths of all lengths does not equal result for maximum cutoff.");
53
54 igraph_vector_int_destroy(&res_all);
55 igraph_vector_int_destroy(&res);
56 igraph_destroy(&g);
57
58 VERIFY_FINALLY_STACK();
59
60 return 0;
61 }
62