Magic triangle is READY.
7 #include <lemon/smart_graph.h>
8 #include <lemon/graph_writer.h>
10 using namespace lemon;
13 int main(int argc, const char *argv[]) {
14 typedef SmartGraph Graph;
15 typedef Graph::Node Node;
16 typedef Graph::Edge Edge;
18 typedef Graph::EdgeMap<int> CapacityMap;
20 const int n = argc > 1 ? atoi(argv[1]) : 1000;
21 const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log(n));
22 const int m = argc > 3 ? atoi(argv[3]) : 100;
25 CapacityMap capacity(graph);
28 for (int i = 0; i < n; ++i) {
29 nodes.push_back(graph.addNode());
31 for (int i = 0; i < e; ++i) {
32 int s = (int)(n * (double)rand() / (RAND_MAX + 1.0));
33 int t = (int)(n * (double)rand() / (RAND_MAX + 1.0));
34 int c = (int)(m * (double)rand() / (RAND_MAX + 1.0));
35 Edge edge = graph.addEdge(nodes[s], nodes[t]);
38 int start = (int)(n * (double)rand() / (RAND_MAX + 1.0));
39 writeGraph(cout, graph, capacity, nodes[start]);