1 /* -*- mode: C -*- */
2 /*
3 IGraph library.
4 Copyright (C) 2006-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 #include <math.h>
26 #include <stdlib.h>
27
28 #include "test_utilities.inc"
29
main()30 int main() {
31 igraph_t g;
32 igraph_matrix_t coords;
33
34 igraph_empty(&g, 15, 0);
35 igraph_matrix_init(&coords, 0, 0);
36
37 /* Predefined width, 2D */
38 igraph_layout_grid(&g, &coords, 5);
39 igraph_matrix_print(&coords);
40 printf("===\n");
41
42 /* Automatic width, 2D */
43 igraph_layout_grid(&g, &coords, -1);
44 igraph_matrix_print(&coords);
45 printf("===\n");
46
47 /* Predefined width and height, 3D */
48 igraph_layout_grid_3d(&g, &coords, 4, 2);
49 igraph_matrix_print(&coords);
50 printf("=====\n");
51
52 /* Predefined width, 3D */
53 igraph_layout_grid_3d(&g, &coords, 4, -1);
54 igraph_matrix_print(&coords);
55 printf("=====\n");
56
57 /* Predefined height, 3D */
58 igraph_layout_grid_3d(&g, &coords, -1, 3);
59 igraph_matrix_print(&coords);
60 printf("=====\n");
61
62 /* Automatic width and height, 3D */
63 igraph_layout_grid_3d(&g, &coords, -1, -1);
64 igraph_matrix_print(&coords);
65
66 igraph_matrix_destroy(&coords);
67 igraph_destroy(&g);
68
69 VERIFY_FINALLY_STACK();
70
71 return 0;
72 }
73