Update.
[mtp.git] / random-graph.cc
1
2 ////////////////////////////////////////////////////////////////////
3 // START_IP_HEADER                                                //
4 //                                                                //
5 // Written by Francois Fleuret                                    //
6 // Contact <francois.fleuret@idiap.ch> for comments & bug reports //
7 //                                                                //
8 // END_IP_HEADER                                                  //
9 ////////////////////////////////////////////////////////////////////
10
11 #include <iostream>
12 #include <fstream>
13 #include <cmath>
14 #include <stdio.h>
15 #include <stdlib.h>
16
17 using namespace std;
18
19 int main(int argc, char **argv) {
20   int nb_locations = 20;
21   int nb_time_steps = 20;
22
23   int nb_vertices = nb_time_steps * nb_locations + 2;
24   int nb_edges = 2 * nb_locations + (nb_time_steps - 1) * (nb_locations * nb_locations);
25   int source = 0;
26   int sink = nb_vertices - 1;
27
28   cout << nb_vertices << " " << nb_edges << endl;
29   cout << source << " " << sink << endl;
30   cout << endl;
31
32   for(int l = 0; l < nb_locations; l++) {
33     cout << source
34          << " "
35          << l + 1
36          << " "
37          << drand48() * 2 - 1
38          << endl;
39   }
40
41   for(int t = 0; t < nb_time_steps - 1; t++) {
42     for(int l = 0; l < nb_locations; l++) {
43       for(int m = 0; m < nb_locations; m++) {
44         cout << 1 + (t * nb_locations + l)
45              << " "
46              << 1 + ((t+1) * nb_locations + m)
47              << " "
48              << drand48() * 2 - 1
49              << endl;
50       }
51     }
52   }
53
54   for(int l = 0; l < nb_locations; l++) {
55     cout << 1 + ((nb_time_steps-1) * nb_locations + l)
56          << " "
57          << sink
58          << " "
59          << drand48() * 2 - 1
60          << endl;
61   }
62 }