1 /* -*- mode: C -*-  */
2 /*
3    IGraph library.
4    Copyright (C) 2006-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 
main()26 int main() {
27 
28     igraph_t g;
29     igraph_real_t flow;
30     igraph_vector_t capacity;
31     igraph_integer_t source, target;
32     FILE *infile;
33     igraph_maxflow_stats_t stats;
34 
35     igraph_vector_init(&capacity, 0);
36 
37     /***************/
38     infile = fopen("ak-4102.max", "r");
39     igraph_read_graph_dimacs(&g, infile, 0, 0, &source, &target, &capacity,
40                              IGRAPH_DIRECTED);
41     fclose(infile);
42 
43     igraph_maxflow_value(&g, &flow, source, target, &capacity, &stats);
44 
45     if (flow != 8207) {
46         return 1;
47     }
48     igraph_destroy(&g);
49     /***************/
50 
51     /*   /\***************\/ */
52     /*   infile=fopen("ak-8198.max", "r"); */
53     /*   igraph_read_graph_dimacs(&g, infile, 0, 0, &source, &target, &capacity, */
54     /*             IGRAPH_DIRECTED); */
55     /*   fclose(infile); */
56 
57     /*   t=timer(); */
58     /*   igraph_maxflow_value(&g, &flow, source, target, &capacity, &stats); */
59     /*   t=timer()-t; */
60     /*   printf("8198: %g (time %.10f)\n", flow, t); */
61     /*   igraph_destroy(&g); */
62     /*   /\***************\/ */
63 
64     /*   /\***************\/ */
65     /*   infile=fopen("ak-16390.max", "r"); */
66     /*   igraph_read_graph_dimacs(&g, infile, 0, 0, &source, &target, &capacity, */
67     /*             IGRAPH_DIRECTED); */
68     /*   fclose(infile); */
69 
70     /*   t=timer(); */
71     /*   igraph_maxflow_value(&g, &flow, source, target, &capacity, &stats); */
72     /*   t=timer()-t; */
73     /*   printf("16390: %g (time %.10f)\n", flow, t); */
74     /*   igraph_destroy(&g); */
75     /*   /\***************\/ */
76 
77     /*   /\***************\/ */
78     /*   infile=fopen("ak-32774.max", "r"); */
79     /*   igraph_read_graph_dimacs(&g, infile, 0, 0, &source, &target, &capacity, */
80     /*             IGRAPH_DIRECTED); */
81     /*   fclose(infile); */
82 
83     /*   t=timer(); */
84     /*   igraph_maxflow_value(&g, &flow, source, target, &capacity, &stats); */
85     /*   t=timer()-t; */
86     /*   printf("32774: %g (time %.10f)\n", flow, t); */
87     /*   igraph_destroy(&g); */
88     /*   /\***************\/ */
89 
90     /*   /\***************\/ */
91     /*   infile=fopen("ak-65542.max", "r"); */
92     /*   igraph_read_graph_dimacs(&g, infile, 0, 0, &source, &target, &capacity, */
93     /*             IGRAPH_DIRECTED); */
94     /*   fclose(infile); */
95 
96     /*   t=timer(); */
97     /*   igraph_maxflow_value(&g, &flow, source, target, &capacity, &stats); */
98     /*   t=timer()-t; */
99     /*   printf("65542: %g (time %.10f)\n", flow, t); */
100     /*   igraph_destroy(&g); */
101     /*   /\***************\/ */
102 
103     igraph_vector_destroy(&capacity);
104 
105     return 0;
106 }
107