Added the descriptions of the individual commands.
[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;