Cosmetics.
[mtp.git] / fridge
1
2 ######################################################################
3
4 2012 Aug 22 14:26:53 (from mtp.cc)
5
6
7   exit(0);
8
9   if(argc < 2) {
10     cerr << argv[0] << " <graph file>" << endl;
11     exit(EXIT_FAILURE);
12   }
13
14   ifstream *file = new ifstream(argv[1]);
15
16   int nb_edges, nb_vertices;
17   int source, sink;
18
19   if(file->good()) {
20
21     (*file) >> nb_vertices >> nb_edges;
22     (*file) >> source >> sink;
23
24     scalar_t *edge_lengths = new scalar_t[nb_edges];
25     int *vertex_from = new int[nb_edges];
26     int *vertex_to = new int[nb_edges];
27     int *result_edge_occupation = new int[nb_edges];
28
29     for(int e = 0; e < nb_edges; e++) {
30       (*file) >> vertex_from[e] >> vertex_to[e] >> edge_lengths[e];
31     }
32
33     find_best_paths(nb_vertices, nb_edges,
34                     vertex_from, vertex_to, edge_lengths,
35                     source, sink,
36                     result_edge_occupation);
37
38     // dot_print(nb_vertices, nb_edges,
39     // vertex_from, vertex_to, edge_lengths,
40     // source, sink,
41     // result_edge_occupation);
42
43     delete[] result_edge_occupation;
44     delete[] edge_lengths;
45     delete[] vertex_from;
46     delete[] vertex_to;
47
48   } else {
49
50     cerr << "Can not open " << argv[1] << endl;
51
52     delete file;
53     exit(EXIT_FAILURE);
54
55   }
56
57   delete file;
58
59 ######################################################################
60
61 2012 Dec 29 00:09:41 (from mtp_example.cc)
62
63   { // ******************************* START ***************************
64 #warning Test code added on 2012 Dec 29 00:07:21
65     int nb_vertices = 100;
66     int *vertex_from = new int[nb_vertices];
67     int *vertex_to = new int[nb_vertices];
68     for(int k = 0; k < nb_vertices; k++) {
69       vertex_from[k] = k;
70       vertex_to[k] = (k + 1)%nb_vertices;
71     }
72     MTPGraph mg(nb_vertices, nb_vertices, vertex_from, vertex_to, 0, nb_vertices/2);
73     delete[] vertex_from;
74     delete[] vertex_to;
75   } // ******************************** END ****************************
76